public Classification classify (Instance instance)
{
Classification c = underlyingClassifier.classify (instance);
Classification cpc = confidencePredictingClassifier.classify (c);
LabelVector lv = c.getLabelVector();
int bestIndex = lv.getBestIndex();
double [] values = new double[lv.numLocations()];
//// Put score of "correct" into score of the winning class...
// xxx Can't set lv - it's immutable.
// Must create copy and new classification object
// lv.set (bestIndex, cpc.getLabelVector().value("correct"));
//for (int i = 0; i < lv.numLocations(); i++)
// if (i != bestIndex)
// lv.set (i, 0.0);
// Put score of "correct" in winning class and
// set rest to 0
for (int i = 0; i < lv.numLocations(); i++) {
if (i != bestIndex)
values[i] = 0.0;
else values[i] = cpc.getLabelVector().value("correct");
}
//return c;
if(c.bestLabelIsCorrect()){
numCorrectInstances++;
totalCorrect+=cpc.getLabelVector().value("correct");
totalIncorrectCorrect+=cpc.getLabelVector().value("incorrect");
String correct = new String("correct");
if(correct.equals(cpc.getLabelVector().getBestLabel().toString()))
numConfidenceCorrect++;
else numFalseNegative++;
}
else{
numIncorrectInstances++;
totalIncorrect+=cpc.getLabelVector().value("correct");
totalIncorrectIncorrect+=cpc.getLabelVector().value("incorrect");
if((new String("incorrect")).equals(cpc.getLabelVector().getBestLabel().toString()))
numConfidenceCorrect++;
else numFalsePositive++;
}
return new Classification(instance, this, new LabelVector(lv.getLabelAlphabet(), values));
// return cpc;
}