1

Is possible to decide which class in xgboost.XGBClassifier() willl be taken as the positive one ?

Sara
  • 43
  • 1
  • 4
  • Hi Sara, welcome to stack overflow. May you share your code ? what you've done so far and how's your data look like ? especially you target variable – A DUBEY Jul 30 '21 at 13:09
  • If you are asking this because you want to set `scale_pos_weight`, you might want to see this https://stackoverflow.com/questions/65304302/how-can-i-know-which-is-the-positive-class-value-and-negative-class-value-for-xg – Ibrahim Berber Jul 30 '21 at 13:28
  • Hi! I saw it but I really just want to decide which class is positive and negative. – Sara Jul 30 '21 at 13:38
  • I think it is considering label `0` as negative class and label `1` as positive. But you said _It is taking the class 0 as positive_, how did you find out? – Ibrahim Berber Jul 30 '21 at 14:35
  • Hi! Thanks everybody for the help. Actually it was taking the class 1 as positive after a further check. Anyway, I was quite surprised to not have found the option to set the desire value as positive. – Sara Jul 30 '21 at 16:51
  • There are some options if you want to manually modify your data such that all 0 labels become 1 and vice versa. You can do that with `y.replace({1:0, 0:1})`, or using label encoder. Hence you can trick XGBClassifier. – Ibrahim Berber Jul 30 '21 at 17:03

0 Answers0