From 75fdfc2835efe8681353a8ccbaddb6d480569d2d Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Wed, 22 Sep 2021 07:30:35 +1200 Subject: [PATCH 1/4] minor doc-string correction --- src/tuned_models.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tuned_models.jl b/src/tuned_models.jl index 53b8ff2..2758915 100644 --- a/src/tuned_models.jl +++ b/src/tuned_models.jl @@ -79,7 +79,7 @@ hyper-parameters are to be mutated. tuned_model = TunedModel(; models=, resampling=Holdout(), measure=nothing, - n=default_n(tuning, range), + n=length(models), operation=nothing, other_options...) From 0ef7b16e3a4ca6c8703b9df3ed8a263d7fb02a11 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Wed, 22 Sep 2021 16:31:48 +1200 Subject: [PATCH 2/4] address #60 --- src/learning_curves.jl | 5 ++++- src/tuned_models.jl | 2 +- test/learning_curves.jl | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/learning_curves.jl b/src/learning_curves.jl index e46c28e..5048b5d 100644 --- a/src/learning_curves.jl +++ b/src/learning_curves.jl @@ -112,8 +112,11 @@ learning_curve(mach::Machine{<:Supervised}; kwargs...) = learning_curve(mach.model, mach.args...; kwargs...) # for backwards compatibility -learning_curve!(mach::Machine{<:Supervised}; kwargs...) = +function learning_curve!(mach::Machine{<:Supervised}; kwargs...) + Base.depwarn("`learning_curve!` is deprecated, use `learning_curve` instead. ", + Core.Typeof(learning_curve!).name.mt.name) learning_curve(mach; kwargs...) +end function learning_curve(model::Supervised, args...; resolution=30, diff --git a/src/tuned_models.jl b/src/tuned_models.jl index 2758915..c6f2cbf 100644 --- a/src/tuned_models.jl +++ b/src/tuned_models.jl @@ -79,7 +79,7 @@ hyper-parameters are to be mutated. tuned_model = TunedModel(; models=, resampling=Holdout(), measure=nothing, - n=length(models), + n=length(models), operation=nothing, other_options...) diff --git a/test/learning_curves.jl b/test/learning_curves.jl index 3052588..eb380ed 100644 --- a/test/learning_curves.jl +++ b/test/learning_curves.jl @@ -206,6 +206,14 @@ end end +@testset "deprecation of learning_curve!" begin + atom = KNNRegressor() + mach = machine(atom, X, y) + r = range(atom, :K, lower=1, upper=2) + @test_deprecated learning_curve!(mach; + range=r, + measure=LPLoss(), + verbosity=0) end # module true From 514a1aea67248298468ac390c1fba6ba5c15ff24 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Wed, 22 Sep 2021 16:46:27 +1200 Subject: [PATCH 3/4] make operation=nothing the default in learning_curve --- src/learning_curves.jl | 31 ++++++------------------------- test/learning_curves.jl | 2 ++ 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/learning_curves.jl b/src/learning_curves.jl index 5048b5d..c91e04e 100644 --- a/src/learning_curves.jl +++ b/src/learning_curves.jl @@ -7,7 +7,7 @@ measure=default_measure(machine.model), rows=nothing, weights=nothing, - operation=predict, + operation=nothing, range=nothing, acceleration=default_resource(), acceleration_grid=CPU1(), @@ -26,8 +26,8 @@ the (possibly nested) RNG field, and a vector `rngs` of RNG's, one for each curve. Alternatively, set `rngs` to the number of curves desired, in which case RNG's are automatically generated. The individual curve computations can be distributed across multiple processes using -`acceleration=CPUProcesses()` or `acceleration=CPUThreads()`. See the second example below for a -demonstration. +`acceleration=CPUProcesses()` or `acceleration=CPUThreads()`. See the +second example below for a demonstration. ```julia X, y = @load_boston; @@ -73,27 +73,6 @@ a machine. - `resolution` - number of points generated from `range` (number model evaluations); default is `30` -- `resampling` - resampling strategy; default is `Holdout(fraction_train=0.7)` - -- `repeats` - set to more than `1` for repeated (Monte Carlo) resampling - -- `measure` - performance measure (metric); automatically inferred - from model by default when possible - -- `rows` - row indices to which resampling should be restricted; - default is all rows - -- `weights` - sample weights used by `measure` where supported - -- `operation` - operation, such as `predict`, to be used in - evaluations. If `prediction_type(mach.model) == :probabilistic` but - `prediction_type(measure) == :deterministic` consider `,`predict_mode`, - `predict_mode` or `predict_median`; default is `predict`. - -- `range` - object constructed using `range(model, ...)` or - `range(type, ...)` representing one-dimensional hyper-parameter - range. - - `acceleration` - parallelization option for passing to `evaluate!`; an instance of `CPU1`, `CPUProcesses` or `CPUThreads` from the `ComputationalResources.jl`; default is `default_resource()` @@ -107,6 +86,8 @@ a machine. - `rng_name` - name of the model hyper-parameter representing a random number generator (see above); possibly nested +Other key-word options are documented at [`TunedModel`](@ref). + """ learning_curve(mach::Machine{<:Supervised}; kwargs...) = learning_curve(mach.model, mach.args...; kwargs...) @@ -125,7 +106,7 @@ function learning_curve(model::Supervised, args...; measures=nothing, measure=measures, rows=nothing, - operation=predict, + operation=nothing, ranges::Union{Nothing,ParamRange}=nothing, range::Union{Nothing,ParamRange}, repeats=1, diff --git a/test/learning_curves.jl b/test/learning_curves.jl index eb380ed..6c85e81 100644 --- a/test/learning_curves.jl +++ b/test/learning_curves.jl @@ -215,5 +215,7 @@ end measure=LPLoss(), verbosity=0) +end + end # module true From d9ce57f2b114908d7ea32efc744760948ae3bd40 Mon Sep 17 00:00:00 2001 From: "Anthony Blaom, PhD" Date: Thu, 23 Sep 2021 10:36:57 +1200 Subject: [PATCH 4/4] Bump 0.6.13 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index b04c563..a0a5c2b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MLJTuning" uuid = "03970b2e-30c4-11ea-3135-d1576263f10f" authors = ["Anthony D. Blaom "] -version = "0.6.12" +version = "0.6.13" [deps] ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"