当前位置: 首页>>代码示例>>Java>>正文


Java Evaluation.pctIncorrect方法代码示例

本文整理汇总了Java中weka.classifiers.Evaluation.pctIncorrect方法的典型用法代码示例。如果您正苦于以下问题:Java Evaluation.pctIncorrect方法的具体用法?Java Evaluation.pctIncorrect怎么用?Java Evaluation.pctIncorrect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weka.classifiers.Evaluation的用法示例。


在下文中一共展示了Evaluation.pctIncorrect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getErrorPercent

import weka.classifiers.Evaluation; //导入方法依赖的package包/类
@Override
public double getErrorPercent() {
    this.splitInstances();

    try {
        this.getClassifier().buildClassifier(getTrainInstances());

        Evaluation eval = new Evaluation(getTestInstances());
        eval.evaluateModel(getClassifier(), getTestInstances());

        return eval.pctIncorrect();

    } catch (Exception e) {
        e.printStackTrace();
        return -1;
    }
}
 
开发者ID:garciparedes,项目名称:java-examples,代码行数:18,代码来源:AbstractSplitEstimator.java

示例2: getCrossValidation

import weka.classifiers.Evaluation; //导入方法依赖的package包/类
/**
 * @param cls
 * @param data
 * @param folds
 * @return [0] = pctCorrect, [1] = pctIncorrect
 * @throws Exception
 */
public double[] getCrossValidation(Classifier cls, Instances data, int folds) throws Exception {

	cls.buildClassifier(data);

	Classifier copy = Classifier.makeCopy(cls);
	double[] results = new double[2];
	for (int n = 0; n < folds; n++) {
		Instances train = data.trainCV(folds, n);
		Instances test = data.testCV(folds, n);

		// CSVSaver saver = new CSVSaver();
		// saver.setInstances(train);
		// saver.setFile(new File("../data.csv"));
		// saver.writeBatch();

		cls.buildClassifier(train);
		Evaluation eval = new Evaluation(data);
		eval.evaluateModel(cls, test);
		results[0] = results[0] + (eval.pctCorrect() / 100);
		results[1] = results[1] + (eval.pctIncorrect() / 100);
	}

	cls = copy;
	results[0] = results[0] / folds;
	results[1] = results[1] / folds;
	return results;
}
 
开发者ID:gsi-upm,项目名称:BARMAS,代码行数:35,代码来源:ClassifiersValidation.java

示例3: getErrorPercent

import weka.classifiers.Evaluation; //导入方法依赖的package包/类
@Override
public double getErrorPercent() {
    try {
        Evaluation eval = new Evaluation(getInstances());

        eval.crossValidateModel(getClassifier(), getInstances(),
                getFolds(), new Random()
        );

        return eval.pctIncorrect();
    } catch (Exception e) {
        e.printStackTrace();
        return 100;
    }
}
 
开发者ID:garciparedes,项目名称:java-examples,代码行数:16,代码来源:CrossValidation.java

示例4: getValidation

import weka.classifiers.Evaluation; //导入方法依赖的package包/类
/**
 * @param cls
 * @param trainingData
 * @param testData
 * @return [0] = pctCorrect, [1] = pctIncorrect
 * @throws Exception
 */
public double[] getValidation(Classifier cls, Instances trainingData, Instances testData)
		throws Exception {

	cls.buildClassifier(trainingData);

	Evaluation eval = new Evaluation(trainingData);
	eval.evaluateModel(cls, testData);

	double[] results = new double[2];
	results[0] = eval.pctCorrect() / 100;
	results[1] = eval.pctIncorrect() / 100;
	return results;
}
 
开发者ID:gsi-upm,项目名称:BARMAS,代码行数:21,代码来源:ClassifiersValidation.java


注:本文中的weka.classifiers.Evaluation.pctIncorrect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。