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

Invalid value of min_samples_leaf on decision tree #166

Open
jwarley opened this issue Dec 17, 2020 · 1 comment
Open

Invalid value of min_samples_leaf on decision tree #166

jwarley opened this issue Dec 17, 2020 · 1 comment

Comments

@jwarley
Copy link

jwarley commented Dec 17, 2020

Trying to train a decision tree

from hpsklearn import HyperoptEstimator, decision_tree
[...load data....]
estim = HyperoptEstimator(classifier=decision_tree('dt'))
estim.fit(X, y)

yields the following exception:

ERROR:hyperopt.fmin:job exception: min_samples_leaf must be at least 1 or in (0, 0.5], got 4.0

Since a float value of min_samples_leaf is interpreted as a percentage, this seems like possibly a failure to cast to int somewhere in the hpsklearn code.

@jwarley
Copy link
Author

jwarley commented Dec 17, 2020

Okay, this is related to hyperopt/hyperopt#508

I'm currently fixing this in my local copy by replacing these lines by:

    min_samples_split=scope.int(hp.uniformint(
        _name('min_samples_split'),
        2, 10)) if min_samples_split is None else min_samples_split,
    min_samples_leaf=scope.int(hp.uniformint(
        _name('min_samples_leaf'),
        1, 5)) if min_samples_leaf is None else min_samples_leaf,

I can submit a PR if that seems like an acceptable solution.

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

1 participant