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

For a 0.3.1 release #239

Merged
merged 5 commits into from
Sep 11, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add test
  • Loading branch information
ablaom committed Sep 4, 2023
commit bbc1a446a81275e6203328db88ae6b3ec8444c89
28 changes: 28 additions & 0 deletions test/mlj_model_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,31 @@ end
@test length(losses) == 10
end

mutable struct LisasBuilder
n1::Int
end

@testset "builder errors and issue #237" begin
# create a builder with an intentional flaw;
# `Chains` is undefined - it should be `Chain`
function MLJFlux.build(builder::LisasBuilder, rng, nin, nout)
return Flux.Chains(
Flux.Dense(nin, builder.n1),
Flux.Dense(builder.n1, nout)
)
end

model = NeuralNetworkRegressor(
epochs = 2,
batch_size = 32,
builder = LisasBuilder(10),
)

X, y = @load_boston
@test_logs(
(:error, MLJFlux.ERR_BUILDER),
@test_throws UndefVarError(:Chains) MLJBase.fit(model, 0, X, y)
)
end

true