Evovest/EvoTrees.jl

MethodError when using EvoTreeClassifier with MLJTuningTreeParzen

svilupp opened this issue · 3 comments

Behavior: When running the MLJ tuning example with EvoTreeClassifier, tuning fails due to a MethodError that ‘ EvoTreeClassifier{Softmax,Float32}(;…)’ doesn’t exist.

Root cause: I believe the issue comes from this line, which new hyperparams to a kwarg constructor extracted as ‘typeof(model)(; new_params…)’

Unfortunately, that requires a constructor ‘ EvoTreeClassifier{Softmax,Float32}(;…)’, but we have only the generic one defined.

It can be solved by adding new kwarg constructors for more specific parametric types (eg, with ‘where {L,T}’).

Impact: I believe this impacts all Evo models when used with MLJTuningTreeParzen.

Proposal: I’m out until next week, but I’m happy to open the PR when I’m back.

For completeness, this happens on the latest version of EvoTrees. Julia 1.8.5., arm-based.

Thanks for reporting this. If you can open the PR, that would be welcomed!

I think the indicated line in TreeParzen.jl is quite brittle. I can imaging it failing for other MLJ models that don't have parameter-type-specific constructors (probably every model with type parameters).

I'll open an issue at TreeParzen.jl. Unfortunately, this pkg has only sporadic maintenance. So you might want to go ahead with the local fix, which sounds innocuous enough, although a PR at TreeParzen would have better luck there than no PR.

@svilupp Thanks for reporting, by the way.