Skip to content

Commit

Permalink
suppress data caching at outer level to close #171
Browse files Browse the repository at this point in the history
  • Loading branch information
ablaom committed May 10, 2022
1 parent 32b502e commit 5fc1096
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 5fc1096

Please sign in to comment.