Pergunta

I'm facing a problem with unbalanced classes, and have tried out a couple of methods like over and under sampling. However, my cross validation mean comes out to be only 0.4 and my confusion matrix shows that the prediction and recall is completely incorrect.

Ive read that the next step is to add weights to my class; I have two of them "Won" and "Lost". In Pandas, how am I supposed to assign weights to them? I know that there is a "class_weights" attribute, but I have no clue on how to use it.

Thanks

enter image description here

PS. My "Won" class is unbalanced, very small compared to the "Lost" one. I train by repeating the set of "Won"s twice and randomly sample an almost equal amount of "Lost"s. I've tried all sorts of combinations of the classes.

Foi útil?

Solução

Maybe try to encode your target values as binary. Then, this class_weight={0:1,1:2} should do the job. Now, class 0 has weight 1 and class 1 has weight 2.

Licenciado em: CC-BY-SA com atribuição
scroll top