I am attempting to use an ML library to do some local prototyping, and have been looking at both Deeplearning4j and Deeplearning.scala. I was hoping someone can chime in as to what are some pros and cons for these.
The former has been around for a few years, and seems to have a heavy backing from some big players. For the latter, I like that it’s Scala first. This is the extent that I know for both.
What am I looking for in a library;
I want something that I can train some models - Linear Regression, but possibly some CNNs. Access to using a GPU would be nice (I have an old Nvidia 750GT doing nothing on a machine - maybe use that sucker (with CUDA) for training), without doing any C or reinventing the wheel - something baked it is highly desired.
If there are other libraries/frameworks that I can use for personal projects (Spark ML seems like overkill, especially since I am doing development on a personal machine), please let me know.
Thanks in advance!
In general I think the Java APIs are lacking in comparison with Python, especially in relation to the tools (think of all the PyTorch utilties you have). So be aware of this.
Having said that, I have been looking at Java and Scala APIs. Take everything I say next with a grain of salt.
I did some exploration with DL4J and find that the API are not very intuitive. Its DataVec is an example. DL4J provides some goodies such as hyper-parameter fine-tuning so that is a plus. However, its RL library seems to have been abandoned. You have a discourse group for help. This will be handy because the documentation is a little patchy. This library is not used much by researchers and seems to have a small community (vis Tensorflow and PyTorch). It will get you started for simple experiments.
I have not dug into Deeplearning.scala but from a cursory look I took several months ago, I would say this is the framework that most adheres to Scala’s programming style. Haven’t checked the documentation, but seems lacking. One interesting point here is that they seem to provide a
Differentiable Programming model (seem to be related to its plug-in model). Is you are starting off, this is not important. But for those trying to experiment with new stuff, this is the way to go. It has a Gitter channel but I have not browsed it - I tend to shy away from this type of interface. I think one of the libraries authors is on this list, so maybe you will get better input.
To end this take a look at https://djl.ai/. I provides Java APIs for several frameworks (Tensorflow, ONNX, MXNET, PyTorch). Has many examples. It also provides APIs to access several models Zoos - you can quickly experiment with existing trained models. You can quickly get started with MXNet as the back-end. I think this would be the best option to start. Don’t know how easy it easy to create you own models though.
Other frameworks have a minimum Java and/or Scala support. The best so far I would say is MXNet. However I have not explored their API and their is a lack of documentation. Be aware that they are now setting the road map for version 2.0 and are discussing the future steps. Currently you have Scala and Java APIs.
Any of the frameworks above will allow you to use CNNs. I think they all support CUDA. I have yet to find one that uses OpenCL but have not looked extensively for this. If accessing a GPU is prblematic, make sure install MKL or OpenBLAS.
I have explored the same question a bit over the years, and one very nice library is https://github.com/eaplatanios/tensorflow_scala - tensorflow in scala. Also the Java API of tensorflow is now fairly well developed (https://github.com/tensorflow/java), so one may be able to work with it.
Thanks a lot @hmf && @siddhartha-gadgil - much appreciated.
I am definitely coming to the realization that Python is a lot better at ML, especially at the rapid prototyping and PoC than anything on the JVM. A shame, really.
I do wonder what are the canonical “production” API/libraries that are used for these tasks - is it still Python, but compiled perhaps? Or is it Spark ML?
For personal and learning projects you might find this appealing: https://github.com/pityka/lamp (disclosure: I am the author).
Otherwise you are better off with pytorch.
Thanks @pityka - I will have a look. Looks neat.