Skip to content

Commit

Permalink
Merge pull request #58 from alan-turing-institute/collapse-machines2
Browse files Browse the repository at this point in the history
MLJBase 0.14 update
  • Loading branch information
ablaom committed Jun 26, 2020
2 parents 54224a6 + 187705b commit 284c50c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Project.toml
@@ -1,7 +1,7 @@
name = "MLJTuning"
uuid = "03970b2e-30c4-11ea-3135-d1576263f10f"
authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
version = "0.3.7"
version = "0.4.0"

[deps]
ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
Expand All @@ -16,7 +16,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
[compat]
ComputationalResources = "^0.3"
Distributions = "^0.22,^0.23"
MLJBase = "^0.12.2,^0.13"
MLJBase = "^0.12.2,^0.13,^0.14"
MLJModelInterface = "^0.3"
ProgressMeter = "^1.3"
RecipesBase = "^0.8,^0,9,^1.0"
Expand Down
7 changes: 4 additions & 3 deletions test/models/simple_composite_model.jl
Expand Up @@ -36,17 +36,18 @@ MLJBase.is_wrapper(::Type{<:SimpleDeterministicCompositeModel}) = true
function MLJBase.fit(composite::SimpleDeterministicCompositeModel,
verbosity::Integer, Xtrain, ytrain)
X = source(Xtrain) # instantiates a source node
y = source(ytrain, kind=:target)
y = source(ytrain)

t = machine(composite.transformer, X)
Xt = transform(t, X)

l = machine(composite.model, Xt, y)
yhat = predict(l, Xt)

fit!(yhat, verbosity=verbosity)
mach = machine(Deterministic(), X, y; predict=yhat)
fit!(mach, verbosity=verbosity)

return fitresults(yhat)
return mach()
end

MLJBase.load_path(::Type{<:SimpleDeterministicCompositeModel}) =
Expand Down
5 changes: 2 additions & 3 deletions test/strategies/grid.jl
Expand Up @@ -153,12 +153,11 @@ end

fit!(tuned, verbosity=0)
r = report(tuned)
@test r.best_report isa NamedTuple{(:machines, :report_given_machine)}
@test :model in collect(keys(r.best_report))
fit!(tuned, verbosity=0)
rep = report(tuned)
fp = fitted_params(tuned)
@test fp.best_fitted_params isa
NamedTuple{(:machines, :fitted_params_given_machine)}
@test :model in collect(keys(fp.best_fitted_params))
b = fp.best_model
@test b isa SimpleDeterministicCompositeModel

Expand Down

0 comments on commit 284c50c

Please sign in to comment.