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(
DecisionTreeClassifier(max_depth=4,
criterion="entropy",
splitter="random",
min_samples_split = 2),
n_estimators=100,
learning_rate=0.1
)
#fitting:
model.fit(Xtrain,Ytrain)
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: