本文整理匯總了Java中weka.classifiers.Evaluation.meanAbsoluteError方法的典型用法代碼示例。如果您正苦於以下問題:Java Evaluation.meanAbsoluteError方法的具體用法?Java Evaluation.meanAbsoluteError怎麽用?Java Evaluation.meanAbsoluteError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類weka.classifiers.Evaluation
的用法示例。
在下文中一共展示了Evaluation.meanAbsoluteError方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getScore
import weka.classifiers.Evaluation; //導入方法依賴的package包/類
public float getScore(Evaluation eval, Instances testingData){
return (float)eval.meanAbsoluteError();
}
示例3: evaluateSubset
import weka.classifiers.Evaluation; //導入方法依賴的package包/類
/**
* Evaluates a subset of attributes
*
* @param subset a bitset representing the attribute subset to be
* evaluated
* @return the error rate
* @throws Exception if the subset could not be evaluated
*/
public double evaluateSubset (BitSet subset)
throws Exception {
int i,j;
double errorRate = 0;
int numAttributes = 0;
Instances trainCopy=null;
Instances testCopy=null;
Remove delTransform = new Remove();
delTransform.setInvertSelection(true);
// copy the training instances
trainCopy = new Instances(m_trainingInstances);
if (!m_useTraining) {
if (m_holdOutInstances == null) {
throw new Exception("Must specify a set of hold out/test instances "
+"with -H");
}
// copy the test instances
testCopy = new Instances(m_holdOutInstances);
}
// count attributes set in the BitSet
for (i = 0; i < m_numAttribs; i++) {
if (subset.get(i)) {
numAttributes++;
}
}
// set up an array of attribute indexes for the filter (+1 for the class)
int[] featArray = new int[numAttributes + 1];
for (i = 0, j = 0; i < m_numAttribs; i++) {
if (subset.get(i)) {
featArray[j++] = i;
}
}
featArray[j] = m_classIndex;
delTransform.setAttributeIndicesArray(featArray);
delTransform.setInputFormat(trainCopy);
trainCopy = Filter.useFilter(trainCopy, delTransform);
if (!m_useTraining) {
testCopy = Filter.useFilter(testCopy, delTransform);
}
// build the classifier
m_Classifier.buildClassifier(trainCopy);
m_Evaluation = new Evaluation(trainCopy);
if (!m_useTraining) {
m_Evaluation.evaluateModel(m_Classifier, testCopy);
} else {
m_Evaluation.evaluateModel(m_Classifier, trainCopy);
}
if (m_trainingInstances.classAttribute().isNominal()) {
errorRate = m_Evaluation.errorRate();
} else {
errorRate = m_Evaluation.meanAbsoluteError();
}
m_Evaluation = null;
// return the negative of the error rate as search methods need to
// maximize something
return -errorRate;
}
示例4: getMeanAbsoluteError
import weka.classifiers.Evaluation; //導入方法依賴的package包/類
/**
* Returns the error of the probability estimates for the current model on a
* set of instances.
*
* @param data the set of instances
* @return the error
* @throws Exception if something goes wrong
*/
protected double getMeanAbsoluteError(Instances data) throws Exception {
Evaluation eval = new Evaluation(data);
eval.evaluateModel(this, data);
return eval.meanAbsoluteError();
}
示例5: getMeanAbsoluteError
import weka.classifiers.Evaluation; //導入方法依賴的package包/類
/**
* Returns the error of the probability estimates for the current model on a set of instances.
* @param data the set of instances
* @return the error
* @throws Exception if something goes wrong
*/
protected double getMeanAbsoluteError(Instances data) throws Exception {
Evaluation eval = new Evaluation(data);
eval.evaluateModel(this,data);
return eval.meanAbsoluteError();
}