Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for MultiOutputClassifier #337

Closed
martianescape opened this issue Aug 29, 2017 · 5 comments
Closed

Support for MultiOutputClassifier #337

martianescape opened this issue Aug 29, 2017 · 5 comments

Comments

@martianescape
Copy link

martianescape commented Aug 29, 2017

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.

@chkoar
Copy link
Member

chkoar commented Aug 29, 2017

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
Copy link
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
Copy link

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

@glemaitre
Copy link
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
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants