I've been using the Weka GUI (the explorer in 3.7.11 specifically) to train some models. I then save the trained model by right-clicking on the model in the results pane. I've written some simple Java code that can load that saved model and use it to classify new instances. This all works great.
Naturally, I'd like to do some pre-processing to my data before training the model. Some of the pre-processing steps learn values. For example, the missing values filter learns the mean or mode of each feature from the training data. I would therefore like to save the learned filters just like I saved the learned model so I can apply the filters and then the model to new instances that weren't available when I trained my model.
I can't seem to find any way to serialize the filters. Can this be done? If not, any advice for a simple work-around?
From Mark Hall on the Weka mailing list:
http://list.waikato.ac.nz/pipermail/wekalist/2014-November/062329.html
Basically you chose the "Filtered Classifier" in the "meta classifiers" category as your classifier. Then choose whatever classifier you want as the classifier it uses. Then choose the "multi filter" meta filter and apply any series of filters before the classifier. The result is what appears to be a single classifier that can be saved but it's actually a series of filters followed by the classifier.