DEV Community

Discussion on: Choosing Java as your language for a Machine Learning project - Are we crazy???

Collapse
 
cicirello profile image
Vincent A. Cicirello

If you really needed Python in your Java app, another option aside from Flask is to use the GraalVM, which is designed with polyglot programming in mind.

Anyway, nice post. I do research in AI, mostly evolutionary computation, metaheuristics, and related concepts. And nearly all of my research code is in Java. I use Python mainly for data analysis tasks such as to analyze data from experiments, etc, but the experiments themselves are in Java.

My main reasons for Java over Python for this come down to speed and better support for multithreading, as well as decades of code I've already written in Java. If I was starting from scratch, I don't think I'd pick Python but if I did go with Python I'd probably end up implementing the majority in C rather than directly in Python.

However, if I was working on an ML project, I imagine I'd likely end up using Python in one way or another due to the really good existing ML libraries. Although like your post explains, if ML was a small part, I might end up with a polyglot approach.

Collapse
 
jcabot profile image
Jordi Cabot

Thanks a lot for your detailed comments!. And good to see that you've not had any major issue with Java in AI research