diff --git a/Project.toml b/Project.toml index bb96ce5..1cbfa52 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.8.2" +version = "0.8.3" [deps] ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3" diff --git a/src/tuned_models.jl b/src/tuned_models.jl index 38d646e..1e25574 100644 --- a/src/tuned_models.jl +++ b/src/tuned_models.jl @@ -441,6 +441,7 @@ function event!(metamodel, measure = E.measure, measurement = E.measurement, per_fold = E.per_fold, + evaluation = E, metadata = metadata) entry = merge(entry0, extras(tuning, history, state, E)) if verbosity > 2 diff --git a/test/serialization.jl b/test/serialization.jl index 8ef1e64..15866f3 100644 --- a/test/serialization.jl +++ b/test/serialization.jl @@ -51,7 +51,7 @@ end @test MLJBase.predict(smach, X) == MLJBase.predict(mach, X) @test fitted_params(smach) isa NamedTuple - @test report(smach) == report(mach) + @test report(smach).best_model == report(mach).best_model rm(filename) diff --git a/test/tuned_models.jl b/test/tuned_models.jl index f04b8b1..10c1e07 100644 --- a/test/tuned_models.jl +++ b/test/tuned_models.jl @@ -455,4 +455,24 @@ end @test MLJBase.predict(mach2, (; x = rand(2))) ≈ fill(42.0, 2) end +@testset_accelerated "full evaluation object" accel begin + X, y = make_regression(100, 2) + dcr = DeterministicConstantRegressor() + + homodel = TunedModel( + models=fill(dcr, 10), + resampling=Holdout(rng=StableRNG(1234)), + acceleration_resampling=accel, + measure=mae + ) + homach = machine(homodel, X, y) + fit!(homach, verbosity=0); + horep = report(homach) + evaluations = getproperty.(horep.history, :evaluation) + measurements = getproperty.(evaluations, :measurement) + models = getproperty.(evaluations, :model) + @test all(==(measurements[1]), measurements) + @test all(==(dcr), models) +end + true