情景:
找出wake分类后预测错误的实例。
包:
自然是weka.jar,它存在于weka的安装目录下。
细节:
见weka.jar的javadoc。
代码:
package com.weka.test;
import java.io.File;
import java.io.IOException;
import weka.core.Attribute;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.converters.ArffLoader;
import weka.core.converters.ArffSaver;
import weka.core.converters.Saver;
public class Test {
public static void filter(String loadPath, String savePath) throws IOException {
ArffLoader loader = new ArffLoader();
loader.setFile(new File(loadPath));
Instances structure = loader.getStructure();
Attribute attrClass = structure.attribute("class");
Attribute attrPredictedclass = structure.attribute("predictedclass");
ArffSaver saver = new ArffSaver();
saver.setFile(new File(savePath));
saver.setRetrieval(Saver.INCREMENTAL);
saver

这篇博客主要介绍了如何利用Weka库进行ARFF文件的读取和保存,特别是在数据分析和分类任务中,如何查找并分析分类错误的实例。
最低0.47元/天 解锁文章
5468

被折叠的 条评论
为什么被折叠?



