From a74110beb69afa4be70c978019a8bd74faafe437 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 2 Oct 2023 07:58:30 +1300 Subject: [PATCH 1/3] make sure :transform is tested for transformers --- src/attemptors.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/attemptors.jl b/src/attemptors.jl index 9ef6742..c246059 100644 --- a/src/attemptors.jl +++ b/src/attemptors.jl @@ -93,6 +93,9 @@ function operations(fitted_machine, data...; throw=false, verbosity=1) model = fitted_machine.model operations = String[] methods = MLJBase.implemented_methods(fitted_machine.model) + if model isa Static && !(:transform in methods) + push!(methods, :transform) + end _, test = MLJBase.partition(1:MLJBase.nrows(first(data)), 0.5) if :predict in methods predict(fitted_machine, first(data)) From 155910ff13f68854052ce47da8e652bccdcdd351 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 2 Oct 2023 09:11:56 +1300 Subject: [PATCH 2/3] update codecov config --- .github/codecov.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..dda9ad0 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + threshold: 0.5% \ No newline at end of file From 87b99ad65309f707b2cca4cf9d2fcd7b01c24efe Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 2 Oct 2023 09:21:02 +1300 Subject: [PATCH 3/3] add test --- test/attemptors.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/attemptors.jl b/test/attemptors.jl index a826366..23f8e88 100644 --- a/test/attemptors.jl +++ b/test/attemptors.jl @@ -42,6 +42,12 @@ MLJBase.transform(::DummyStatic, _, x, y) = hcat(x, y) MLJBase.package_name(::Type{<:DummyStatic}) = "DummyPackage" MLJBase.load_path(::Type{<:DummyStatic}) = "DummyPackage.Some.Thing.Different" +struct DummyStatic2 <: Static end +MLJBase.transform(::DummyStatic2, _, x, y) = hcat(x, y) +MLJBase.package_name(::Type{<:DummyStatic2}) = "DummyPackage" +MLJBase.load_path(::Type{<:DummyStatic2}) = "DummyPackage.Some.Thing.Different" +MLJBase.implemented_methods(::Type{<:DummyStatic2}) = Symbol[] + struct SupervisedTransformer <: Deterministic end MLJBase.fit(::SupervisedTransformer, verbosity, X, y) = (42, nothing, nothing) MLJBase.predict(::SupervisedTransformer, _, Xnew) = fill(4.5, length(Xnew)) @@ -63,6 +69,11 @@ MLJBase.load_path(::Type{<:SupervisedTransformer}) = operations, outcome = MLJTestInterface.operations(smach, X, y) @test operations == "transform" @test outcome == "✓" + + smach = machine(DummyStatic2()) + operations, outcome = MLJTestInterface.operations(smach, X, y) + @test operations == "transform" + @test outcome == "✓" end true