I have to use an Adaboost classifier to predict if the data is a signal (1) or a background (0) event. But since the output is expected to be 1 or 0 the model.predict(X) function gives only 1 or 0 as output. Nevertheless, to further examine the prediction result, we have to use a function which creates a cut-off value for the prediction. Since there are only two possible prediction states, this cut-off value does not make any sense (it simply has to be >0 two separate between signal and background.

Now, is there a way that I can receive an output between 0 and 1?

I tried to use model.decision_function(X), but there the output is between -5 and 1 (and if needed: the ROC-curve looks really good, so it seems as the model works fine).
In the following, I show my implementation, so you know what I do:

from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier

model = AdaBoostClassifier(
                                min_samples_split = 2),
model.predict(Xtest) #creates 0 and 1 output

model.decision_function(Xtest) #creates unusable range between -5 and 1

An example histogram of the output of the decision function: enter image description here


1 Answer 1


In sklearn you have predic_proba(X) function, which should give you the probability i.e output between 0-1

In ada_boost, this will be the weighted average of the probabilities of the classifiers in the ensemble.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.