You save a trained classifier with the
-d option (dumping), e.g.:
java weka.classifiers.trees.J48 -C 0.25 -M 2 -t /some/where/train.arff -d /other/place/j48.model
And you can load it with
-l and use it on a test set, e.g.:
java weka.classifiers.trees.J48 -l /other/place/j48.model -T /some/where/test.arff
Note, when loading a model you no longer need to supply specific parameters to the classifier.
A trained model can be saved like this, e.g., J48:
- train your model on the training data
- right-click in the Results list on the item which model you want to save
- select Save model and save it to
You can load the previously saved model with the following steps:
- load your test data
/some/where/test.arffvia the Supplied test set button
- right-click in the Results list, select Load model and choose
- select Re-evaluate model on current test set
Making Predictions with your model without retraining
See the Making predictions article for detailed information.
See Serialization for code examples.