Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning for use of shuffling in holdout #13

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ function IteratedModel(; model=nothing,

model == nothing && throw(ERR_NO_MODEL)



if model isa Deterministic
iterated_model = DeterministicIteratedModel(model,
controls,
Expand Down Expand Up @@ -229,5 +227,12 @@ function MLJBase.clean!(iterated_model::EitherIteratedModel)
iteration_parameter(iterated_model.model) === nothing &&
throw(ERR_NEED_PARAMETER)

if iterated_model.resampling isa Holdout &&
iterated_model.resampling.shuffle
message *= "The use of sample-shuffling in `Holdout` "*
"will significantly slow training as "*
"each increment of the iteration parameter "*
"will force iteration from scratch (cold restart). "
end
return message
end
8 changes: 7 additions & 1 deletion test/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ struct Bar <: MLJBase.Deterministic end
@test iterated_model.measure == RootMeanSquaredError()
@test_logs IteratedModel(model=model, measure=mae)

iterated_model = @test_logs IteratedModel(model=model, resampling=nothing)
@test_logs IteratedModel(model=model, resampling=nothing)

@test_logs((:info, r"The use of sample"),
IteratedModel(model=model,
resampling=Holdout(rng=123),
measure=rms))

end

end
Expand Down