Skip to content

Commit

Permalink
Merge pull request #173 from JuliaAI/suppress-caching
Browse files Browse the repository at this point in the history
Suppress data caching in `TunedModel` machines, at outer level
  • Loading branch information
ablaom authored May 23, 2022
2 parents 32b502e + 5fc1096 commit 212bd5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tuned_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ end
const EitherTunedModel{T,M} =
Union{DeterministicTunedModel{T,M},ProbabilisticTunedModel{T,M}}

#todo update:
MLJBase.caches_data_by_default(::Type{<:EitherTunedModel}) = false

"""
tuned_model = TunedModel(; model=<model to be mutated>,
tuning=RandomSearch(),
Expand Down
11 changes: 11 additions & 0 deletions test/tuned_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,15 @@ end

end

@testset "data caching at outer level suppressed" begin
X, y = make_blobs()
model = DecisionTreeClassifier()
tmodel = TunedModel(models=[model,])
mach = machine(tmodel, X, y)
@test mach isa Machine{<:Any,false}
fit!(mach, verbosity=-1)
@test !isdefined(mach, :data)
MLJBase.Tables.istable(mach.cache[end].fitresult.machine.data[1])
end

true

0 comments on commit 212bd5e

Please sign in to comment.