diff --git a/Project.toml b/Project.toml index 8996f88..2699f13 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.10" +version = "0.6.11" [deps] ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3" diff --git a/README.md b/README.md index 51ccda3..74041ec 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Hyperparameter optimization for [MLJ](https://github.com/alan-turing-institute/MLJ.jl) machine learning models. -[![Build Status](https://github.com/alan-turing-institute/MLJTuning.jl/workflows/CI/badge.svg)](https://github.com/alan-turing-institute/MLJTuning.jl/actions) -[![Coverage Status](https://coveralls.io/repos/github/alan-turing-institute/MLJTuning.jl/badge.svg?branch=master)](https://coveralls.io/github/alan-turing-institute/MLJTuning.jl?branch=master) +[![Build Status](https://github.com/JuliaAI/MLJTuning.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/MLJTuning.jl/actions) +[![codecov.io](http://codecov.io/github/JuliaAI/MLJTuning.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaAI/MLJTuning.jl?branch=master) ### Contents @@ -41,7 +41,7 @@ MLJTuning is a component of the [MLJ [MLJModels](https://github.com/alan-turing-institute/MLJModels.jl) as a dependency (no ability to search and load registered MLJ models). It does however depend on - [MLJBase](https://github.com/alan-turing-institute/MLJBase.jl) and, + [MLJBase](https://github.com/JuliaAI/MLJBase.jl) and, in particular, on the resampling functionality currently residing there. diff --git a/src/tuned_models.jl b/src/tuned_models.jl index 8f6b8f2..d303c93 100644 --- a/src/tuned_models.jl +++ b/src/tuned_models.jl @@ -691,7 +691,7 @@ function MLJBase.fit(tuned_model::EitherTunedModel{T,M}, # instantiate resampler (`model` to be replaced with mutated # clones during iteration below): resampler = Resampler(model=model, - resampling = tuned_model.resampling, + resampling = deepcopy(tuned_model.resampling), measure = tuned_model.measure, weights = tuned_model.weights, operation = tuned_model.operation, diff --git a/test/models/Constant.jl b/test/models/Constant.jl index cff2cd3..d48c251 100644 --- a/test/models/Constant.jl +++ b/test/models/Constant.jl @@ -2,6 +2,7 @@ const MMI = MLJModelInterface export ConstantClassifier, ConstantRegressor, + DeterministicConstantRegressor, DeterministicConstantClassifier, ProbabilisticConstantClassifer diff --git a/test/tuned_models.jl b/test/tuned_models.jl index ffe596b..4de3b51 100644 --- a/test/tuned_models.jl +++ b/test/tuned_models.jl @@ -265,4 +265,33 @@ end @test length(report(mach).history) == 49 end +@testset_accelerated "Resampling reproducibility" accel begin + X, y = make_regression(100, 2) + dcr = DeterministicConstantRegressor() + + # Hold out reproducibility + homodel = TunedModel(tuning=Explicit(), + 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) + measurements = getproperty.(horep.history, :measurement) + @test all(==(measurements[1]), measurements) + + # Cross-validation reproducibility + cvmodel = TunedModel(tuning=Explicit(), + models=fill(dcr, 10), + resampling=CV(nfolds=5, rng=StableRNG(1234)), + acceleration_resampling=accel, + measure=mae) + cvmach = machine(cvmodel, X, y) + fit!(cvmach, verbosity=0); + cvrep = report(cvmach) + per_folds = getproperty.(cvrep.history, :per_fold) + @test all(==(per_folds[1]), per_folds) +end + true