I want to save the classifier errors to arff file using weka's python3 wrapper. To accomplish this using the weka GUI, I first run any classifier, then right-click the item from the result list and click "Visualize classifier errors". This opens a window (refer image). Then to save the arff file I just click the save button. Since I need to do this for many files and for different classifiers, I can't do this manually.
Hence, I wrote the following code:
from weka.core.converters import Loader
from weka.classifiers import FilteredClassifier, Classifier
from weka.filters import Filter
from weka.classifiers import Evaluation
from weka.core.classes import Random
PATH = "file.arff"
loader = Loader(classname="weka.core.converters.ArffLoader")
data = loader.load_file(PATH)
data.class_is_last()
remove = Filter(classname="weka.filters.unsupervised.attribute.Remove", options=["-R", "1"])
cls = Classifier(classname="weka.classifiers.trees.J48", options=["-C", "0.25", "-M", "2"])
fc = FilteredClassifier()
fc.filter = remove
fc.classifier = cls
evl = Evaluation(data)
evl.crossvalidate_model(classifier=fc, data=data, num_folds=10, rnd=Random(1))
But, how will I save the classifier errors using weka's python3 wrapper?
