本文整理汇总了Java中weka.classifiers.Evaluation.areaUnderROC方法的典型用法代码示例。如果您正苦于以下问题:Java Evaluation.areaUnderROC方法的具体用法?Java Evaluation.areaUnderROC怎么用?Java Evaluation.areaUnderROC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.classifiers.Evaluation
的用法示例。
在下文中一共展示了Evaluation.areaUnderROC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMetricScore
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
public double getMetricScore(Evaluation eval, PerformanceMetric metric) {
if (metric.getName().equals("accuracy")) {
return eval.pctCorrect();
} else if (metric.getName().equals("auc")) {
return eval.areaUnderROC(0);
} else if (metric.getName().equals("rmse")) {
return eval.rootMeanSquaredError();
} else if (metric.getName().equals("mae")) {
return eval.meanAbsoluteError();
} else if (metric.getName().equals("logLoss")) {
return eval.SFMeanSchemeEntropy();
} else if (metric.getName().equals("rmsle")) {
return eval.rootMeanSquaredLogError();
}
throw new RuntimeException(this.getClass().getName() + "impl me please: " + metric.getName());
}
示例2: evaluate
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
public static double[] evaluate(Classifier model) throws Exception {
double results[] = new double[4];
String[] labelFiles = new String[] { "churn", "appetency", "upselling" };
double overallScore = 0.0;
for (int i = 0; i < labelFiles.length; i++) {
// Load data
Instances train_data = loadData("data/orange_small_train.data",
"data/orange_small_train_" + labelFiles[i]+ ".labels.txt");
train_data = preProcessData(train_data);
// cross-validate the data
Evaluation eval = new Evaluation(train_data);
eval.crossValidateModel(model, train_data, 5, new Random(1), new Object[] {});
// Save results
results[i] = eval.areaUnderROC(train_data.classAttribute()
.indexOfValue("1"));
overallScore += results[i];
System.out.println(labelFiles[i] + "\t-->\t" +results[i]);
}
// Get average results over all three problems
results[3] = overallScore / 3;
return results;
}
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:29,代码来源:KddCup.java
示例3: computeSingleRunResults
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
public void computeSingleRunResults(MethodEvaluation methodEvaluation)
{
Evaluation evaluation = methodEvaluation.getEvaluation();
int hamIndex = HAM.ordinal();
int spamIndex = SPAM.ordinal();
Double hamPrecision = 100.0 * evaluation.precision(hamIndex);
Double spamPrecision = 100.0 * evaluation.precision(spamIndex);
Double weightedPrecision = 100.0 * evaluation.weightedPrecision();
Double hamRecall = 100.0 * evaluation.recall(hamIndex);
Double spamRecall = 100.0 * evaluation.recall(spamIndex);
Double weightedRecall = 100.0 * evaluation.weightedRecall();
Double hamAreaUnderPRC = 100.0 * evaluation.areaUnderPRC(hamIndex);
Double spamAreaUnderPRC = 100.0 * evaluation.areaUnderPRC(spamIndex);
Double weightedAreaUnderPRC = 100.0 * evaluation.weightedAreaUnderPRC();
Double hamAreaUnderROC = 100.0 * evaluation.areaUnderROC(hamIndex);
Double spamAreaUnderROC = 100.0 * evaluation.areaUnderROC(spamIndex);
Double weightedAreaUnderROC = 100.0 * evaluation.weightedAreaUnderROC();
Double hamFMeasure = 100.0 * evaluation.fMeasure(hamIndex);
Double spamFMeasure = 100.0 * evaluation.fMeasure(spamIndex);
Double weightedFMeasure = 100.0 * evaluation.weightedFMeasure();
Double trainTime = (double) (methodEvaluation.getTrainEnd() - methodEvaluation.getTrainStart());
Double testTime = (double) (methodEvaluation.getTestEnd() - methodEvaluation.getTestStart());
addSingleRunResult(Metric.HAM_PRECISION, hamPrecision);
addSingleRunResult(Metric.SPAM_PRECISION, spamPrecision);
addSingleRunResult(Metric.WEIGHTED_PRECISION, weightedPrecision);
addSingleRunResult(Metric.HAM_RECALL, hamRecall);
addSingleRunResult(Metric.SPAM_RECALL, spamRecall);
addSingleRunResult(Metric.WEIGHTED_RECALL, weightedRecall);
addSingleRunResult(Metric.HAM_AREA_UNDER_PRC, hamAreaUnderPRC);
addSingleRunResult(Metric.SPAM_AREA_UNDER_PRC, spamAreaUnderPRC);
addSingleRunResult(Metric.WEIGHTED_AREA_UNDER_PRC, weightedAreaUnderPRC);
addSingleRunResult(Metric.HAM_AREA_UNDER_ROC, hamAreaUnderROC);
addSingleRunResult(Metric.SPAM_AREA_UNDER_ROC, spamAreaUnderROC);
addSingleRunResult(Metric.WEIGHTED_AREA_UNDER_ROC, weightedAreaUnderROC);
addSingleRunResult(Metric.HAM_F_MEASURE, hamFMeasure);
addSingleRunResult(Metric.SPAM_F_MEASURE, spamFMeasure);
addSingleRunResult(Metric.WEIGHTED_F_MEASURE, weightedFMeasure);
addSingleRunResult(Metric.TRAIN_TIME, trainTime);
addSingleRunResult(Metric.TEST_TIME, testTime);
}
示例4: getScore
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
public float getScore(Evaluation eval, Instances testingData) {
return (float)(1.0 - eval.areaUnderROC(testingData.classIndex()));
}