Skip to content

Support for MultiOutputClassifier #337

Closed
@martianescape

Description

@martianescape

I am trying to use SMOTE along with Randomforest multiOutputClassifier.

Here is how I am using it,

forest = RandomForestClassifier(n_estimators= n_estimator, random_state=1)
multi_target_forest = MultiOutputClassifier(forest, n_jobs=-1)
sampler = SMOTE()
clf = make_pipeline(sampler, multi_target_forest)
model = clf.fit(vecs, vec_labels)

Is there a support for multOutputClassifier? Is this the correct way to use it?

I am encountering the value error in vec_labels.
length of vecs is 1631, vec_labels is [1631][241].
Please help.

Activity

chkoar

chkoar commented on Aug 29, 2017

@chkoar
Member

I think that scikit-learn's RandomForestClassifier supports multi-output problems out of the box.
Anyway, assuming that you import the make_pipeline from the imbalanced-learn package, could you try the snippet below?

forest = RandomForestClassifier(n_estimators=n_estimator, random_state=1)
sampler = SMOTE(random_state=2)
pipeline = make_pipeline(sampler, forest)
multi_target_forest = MultiOutputClassifier(pipeline, n_jobs=-1)
model = multi_target_forest.fit(vecs, vec_labels)
glemaitre

glemaitre commented on Aug 29, 2017

@glemaitre
Member

If the method of @chkoar (which should work) does not work, I don't think we should support mutli-target. In some way, the bottleneck will be for theoretical reason since the algorithms were not designed to work for multi-targets.

@chkoar WDYT?

aqibsaeed

aqibsaeed commented on Sep 3, 2017

@aqibsaeed

I also think this would be a very nice addition to support multi-class oversampling out of the box with imbalanced-learn.

glemaitre

glemaitre commented on Sep 3, 2017

@glemaitre
Member

I also think this would be a very nice addition to support multi-class oversampling out of the box with imbalanced-learn.

It is already supported.

glemaitre

glemaitre commented on Sep 5, 2017

@glemaitre
Member

Closed if favor of #340 regarding support of multilabel/multiclass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @aqibsaeed@glemaitre@chkoar@martianescape

        Issue actions

          Support for MultiOutputClassifier · Issue #337 · scikit-learn-contrib/imbalanced-learn