本文整理匯總了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();
}
}