-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Add stacking-meta-model #6674
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
Add stacking-meta-model #6674
Conversation
A wrapper allowing to combine models in a two stage stacking model.
PR to #4816 |
Please add tests! |
sklearn/ensemble/stacking_model.py
Outdated
|
||
return y_out | ||
|
||
def run_gridsearch(self,X,y,params): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this meant to do...? it doesn't look quite right for scikit-learn's API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may not be perfect yet, but it's able to use for example the cross_val_score function with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This evaluates the model on test data.
Please adhere to PEP8. Using |
# libraries | ||
import numpy as np | ||
|
||
# scikit-learn base libraries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove these comments
From the definition of the StackingClassifier here (http://machine-learning.martinsewell.com/ensembles/stacking/), I can understand the use case, but you should be applying a
Also we should rename |
|
||
# fit the second stage models | ||
for clf in self.stage_two_clfs: | ||
clf.fit(self.__X,self.__y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be just clf.fit(y_pred, y)
? according to this http://machine-learning.martinsewell.com/ensembles/stacking/
@tsterbak Thanks for the effort! Please do consider adding a bit of documentation, tests and PEP8 compliant. |
@MechCoder Thanks for your comments!! I will change the code asap. |
@MechCoder about the API: More suggestions are welcome! :) |
All right, I can have a closer look after the code is cleaned up. |
@MechCoder Hi, is there anyone working on it currently? If not, I want to do a PR |
Is anybody planning to work on this? Otherwise I would be happy to look into it. |
ping @jnothman |
Sure, please go ahead. There were some questions with regards to the API, but those can be discussed during the course of the pull request. |
I would like to participate in this project. In fact, I almost win the BNP competition (22nd place) with my own implementation, which I would like to adapt to sklearn... If possible, I would like to work into it!! |
@ivallesp I'm currently working on a stacking (aka Super Learner) implementation too - would you like to collaborate? |
@JivanRoquet I have already had a PR #7427 to stacking classifier, now just waiting for #7674 merged after which I can use the new _BaseComposition class. If you have any suggestions please let me know. |
@yl565 awesome, thanks! I can see you provided a My work is related to a |
@JivanRoquet Sure! I would love to colaborate on this. |
A wrapper allowing to combine models in a two stage stacking model.
This change is