• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java or Python Better for Machine Learning?  RSS feed

 
Ranch Hand
Posts: 1505
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a long-time Java developer (and dreading having to learn yet another language), my client is convinced that Python has the better, more complete, libraries for machine learning.

Browsing Amazon, he seems to be correct as the Python machine learning books vastly outnumber the Java books. And, the Java books (mostly by Packt) don't let you really see what's in them (on the Amazon site) making it difficult to judge them.

My goal is to stick with Java, if possible, but I need a good Java ML Library that can do things like:

Support Vector Machines
Discriminant Analysis
Logistic Regression
and related.

To date, I cannot find a hands-on book, with a corresponding (approachable) library (or book) for Java that shows you step by step how to load data, train data, predict, etc..

There is a Java library called WEKA, but it's extremely complex and it doesn't handle things like box's M test so I'd have to code that externally somehow.

So, just wondering if anyone here is into ML and if you've found a good Java (or Python) library and would be willing to share your thoughts?

Is Python the better way to go due to existing libraries?

Thanks in advance,

- mike
 
Ranch Hand
Posts: 924
9
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's an interesting question, Mike. Recently I wanted to refresh my knowledge on AI and machine learning, topics I left behind other interests after my CS degree - achieved quite a few years ago, with a thesis on genetic algorithms. I rember that, at the time, C++ and C were widely adopted and a "must" to learn for anyone willing to work in AI / Machine learning - at least at the University I attended to. I was quite surprised that nowadays Python seems to be the new King of the Hill.
Honestly, I think that my surprise is amiss, and a clear symptom of a worse pathology - the habit of thinking exclusively in Java.
Python rules for a number of reasons: the very first that comes to my mind is the simplicity in dealing with vector, matrices, tensors and, generally speaking, with all maths artifacts via numpy library.
As Java is my everyday programming language, I made  a search similar as yours, but at the very end I realized that learning Python would have been a more useful approach.
Nevertheless, besides Weka library (I used it for my thesis, and found it very complete), let me suggest you DeepLearning4J. It's a wide library focused on deep learning - neural nets, in a nutshell.

All the best for your work and study.
 
Ranch Hand
Posts: 79
1
Eclipse IDE Firefox Browser Netscape
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that google and amazon both have an api for ai, but your program would have to connect to their server at runtime in order to use it. I didn't look into it beyond that because I have seen how in the past they allow free access to an api then shut it off to everyone until you pay a subscription fee, such as googles translate api. Also there's the question of them having access to your data... stealing your research is part of why it's "free". If there are any good self contained apis for AI in any language I would love to look into it.
 
S Fox
Ranch Hand
Posts: 79
1
Eclipse IDE Firefox Browser Netscape
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
forgot to say, facebook also has an api.
 
Mike London
Ranch Hand
Posts: 1505
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
S Fox wrote:I think that google and amazon both have an api for ai, but your program would have to connect to their server at runtime in order to use it. I didn't look into it beyond that because I have seen how in the past they allow free access to an api then shut it off to everyone until you pay a subscription fee, such as googles translate api. Also there's the question of them having access to your data... stealing your research is part of why it's "free". If there are any good self contained apis for AI in any language I would love to look into it.


Very good info, thanks!

We had looked at WEKA but found it mostly unapproachable. To really use it, you need to dive in and learn the vast API. For simple things it might be OK, but I'm now finding that Python with Pandas and other libraries is much better and support is widely available (as opposed to the odd email-only list WEKA has). Python also excels with statistics.

Having been a Java dev for more than 15 years, I was dumbfounded that Java lacked these libraries.

The challenge I have learning ML is that all the Python books seem to use this (IMHO) weird Jupiter Notebook format. That format is OK for explaining something, but it's often difficult (I have given up more than once) to try to see where they populated X_train and y_train or to follow along typing in code. Other training courses like Coursera use the same notebook format making their courses also very difficult to follow along with (where are all the source code 'py' files for us IDE types?).

Although I realize I'm not really "late to the party" with ML, I do feel like a fish out of water.

Python itself is nice, but there are strange (to me) things like the zip command to combine tuples, and Python's ideas about "encapsulation" (not any, really).

Other concepts like Lambdas seem much simpler in Python than Java. No need to learn all the Consumer and other interfaces and how to apply them just to use a Lambda.

Sorry for the rambling. I really appreciate your posting.

- mike
 
Mike London
Ranch Hand
Posts: 1505
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
S Fox wrote:I think that google and amazon both have an api for ai, but your program would have to connect to their server at runtime in order to use it. I didn't look into it beyond that because I have seen how in the past they allow free access to an api then shut it off to everyone until you pay a subscription fee, such as googles translate api. Also there's the question of them having access to your data... stealing your research is part of why it's "free". If there are any good self contained apis for AI in any language I would love to look into it.


Don't like those subscription models at all.

Pretty soon, I'll have to rent the fonts for every forum message like this one.

Appreciate your reply.

- mike
 
Mike London
Ranch Hand
Posts: 1505
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
S Fox wrote:forgot to say, facebook also has an api.


I am very happy to say I've never used Facebook and never plan to.

- mike
 
S Fox
Ranch Hand
Posts: 79
1
Eclipse IDE Firefox Browser Netscape
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have rarely used python. I never use facebook either, I used to work for a similar company though, know full well what happens in there! Things nobody would suspect, shady stuff.

Don't laugh off facebook though, they're doing serious R&D now. They hired a former darpa chief to manage their projects. They aren't just doing AI, they are also attempting to create a mind-reading aparatus. They want to wirelessly steal your thoughts and sell them to marketers and various other agencies! It will be a great addition to their occulus rift VR headset which they also develop, how else can you persuade someone to wear a thing so invasive to privacy.
Heres the website, some of their code is on github: Facebook AI Research

I think AI will really go to the next level with quantum computing, intel is working on advancing that right now. They even will give free access for you to play with their quantum computers remotely just sign up on their website. Microsoft is creating a new language for quantum computing which should be ready by next year, thats when quantum will become less of a toy and more of a real world thing. If you want to simulate a quantum computer at home its possible, but takes an incredible amount of ram.

Intel is developing a coprocessor for AI which is supposed to compete with nvidia, supposedly it's going to be faster... and nvidia just the other day came out with a new product which lowers the price for entry level ML hardware, a cheaper version of volta. Titan V
 
S Fox
Ranch Hand
Posts: 79
1
Eclipse IDE Firefox Browser Netscape
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The very day after I wrote this, MS released the new language and named it Q#
https://techcrunch.com/2017/12/11/microsoft-releases-quantum-computing-development-kit-preview/
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!