views:

87

answers:

2

I'm trying to use the java machine learning library MOA to train on a training data stream, then predict classes for a test data stream. The first part works fine, using (for example)

java -cp .:moa.jar:weka.jar -javaagent:sizeofag.jar moa.DoTask "LearnModel -l MajorityClass -s (ArffFileStream -f atrain.arff -c -1) -O amodel.moa"

But then I cannot figure out how to use the trained model (amodel.moa) on another stream (atest.arff) to predict the classes. Has anyone done this before?

A: 

It might be easiest just to use the Weka wrapper for MOA classifiers:

java -cp .:moa.jar:weka.jar -javaagent:sizeofag.jar weka.classifiers.meta.MOA -B moa.classifiers.NaiveBayes -t atrain.arff -d amodel.model
java -cp .:moa.jar:weka.jar -javaagent:sizeofag.jar weka.classifiers.meta.MOA -T atest.arff -l amodel.model -p 4

Where of course -p indicates the column to predict.

Travis Brown
A: 

Try to use "EvaluateModel" with the -m option:

java -cp .:moa.jar:weka.jar -javaagent:sizeofag.jar moa.DoTask "EvaluateModel -m file:amodel.moa -s (ArffFileStream -f atest.arff -c -1) "
Albert Bifet