XGBoost predictor in R predicts the same value for all rows [duplicate]
问题 This question already has answers here : xgboost predict method returns the same predicted value for all rows (5 answers) Closed last year . 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 obs. of 13 variables: $ PassengerId: int 1 2 3 4 5 6 7 8 9 10 ... $ Survived : num 0 1 1 1 0 0 0 0 1 1 ... $ Pclass : Factor w/ 3 levels "1","2","3": 3 1 3 1 3 3 1 3 3 2 ... $ Age :