0
votes

I am using weka 3.6.13 and trying to use a model to classify data:

java -cp weka-stable-3.6.13.jar weka.classifiers.Evaluation weka.classifiers.trees.RandomForest -l Parking.model -t Data_features_class_ques-2.arff  

java.lang.Exception: training and test set are not compatible

though the model works when we use the GUI, through Explorer->Claasify ->Supplied test set and load the arff file->right click on result list and load model-> again right click -> re-evaluate model on current data set...

Any pointers please help.

1

1 Answers

1
votes

If your data contains "String" features then first use StringToWordVector in batch mode i.e. for both data set in single command (command 1) then use command 2 and command 3.

Command 1.

java weka.filters.unsupervised.attribute.StringToWordVector -b -R first-last -i training.arff -o training_s2w.arff -r test.arff -s test_s2w.arff

Command 2.

java weka.classifiers.trees.RandomForest -t training_s2w.arff -d model.model

Command 3.

java weka.classifiers.trees.RandomForest -T test_s2w.arff -l model.model -p 0 > result.txt

PS: add path for weka.jar accordingly.