1
votes

I trained my model on a FilteredClassifier with Attribute selection in Weka. Now, I am unable to use the serialized model for Test data classification, I searched a lot but really couldn't figure out. This is what I am doing at the moment:

java -cp $CLASSPATH  weka.filters.supervised.attribute.AddClassification\
     -serialized Working.model \
     -classification \
     -remove-old-class \ 
     -i full_data.arff \ 
     -c last

It gives me an error saying

 weka.core.WekaException: Training header of classifier and filter dataset don't match

But they aren't supposed to right? Since the Test data shouldn't have the class in the header. How should I use it? Also, I hope the selected attributes will be serialized and saved in the model, since the same attribute selection needs to be done on the test data.

I prefer not using Batch classifier since it defeats the point of a feature of saving the model and needs me to run the whole training each time.

1

1 Answers

1
votes

One easy way to get it to work is by adding the nominal class to the ARFF file you created with a random class with dummy values, and then removing it with the -remove-old-class option.

So your command would remain the same, but your ARFF file will have the class this time.