當前位置: 首頁>>代碼示例>>Java>>正文


Java Evaluation.meanAbsoluteError方法代碼示例

本文整理匯總了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());
}
 
開發者ID:williamClanton,項目名稱:jbossBA,代碼行數:17,代碼來源:WekaApacheEngine.java

示例2: getScore

import weka.classifiers.Evaluation; //導入方法依賴的package包/類
public float getScore(Evaluation eval, Instances testingData){
    return (float)eval.meanAbsoluteError();
}
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:4,代碼來源:ClassifierResult.java

示例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;
 }
 
開發者ID:williamClanton,項目名稱:jbossBA,代碼行數:76,代碼來源:ClassifierSubsetEval.java

示例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();
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:14,代碼來源:LogisticBase.java

示例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();
   }
 
開發者ID:dsibournemouth,項目名稱:autoweka,代碼行數:12,代碼來源:LogisticBase.java


注:本文中的weka.classifiers.Evaluation.meanAbsoluteError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。