From 899a05b78d805f443dd1d758f3e041c4aa7c2868 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 18 Mar 2024 11:22:29 +1300 Subject: [PATCH 1/2] fix problem with training_losses for pipelines --- src/composition/models/pipelines.jl | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/composition/models/pipelines.jl b/src/composition/models/pipelines.jl index a0f78193..5fdab66e 100644 --- a/src/composition/models/pipelines.jl +++ b/src/composition/models/pipelines.jl @@ -602,20 +602,12 @@ MMI.target_scitype(p::SupervisedPipeline) = target_scitype(supervised_component( # ## Training losses -const ERR_TRAINING_LOSSES1 = ErrorException( - "Looking for training losses in a model's report but cannot find any. " -) - -const ERR_TRAINING_LOSSES2 = ErrorException( - "Composite model does not appear to support training losses. " -) - +# If supervised model does not support training losses, we won't find an entry in the +# report and so we need to return `nothing` (and not throw an error). function MMI.training_losses(pipe::SupervisedPipeline, pipe_report) - supports_training_losses(pipe::SupervisedPipeline) || - throw(ERR_PIPE_TRAINING_LOSSES2) supervised = MLJBase.supervised_component(pipe) supervised_name = MLJBase.supervised_component_name(pipe) - supervised_name in propertynames(pipe_report) || throw(ERR_PIPE_TRAINING_LOSSES1) + supervised_name in propertynames(pipe_report) || return nothing report = getproperty(pipe_report, supervised_name) return training_losses(supervised, report) end From b417240741b8fffd18ce252b2b64de45febb72cf Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 18 Mar 2024 11:22:57 +1300 Subject: [PATCH 2/2] bump 1.2.1 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0ce6f258..ae84eb3b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MLJBase" uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d" authors = ["Anthony D. Blaom "] -version = "1.2.0" +version = "1.2.1" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"