我想知道如何在JAVA中实现IncrementalClassifierEvaluation和ClassifierPerformanceEvaluation,因为普通的Evaluation不适用于增量分类器(即时通讯使用NaiveBayesUpdateable)
我已经尝试过对代码进行交叉验证和火车测试拆分评估,但没有效果
ArffLoader loader = new ArffLoader();
loader.setFile(new File("C:\\Users\\talah\\Downloads\\abitrain2.arff"));
Instances data = loader.getStructure();
data.setClassIndex(data.numAttributes()-1);;
IncrementalClassifierEvaluator eval = new IncrementalClassifierEvaluator();
IncrementalClassifierEvent e = new IncrementalClassifierEvent(data);
int i = 0;
NaiveBayesUpdateable nb = new NaiveBayesUpdateable();
nb.buildClassifier(data);
Instance current;
while ((current = loader.getNextInstance(data)) != null) {
nb.updateClassifier(current);
e.setCurrentInstance(current);
}
e.setClassifier(nb);
e.setStructure(data);
e.setStructure(data);
eval.acceptClassifier(e);
System.out.println(eval);