Thanks to visit codestin.com
Credit goes to github.com

Skip to content

error in error message in compute_class_weight #8312

Closed
@MMeketon

Description

@MMeketon

In the file class_weight.py, in the function compute_class_weight, is the piece of code:

for c in class_weight:
            i = np.searchsorted(classes, c)
            if i >= len(classes) or classes[i] != c:
                raise ValueError("Class label %d not present." % c)
            else:
                weight[i] = class_weight[c]

The line "Class label %d not present." % c fails if the class label is a string, not an integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions