Orange Forum • View topic - Specifying probability threshold for classifiers

Specifying probability threshold for classifiers

A place to ask questions about methods in Orange and how they are used and other general support.

Specifying probability threshold for classifiers

Postby bgbg » Thu Aug 19, 2010 12:58

Hello,
when calculating confusion matrices, we can specify a threshold for "positive" prediction:

Code: Select all
cm = orngStat.confusionMatrices(res, classIndex=0, cutoff=0.45)


I would like to do a similar task at the level of classifiers, so I can control the behavior of code like this:

Code: Select all
predictedValue = classifier(example, orange.GetValue)

Postby Ales » Fri Aug 20, 2010 8:56

Wrap your classifier in orngWrap.ThresholdClassifier:
Code: Select all
classifier = orngWraph.ThresholdClassifier(classifier, 0.45)
predictedValue = classifier(example, orange.GetValue)

Postby bgbg » Fri Aug 20, 2010 12:58

Thank you.
is I do this, what will happen in the following code:
Code: Select all
classifier = orngWraph.ThresholdClassifier(classifier, 0.45)
res = orngTest.testOnData(classifier)
cm = orngStat.confusionMatrices(res, classIndex=0)


which threshold will be used here by confusionMatrices()?

Postby Ales » Fri Aug 20, 2010 21:45

In this case 0.45.


Return to Questions & Support