compute_class_weight
- sklearn.utils.class_weight.compute_class_weight(class_weight, *, classes, y, sample_weight=None)
Estimate class weights for unbalanced datasets.
- Parameters:
- class_weight : dict, “balanced” or None
If “balanced”, class weights will be given by
or their weighted equivalent if is provided. If a dictionary is given, keys are classes and values are corresponding class weights. If is given, the class weights will be uniform.