How to handle imbalanced classes

Thanks for the example, super helpful! Here’s some syntactic sugar (or how you’d wanna call it):

Suggestion:

class_sample_count = np.unique(target, return_counts=True)[1]

Suggestion:

samples_weight = weight[target]

Casting to double is not needed anymore, and probably wasn’t three months ago considering the typo.

3 Likes