Skip to content

Commit

Permalink
clean up some tests to suppress some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ablaom committed Feb 29, 2024
1 parent 41181d8 commit cdfba7a
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions test/resampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@ API.@trait(
[LogLoss(), ], dummy_interval, 1))
end

@everywhere begin
nfolds = 6
nmeasures = 2
func(mach, k) = (
(sleep(MLJBase.PROG_METER_DT*rand(rng)); fill(1:k, nmeasures)),
:fitted_params,
:report,
)
end
@testset_accelerated "dispatch of resources and progress meter" accel begin

@info "Checking progress bars:"

X = (x = [1, ],)
y = [2.0, ]

@everywhere begin
nfolds = 6
nmeasures = 2
func(mach, k) = (
(sleep(MLJBase.PROG_METER_DT*rand(rng)); fill(1:k, nmeasures)),
:fitted_params,
:report,
)
end
mach = machine(ConstantRegressor(), X, y)
if accel isa CPUThreads
result = MLJBase._evaluate!(
Expand Down Expand Up @@ -643,15 +643,15 @@ end

struct DummyResamplingStrategy <: MLJBase.ResamplingStrategy end

@testset_accelerated "custom strategy depending on X, y" accel begin
function MLJBase.train_test_pairs(resampling::DummyResamplingStrategy,
rows, X, y)
train = filter(rows) do j
y[j] == y[1]
function MLJBase.train_test_pairs(resampling::DummyResamplingStrategy,
rows, X, y)
train = filter(rows) do j
y[j] == y[1]
end
test = setdiff(rows, train)
return [(train, test),]
end
test = setdiff(rows, train)
return [(train, test),]
end
@testset_accelerated "custom strategy depending on X, y" accel begin

X = (x = rand(rng,8), )
y = categorical(string.([:x, :y, :x, :x, :y, :x, :x, :y]))
Expand Down

0 comments on commit cdfba7a

Please sign in to comment.