Skip to content

Commit 2439885

Browse files
committed
rm some tests in case of static models, where they don't apply and fail
1 parent 702c7b9 commit 2439885

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/attemptors.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ function fitted_machine(model, data...; throw=false, verbosity=1)
7979
machine(model, data...)
8080
fit!(mach, verbosity=-1)
8181
train, _ = MLJBase.partition(1:MLJBase.nrows(first(data)), 0.5)
82-
fit!(mach, rows=train, verbosity=-1)
83-
fit!(mach, rows=:, verbosity=-1)
82+
model isa Static || fit!(mach, rows=train, verbosity=-1)
83+
model isa Static || fit!(mach, rows=:, verbosity=-1)
8484
MLJBase.report(mach)
8585
MLJBase.fitted_params(mach)
8686
mach
@@ -90,19 +90,20 @@ end
9090
function operations(fitted_machine, data...; throw=false, verbosity=1)
9191
message = "[:operations] Calling `predict`, `transform` and/or `inverse_transform` "
9292
attempt(finalize(message, verbosity); throw) do
93+
model = fitted_machine.model
9394
operations = String[]
9495
methods = MLJBase.implemented_methods(fitted_machine.model)
9596
_, test = MLJBase.partition(1:MLJBase.nrows(first(data)), 0.5)
9697
if :predict in methods
9798
predict(fitted_machine, first(data))
98-
predict(fitted_machine, rows=test)
99-
predict(fitted_machine, rows=:)
99+
model isa Static || predict(fitted_machine, rows=test)
100+
model isa Static || predict(fitted_machine, rows=:)
100101
push!(operations, "predict")
101102
end
102103
if :transform in methods
103104
W = transform(fitted_machine, first(data))
104-
transform(fitted_machine, rows=test)
105-
transform(fitted_machine, rows=:)
105+
model isa Static || transform(fitted_machine, rows=test)
106+
model isa Static || transform(fitted_machine, rows=:)
106107
push!(operations, "transform")
107108
if :inverse_transform in methods
108109
inverse_transform(fitted_machine, W)

0 commit comments

Comments
 (0)