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

MLJTunning #834

Open
refrancesco6 opened this issue Aug 17, 2021 · 2 comments
Open

MLJTunning #834

refrancesco6 opened this issue Aug 17, 2021 · 2 comments

Comments

@refrancesco6
Copy link

Good afternoon,
I like MLJ more and more, thanks to the developers.
I'm still in a learning process, and I had an error with MLJTunning, when I'm working with Random Forest, I do the following for max_depth:
"r5 = range (model, :max_depth, lower = 1, upper = 5)" and I get the following:

ERROR: ArgumentError: The inferred hyper-parameter type is Nothing, which is nominal. If this is true, you must specify values=... If this is false, specify the correct type as first argument of range, as in the example, range(Int, :dummy, lower=1, upper=10).
Stacktrace:

Could you help me with a solution.

Thanks a lot

Hugs

@ablaom
Copy link
Member

ablaom commented Aug 17, 2021

Yes, thanks for reporting, and thanks for the positive feedback.

What is likely happening is that model.max_depth === nothing because this is the default value. (I cannot say for sure without knowing which RandomForest you are using. Is ScikitLearn, DecisionTree or BetaML?) Of course, it can also take integer values.

But range is inferring the type from the current value, and so thinks :max_depth is a nominal hyper-parameter, rather than a numeric one.

There is a work-around suggested in the error message report:

If this is false, specify the correct type as first argument of range, as in the example, range(Int, :dummy, lower=1, upper=10).

That is, instead of model specify the type for the range of values (Int in this case):

r5 = range (Int, :max_depth, lower = 1, upper = 5)

Is that not working for you?

@ablaom
Copy link
Member

ablaom commented Oct 18, 2021

@refrancesco6 Were you able to resolve your problem?

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

2 participants