Skip to content

Commit

Permalink
Merge pull request #146 from JuliaAI/dev
Browse files Browse the repository at this point in the history
For a 0.6.11 release
  • Loading branch information
ablaom authored Sep 10, 2021
2 parents d5d7beb + 4d65e28 commit a819b50
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MLJTuning"
uuid = "03970b2e-30c4-11ea-3135-d1576263f10f"
authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
version = "0.6.10"
version = "0.6.11"

[deps]
ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/tuned_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions test/models/Constant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const MMI = MLJModelInterface
export ConstantClassifier, ConstantRegressor,
DeterministicConstantRegressor,
DeterministicConstantClassifier,
ProbabilisticConstantClassifer

Expand Down
29 changes: 29 additions & 0 deletions test/tuned_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a819b50

Please sign in to comment.