Skip to content

Commit

Permalink
Merge pull request #46 from JuliaAI/add-generic-interface-tests
Browse files Browse the repository at this point in the history
Add generic interface tests from MLJTestInterface.jl
  • Loading branch information
ablaom authored Feb 16, 2024
2 parents 7f48db6 + 38fd23b commit ec8068c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ julia = "1.6"
[extras]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJTestInterface = "72560011-54dd-4dc2-94f3-c5de45b75ecd"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StatisticalMeasures = "a19d573c-0a75-4610-95b3-7071388c7541"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["LinearAlgebra", "MLJBase", "StableRNGs", "StatisticalMeasures", "Statistics", "Test"]
test = ["LinearAlgebra", "MLJBase", "MLJTestInterface", "StableRNGs", "StatisticalMeasures", "Statistics", "Test"]
50 changes: 50 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,62 @@ using Statistics
using MLJGLMInterface
using GLM: coeftable
import GLM
import MLJTestInterface

using Distributions: Normal, Poisson, Uniform
import StableRNGs
using Tables

expit(X) = 1 ./ (1 .+ exp.(-X))

# TODO: Add more datasets to the following generic interface tests after #45 is merged

@testset "generic interface tests" begin
@testset "LinearRegressor" begin
for data in [
MLJTestInterface.make_regression(),
]
failures, summary = MLJTestInterface.test(
[LinearRegressor,],
data...;
mod=@__MODULE__,
verbosity=0, # bump to debug
throw=false, # set to true to debug
)
@test isempty(failures)
end
end

@testset "LinearCountRegressor" begin
for data in [
MLJTestInterface.make_count(),
]
failures, summary = MLJTestInterface.test(
[LinearCountRegressor,],
data...;
mod=@__MODULE__,
verbosity=0, # bump to debug
throw=false, # set to true to debug
)
@test isempty(failures)
end
end

@testset "LinearBinaryClassifier" begin
for data in [
MLJTestInterface.make_binary(),
]
failures, summary = MLJTestInterface.test(
[LinearBinaryClassifier,],
data...;
mod=@__MODULE__,
verbosity=0, # bump to debug
throw=false, # set to true to debug
)
end
end
end

###
### OLSREGRESSOR
###
Expand Down

0 comments on commit ec8068c

Please sign in to comment.