本文整理汇总了Java中weka.classifiers.Evaluation.incorrect方法的典型用法代码示例。如果您正苦于以下问题:Java Evaluation.incorrect方法的具体用法?Java Evaluation.incorrect怎么用?Java Evaluation.incorrect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.classifiers.Evaluation
的用法示例。
在下文中一共展示了Evaluation.incorrect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: crossValidate
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
/**
* Utility method for fast 5-fold cross validation of a naive bayes
* model
*
* @param fullModel a <code>NaiveBayesUpdateable</code> value
* @param trainingSet an <code>Instances</code> value
* @param r a <code>Random</code> value
* @return a <code>double</code> value
* @exception Exception if an error occurs
*/
public static double crossValidate(NaiveBayesUpdateable fullModel,
Instances trainingSet,
Random r) throws Exception {
// make some copies for fast evaluation of 5-fold xval
Classifier [] copies = AbstractClassifier.makeCopies(fullModel, 5);
Evaluation eval = new Evaluation(trainingSet);
// make some splits
for (int j = 0; j < 5; j++) {
Instances test = trainingSet.testCV(5, j);
// unlearn these test instances
for (int k = 0; k < test.numInstances(); k++) {
test.instance(k).setWeight(-test.instance(k).weight());
((NaiveBayesUpdateable)copies[j]).updateClassifier(test.instance(k));
// reset the weight back to its original value
test.instance(k).setWeight(-test.instance(k).weight());
}
eval.evaluateModel(copies[j], test);
}
return eval.incorrect();
}
示例2: modelErrors
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
/**
*Updates the numIncorrectModel field for all nodes. This is needed for calculating the alpha-values.
*/
public void modelErrors() throws Exception{
Evaluation eval = new Evaluation(m_train);
if (!m_isLeaf) {
m_isLeaf = true;
eval.evaluateModel(this, m_train);
m_isLeaf = false;
m_numIncorrectModel = eval.incorrect();
for (int i = 0; i < m_sons.length; i++) m_sons[i].modelErrors();
} else {
eval.evaluateModel(this, m_train);
m_numIncorrectModel = eval.incorrect();
}
}
示例3: crossValidate
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
/**
* Utility method for fast 5-fold cross validation of a naive bayes
* model
*
* @param fullModel a <code>NaiveBayesUpdateable</code> value
* @param trainingSet an <code>Instances</code> value
* @param r a <code>Random</code> value
* @return a <code>double</code> value
* @exception Exception if an error occurs
*/
public static double crossValidate(NaiveBayesUpdateable fullModel,
Instances trainingSet,
Random r) throws Exception {
// make some copies for fast evaluation of 5-fold xval
Classifier [] copies = Classifier.makeCopies(fullModel, 5);
Evaluation eval = new Evaluation(trainingSet);
// make some splits
for (int j = 0; j < 5; j++) {
Instances test = trainingSet.testCV(5, j);
// unlearn these test instances
for (int k = 0; k < test.numInstances(); k++) {
test.instance(k).setWeight(-test.instance(k).weight());
((NaiveBayesUpdateable)copies[j]).updateClassifier(test.instance(k));
// reset the weight back to its original value
test.instance(k).setWeight(-test.instance(k).weight());
}
eval.evaluateModel(copies[j], test);
}
return eval.incorrect();
}
示例4: modelErrors
import weka.classifiers.Evaluation; //导入方法依赖的package包/类
/**
* Updates the numIncorrectModel field for all nodes when subtree (to be
* pruned) is rooted. This is needed for calculating the alpha-values.
*
* @throws Exception if something goes wrong
*/
public void modelErrors() throws Exception{
Evaluation eval = new Evaluation(m_train);
if (!m_isLeaf) {
m_isLeaf = true; //temporarily make leaf
// calculate distribution for evaluation
eval.evaluateModel(this, m_train);
m_numIncorrectModel = eval.incorrect();
m_isLeaf = false;
for (int i = 0; i < m_Successors.length; i++)
m_Successors[i].modelErrors();
} else {
eval.evaluateModel(this, m_train);
m_numIncorrectModel = eval.incorrect();
}
}