当前位置: 首页>>代码示例>>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;未经允许,请勿转载。