开发者

Using MOA to classify new examples?

开发者 https://www.devze.com 2023-01-02 16:38 出处:网络
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)

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 开发者_StackOverflowstream (atest.arff) to predict the classes. Has anyone done this before?


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) "


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消