Skip to content

Fail explicitly on multilabel/multiouput targets #543

Closed
@chkoar

Description

@chkoar

I believe that we should be more explicit about the multioutput/multilabel format. The first error is helpful from a developers' point of view. The second error makes no sense to a user. So, since we know the target type of the provided dataset we should fail with an explicit message.

from imblearn.under_sampling import RandomUnderSampler
from imblearn.ensemble import BalancedBaggingClassifier, BalancedRandomForestClassifier
from sklearn.datasets import make_multilabel_classification

X, y = make_multilabel_classification()

ros = RandomUnderSampler()
ros.fit_sample(X,y)

ValueError: When 'y' corresponds to 'multilabel-indicator', 'y' should encode th
e multiclass (a single 1 by row).

bagging = BalancedBaggingClassifier()
bagging.fit(X,y)

ValueError: bad input shape (100, 5)

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