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

sklearn compatible hyperopt_estimator constructor #169

Closed
wants to merge 2 commits into from

Conversation

mgbckr
Copy link

@mgbckr mgbckr commented Mar 15, 2021

Referring to #168, there is an issue with sklearn's get_params method called on HyperoptEstimator since HyperoptEstimator does no adhere to the the constructor guidelines of sklearn. In particular, the constructor (__init__) should copy all constructor arguments to attributes of the same name and not contain any logic.

This pull request fixes this issue by pulling the constructor logic into a new _init method and calling that method only in fit.

@Aaditya-Bhatia
Copy link

Tested on Ubuntu with Anaconda. Works for me, the bug is resolved.
Thanks!

@mandjevant
Copy link
Contributor

Two issues with this:

  1. _init() would run twice if fitting was done twice. Example test case
  2. Initiation logic would be skipped if fit_iter() was called instead of fit(). Example test case

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

Successfully merging this pull request may close these issues.

None yet

3 participants