Reputation: 12697
I've installed weka and the python-weka-wrapper.
I got as far as
from weka.classifiers import Classifier
clf=Classifier(classname="weka.classifiers.rules.JRip")
from random import randint
X = [[randint(1,10) for _ in range(5)] for _ in range(100)]
y = [randint(0,1) for _ in range(100)]
but now I don't know how to load my data which is available as a Python data structure.
How can I load my data matrices, output the rules (in some parsable format) and test the classifier on new data?
Upvotes: 1
Views: 365
Reputation: 2608
You can create data on the fly, by defining the structure (ie attributes) and then adding the data rows. Also, I added a convenience method to instantiate Instances to the weka.core.dataset
module called create_Instances_from_lists
, which is scheduled for the next release.
This question has been answered on the project's mailing list as well, including examples and pointers.
Upvotes: 2