2
$\begingroup$

I have a highly imbalanced binary classification problem, probably 95:5 for two classes. I don't want to perform resampling as the data is already huge and training it would just take more time. (I'm also aware of down sampling)

But my question is , is providing class weights (let's say computed by scikit-learn's compute class weight) enough? or there is any other method ?

model.fit(X,y,class_weight=class_weight) 
$\endgroup$
1
$\begingroup$

Referring to an answer to a similar question, you don't have any reason to handle unbalance from the beginning. An imbalance of 95:5 isn't that big, I'd start with the regular training and if that doesn't work try more sophisticated things.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Interesting, so does that mean models can learn the imbalance nature by themselves? and also can you link to a good read for the sophisticated things? $\endgroup$ – skrrrt Jul 21 at 14:35
  • 1
    $\begingroup$ To me the sophisticated things are mainly downsampling and class weights (not very sophisticated right? they are at least less simple than plain training). I think there's a lot of confusion with imbalance in introductory DS blogs. Unless you're imbalance is very extreme ( < 1%) I don't think there's any reason to do any special thing as long as you are using cross-entropy loss. Not in my experience, not in any Kaggle competition I've seen $\endgroup$ – David Masip Jul 21 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.