1
$\begingroup$

I am doing this challenge on Kaggle and I am trying to use AdaBoost from scikit-learn.

My code is like this:

from sklearn.ensemble import AdaBoostClassifier
ada=AdaBoostClassifier(n_estimators=50,random_state=0,learning_rate=0.01)
prediction = ada.fit(train_input, train_labels).predict(test_input)

Here, train_input, and test_input are of the form:

   Pclass  Sex  Age_band  Family_Size  Fare_cat
0       3    0         2            0         0
1       3    1         2            1         0
2       2    0         3            0         1
3       3    0         1            0         1
4       3    1         1            2         1

while train_labels and test_labels are of the form:

0    0
1    1
2    1
3    1

For some reason, with this model the accuracy is 1:

labels=test_labels.iloc[:, 1].values
print('The accuracy is',metrics.accuracy_score(prediction, labels))

However, when I submit the predictions, the accuracy is only around 0.77.

Any idea why the accuracy on my test data is 1? Am I not using AdaBoostClassifier correctly and it's overfitting?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.