JuliaAI / MLJTuning.jl

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

Improve the `Explicit` strategy #142

Closed ablaom closed 3 years ago

ablaom commented 3 years ago

Addresses #141

The main change are:

Makes use of very recent change in MLJBase 0.18.15: https://github.com/JuliaAI/MLJBase.jl/pull/596 .

From the the new TunedModel doc-string:


tuned_model = TunedModel(; model=<model to be wrapped>,
                         tuning=Grid(),
                         resampling=Holdout(),
                         range=nothing,
                         measure=nothing,
                         n=default_n(tuning, range),
                         operation=predict,
                         other_options...)

Construct a model wrapper for hyperparameter optimization of a supervised learner, specifying the tuning strategy and model to be mutated.

tuned_model = TunedModel(; models=<models to be compared>,
                         resampling=Holdout(),
                         measure=nothing,
                         n=default_n(tuning, range),
                         operation=predict,
                         other_options...)

As above but applied to an explicit iterator models of MLJ models (equivalent to specifying tuning=Explicit() and range=models above). Elements of the iterator need not have a common model type, but they must all be Deterministic or all be Probabilistic and this is not checked but inferred from the first element generated.

See below for a complete list of options.

...

cc @rikhuijzer

ablaom commented 3 years ago

@rikhuijzer Be great if you can review this.

codecov-commenter commented 3 years ago

Codecov Report

Merging #142 (ae4b3f5) into dev (2d23761) will increase coverage by 0.32%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #142      +/-   ##
==========================================
+ Coverage   86.99%   87.31%   +0.32%     
==========================================
  Files          11       11              
  Lines         592      607      +15     
==========================================
+ Hits          515      530      +15     
  Misses         77       77              
Impacted Files Coverage Δ
src/strategies/explicit.jl 92.00% <100.00%> (ø)
src/tuned_models.jl 92.79% <100.00%> (+0.52%) :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 2d23761...ae4b3f5. Read the comment docs.