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 🙂