Imbalanced classification with xgboost in python with scale_pos_weight not working properly
Your question seems sketchy: what is y_pred?
+Remember you are better to run a grid search or Bayesian optimizer to figure out the best scores.
I am using xgboost with python in order to perform a binary classification in which the class 0 appears roughly 9 times more frequently than the class 1. I am of course using scale_pos_weight=9. However, when I perform the prediction on the testing data after training the model using train_test_split, I obtain a y_pred with twice the elements belonging to the class 1 than it should (20% instead of 10%). How can I correct this output? I thought the scale_pos_weight=9 would be enough to inform the model the expected proportion.