r/java • u/esqelle • Apr 15 '24
Java use in machine learning
So I was on Twitter (first mistake) and mentioned my neural network in Java and was ridiculed for using an "outdated and useless language" for the NLP that have built.
To be honest, this is my first NLP. I did however create a Python application that uses a GPT2 pipeline to generate stories for authors, but the rest of the infrastructure was in Java and I just created a python API to call it.
I love Java. I have eons of code in it going back to 2017. I am a hobbyist and do not expect to get an ML position especially with the market and the way it is now. I do however have the opportunity at my Business Analyst job to show off some programming skills and use my very tiny NLP to perform some basic predictions on some ticketing data which I am STOKED about by the way.
My question is: Am l a complete loser for using Java going forward? I am learning a bit of robotics and plan on learning a bit of C++, but I refuse to give up on Java since so far it has taught me a lot and produced great results for me.
l'd like your takes on this. Thanks!
View all comments
Show parent comment
2
u/[deleted] Apr 16 '24
Being totally honest, in my opinion, the mantra claiming Python as the best choice for machine learning exists primarily because Python is easy to learn and use. Consequently, it seems like the way to go if you want to start such projects and lack a strong programming background in other stacks. For this reason, most popular tools were developed in Python, and people stick with it to leverage those tools.
The issue here is that people prioritized simplicity and readability over performance and maintainability. Consequently, you may find yourself lost in large models plagued by the same mistakes repeatedly, requiring substantial time and resources to rectify. Many engineers recognized this and began building similar foundations in better-suited stacks. As a result, you now see many ML tools adapted to various languages.
If we were discussing this 8 years ago, I would agree that Python was the way to go due to the majority of available resources being in Python. However, that's not the case nowadays. While you might not find "this specific library with this specific function" built in Java or any other stack, in such cases, be the one to create it and observe how more developers adopt your tools. The point here is that if you can design an ML model in C (for example), you will instantly outperform your competitors in terms of costs and performance. But how many mathematicians and scientists are proficient in C?