JuliaAI / MLJTuning.jl

Hyperparameter optimization algorithms for use in the MLJ machine learning framework
MIT License
67 stars 12 forks source link

Fix a confusing error when forgetting to instantiate models #157

Closed rikhuijzer closed 2 years ago

rikhuijzer commented 2 years ago

There was a mistake in the logic which caused unknown models to be considered as Probabilistic.

Before

julia> TunedModel(; models=[LinearModel, TreeModel])
MethodError: Cannot `convert` an object of type Type{MLJLinearModels.LinearRegressor} to an object of type MLJModelInterface.Probabilistic
[...]

After

julia>     TunedModel(models=[LinearModel, TreeModel])
ERROR: ArgumentError: Only `Deterministic` and `Probabilistic` model types supported.
[...]
codecov-commenter commented 2 years ago

Codecov Report

Merging #157 (3585ca1) into dev (ccbcfbf) will increase coverage by 0.06%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #157      +/-   ##
==========================================
+ Coverage   87.60%   87.66%   +0.06%     
==========================================
  Files          11       11              
  Lines         613      616       +3     
==========================================
+ Hits          537      540       +3     
  Misses         76       76              
Impacted Files Coverage Δ
src/tuned_models.jl 93.04% <100.00%> (+0.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ccbcfbf...3585ca1. Read the comment docs.