Class_weight For Imbalanced Data - Keras
I am trying to perform binary classification with a highly imbalanced dataset. My target values are 0(84%) and 1 (16%). I used class_weight in my model but the precision and recall
Solution 1:
Don't have enough reputation to add a comment. Hence writing as an answer.
You say your class imbalance is 84:16 (5:1 approx) but you are sending your Class 2 50 times as Class 1. Try some value between 5-10
Solution 2:
As far as I can tell you are using it correctly. I'm not sure however about the imbalance ratio on your dataset. If you want, scikit-learn has a function that computes this for you.
That being said, I personally prefer over/under-sampling to class weights. The algorithm I have had most success with is called SMOTE. You should definitely try this out.
Post a Comment for "Class_weight For Imbalanced Data - Keras"