當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。