-
Notifications
You must be signed in to change notification settings - Fork 84
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
[MRG] Attempt to make GLM
compatible with scikit-learn check_estimator
#364
Conversation
how are you testing? can you add the |
@jasmainak I did add a test script where you can check by running |
Cool, FYI, I use this command: $ pytest ./tests/test_pyglmnet.py::test_glm_estimator --pdb that way you drop right into the console when there is an error :) |
For whatever reason |
@jasmainak Thanks for the handy test script. Oh yeah, I see that: |
I don't think it's easy to make all the checks happy without adding an sklearn dependency. Basically you have to follow what is in: https://github.com/scikit-learn-contrib/project-template/blob/master/skltemplate/_template.py. I'd like to believe it can be done though :) |
@jasmainak alright, I tried adding sklearn dependency so that it follows their template style. Not sure if we also want |
Let's try to first make it work. Use sklearn or whatever is necessary. Then we can make it nice and see if the dependency can be dropped easily :) |
@jasmainak Now the error is in |
@jasmainak alright the current commits should work with |
You can remove the refit logic for now. Do all tests pass if you do that?
I’ll see what to do with the refit when I get a chance in a couple of hours
On Tue 18 Feb 2020 at 14:05, Titipat Achakulvisut ***@***.***> wrote:
@jasmainak <https://github.com/jasmainak> alright the current commits
should work with check_estimator now!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#364?email_source=notifications&email_token=ADY6FIX2I4DDDKREO2XCPL3RDQWODA5CNFSM4KXIRITKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMDSOHQ#issuecomment-587671326>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADY6FIRQK7MBYVQKRN4QW3TRDQWODANCNFSM4KXIRITA>
.
--
Sent from my iPhone
|
@jasmainak There are 2 failed ( |
The test is now not raising errors because of the additional with pytest.raises(ValueError):
glm.fit(X, list(y)) And the fail in match = "This glm object has already been fit"
with pytest.raises(ValueError, match=match):
ypred_c = glm_b.fit_predict(Xtrain, ytrain) |
Alright @jasmainak, I think this should be the push using sklearn dependency. If you can help a bit with |
This is great!! awesome work @titipata :-) Happy to take over from here. Can you update |
@titipata you are on fire. I don't think I need to do a pass really. If you just address my last couple of comments (remove the commented test), move the line in |
pyglmnet/pyglmnet.py
Outdated
@@ -530,7 +534,7 @@ class GLM(BaseEstimator): | |||
https://core.ac.uk/download/files/153/6287975.pdf | |||
""" | |||
|
|||
def __init__(self, distr='poisson', alpha=0.5, | |||
def __init__(self, distr='binomial', alpha=0.5, |
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.
oops, the default value changed here.
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.
Yes, somehow it fails sklearn with check_estimator
due to predict_proba
. I didn't resolve it here.
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.
humm ... I see. Let's bring it back to the default and see if we can fix it? Is that the only thing left that didn't work?
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.
Yes, will do bring it back to the default!
Awesome!! That sounds great to me! We might have to write some more test scripts later on :) |
Yes I am looking forward to more contributions from you in the future! |
@jasmainak, so I added the workaround for |
Good to go from your end @titipata ? Everything resolved and works? Please set the PR title to MRG if so! |
@jasmainak yes, I guess you can help polish a bit and that should be good to go! |
GLM
compatible with scikit-learn check_estimator
GLM
compatible with scikit-learn check_estimator
6286666
to
44e0658
Compare
I'll merge @titipata when the CIs are green. We're good to go! |
Perfect 👍 @jasmainak. We can also poke JOSS editor right after. This PR should take care their concerns! |
yep that's the plan! :) |
All good, thanks a ton @titipata ! |
So far, there are 3 main parts which can be fixed in
GLM
class to be compatible with scikit-learn'scheck_estimator
fit_predict
functionexpit
closes #363