WEKA can easily be used to perform some simple Machine Learning in JAVA. While developing a small project for classifying some data derived from a wearable for activity recognition, I missed a short summary what is needed to classify with WEKA in a JAVA project. So this post serves as a memo to myself (or anyone who finds it usefull).
A standard WEKA installation contains all the needed java files. Normally in your WEKA installation folder there resides a weka-src.jar file. Extract it with an archive manager which is able to handle the ZIP format. Create a lib directory (if not present) and run ANT.
Now it’s pretty straight forward to create some code that builds a model from some data (in this case stored in a CSV file) .
I’ve setup a short GIST containing everything needed to build the model, Evaluate a model and classify some live captured data (aka classify a single datum).
This is just a starting point to get setup. It is possible to implement much more sophisticated ML Pipelines with WEKA 😉 The Documentation under http://weka.sourceforge.net/doc.stable-3-8/ might help you.
If you want to use that on Android you can do that. The Problem is that WEKA makes use of the JAVA Swing libs to realise the GUI. This can be solved by just stripping these parts out, or just use the this repo where someone did it for us: https://github.com/rjmarsan/Weka-for-Android.