> I am having trouble getting the model for a cross-validate classifier. I am using Python wrapper.
> I have tried something like below:
> cls = Classifier(classname="weka.classifiers.trees.M5P", options=["-M", "4.0"])
> pout = PredictionOutput(classname="weka.classifiers.evaluation.output.prediction.PlainText")
> evl = Evaluation(data)
> evl.crossvalidate_model(cls, data, 10, Random(1), pout)
> print(evl.summary("=== Summary ===", False))
> But I just can not find the method to return the model.
Cross-validation generates X number of models internally, evaluates
them and discards them. It is only used for collecting statistics.
If you want to generate an actual model, you have to build it with a
dataset explicitly (the Explorer does that implicitly on the full
datasets, which always confuses people).
Add the following lines after your evaluation code: