Java Weka API: Adding List To Instances Object

This is just a quick one to save anyone else new to the Weka api in Java spending as much time as i did figuring this one out.

Lets suppose you have a weka instances object and a new list of values you want to add into it as a new attribute (weka slang for a new column in your data).

Below gist shows a small reproducible example of this.

And you should see some output like this:

====== BEFORE ======

====== AFTER ======

Above we can see the new attribute “randomDouble” has been added to the instances object.

I’m learning the weka java api at the moment so will try post little tidbits like this that could be useful for others of even myself 6 months from now 🙂

Java for Machine Learning

I’ve recently been learning java for machine learning related work (a long story to do with mainframes, and you know, why not).

Decided to stick down in here some resources i found very useful as i found i still needed to do a bit of Googling to find ML related Java tutorials and moocs i found useful. Will add to this post as i discover more stuff.

General Java Intro Stuff

Machine Learning Related

Testing in Java

Found this video pretty good on junit. And this one from intelij if that’s your IDE.

Java IDE’s

This was one of the hardest parts – finding my way around IDE’s like eclipse and intelij. They are super powerful but a very different experience to something like jupyter lab or visual studio with python.

I’m using intelij IDEA and they have some good videos here.


Other Useful/Interesting Stuff