I have a dataset where the classes are unbalanced. The classes are either \'1\' or \'0\' where the ratio of class \'1\':\'0\' is 5:1. How do you calculate the prediction e
If the majority class is 1, and the minority class is 0, and they are in the ratio 5:1, the sample_weight
array should be:
sample_weight = np.array([5 if i == 1 else 1 for i in y])
Note that you do not invert the ratios.This also applies to class_weights
. The larger number is associated with the majority class.