Skip to content Skip to sidebar Skip to footer

Xgboost Predictor In R Predicts The Same Value For All Rows

I looked into the the post on the same thing in Python, but I want a solution in R. I'm working on the Titanic dataset from Kaggle, and it looks like this: 'data.frame': 891

Solution 1:

You must remove the Survived variable in your test set in order to use xgboost, since this is the variable you want to predict.

trmat = data.matrix(train[, colnames(train) != "Survived"])

It should solve your problem.

Solution 2:

I may be late to answer, I have faced the same problem when I first used xgboost. Removing the "Survived" column from train set should solve your problem. If we have the column in train set which we use for label in xgboost then the algorithm ends up predicting all probabilities to be same.

Post a Comment for "Xgboost Predictor In R Predicts The Same Value For All Rows"