Skip to content

Commit

Permalink
Merge pull request #15 from JuliaAI/dev
Browse files Browse the repository at this point in the history
For a 0.2.3 release - take II
  • Loading branch information
ablaom authored Oct 1, 2023
2 parents 1d751b7 + 6312f00 commit 3bc4425
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
status:
project:
default:
threshold: 0.5%
3 changes: 3 additions & 0 deletions src/attemptors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 11 additions & 0 deletions test/attemptors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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

0 comments on commit 3bc4425

Please sign in to comment.