@@ -4,10 +4,13 @@ Package for applying integration tests to models implementing the
44[ MLJ] ( https://alan-turing-institute.github.io/MLJ.jl/dev/ ) model
55interface.
66
7- ** To test implementations of the MLJ model interface, use [ MLJTestInterface.jl ] ( https://github.com/JuliaAI/MLJTestInterface.jl )
8- instead.**
7+ For to apply minimal tests for an implementations of the MLJ model interface, use
8+ [ MLJTestInterface.jl ] ( https://github.com/JuliaAI/MLJTestInterface.jl ) instead.
99
10- [ ![ Lifecycle: Experimental ] ( https://img.shields.io/badge/Lifecycle-Experimental-339999 )] ( https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md ) [ ![ Build Status] ( https://github.com/JuliaAI/MLJTestIntegration.jl/workflows/CI/badge.svg )] ( https://github.com/JuliaAI/MLJTestIntegration.jl/actions ) [ ![ Coverage] ( https://codecov.io/gh/JuliaAI/MLJTestIntegration.jl/branch/master/graph/badge.svg )] ( https://codecov.io/github/JuliaAI/MLJTestIntegration.jl?branch=master )
10+ However, * implementations are now encouraged to include the comprehensive tests* provided
11+ in this package instead.
12+
13+ [ ![ Lifecycle: Experimental ] ( https://img.shields.io/badge/Lifecycle-Experimental-339999 )] ( https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md ) [ ![ Build Status] ( https://github.com/JuliaAI/MLJTestIntegration.jl/workflows/CI/badge.svg )] ( https://github.com/JuliaAI/MLJTestIntegration.jl/actions ) [ ![ Coverage] ( https://codecov.io/gh/JuliaAI/MLJTestIntegration.jl/branch/master/graph/badge.svg )] ( https://codecov.io/github/JuliaAI/MLJTestIntegration.jl?branch=master )
1114
1215# Installation
1316
@@ -19,55 +22,55 @@ Pkg.add("MLJTestIntegration")
1922# Usage
2023
2124This package provides a method for testing a collection of ` models `
22- (types or named tuples with keys ` :name ` and ` :package_name ` ) using
23- the specified training ` data ` :
25+ (more, specifically model types) using the specified training ` data ` :
2426
2527``` julia
26- MLJTestIntegration. test (models, data... ; mod= Main, level= 2 , throw= false , verbosity= 1 )
28+ MLJTestIntegration. test (models, data... ; mod= Main, level= 2 , throw= false , verbosity= 1 )
2729 -> failures, summary
2830```
2931
32+ For pure Julia models, ` level=4 ` (the maximimum) is recommended. Otherwise ` level=3 ` is
33+ recommended.
34+
3035For detailed documentation, run ` using MLJTestIntegration; @doc MLJTestIntegration.test ` .
3136
3237
33- # Example: Testing models filtered from the MLJ model registry
38+ # Example
3439
35- The following applies comprehensive integration tests to all
36- regressors provided by the package GLM.jl appearing in the MLJ Model
37- Registry. Since GLM.jl models are provided through the interface
38- package ` MLJGLMInterface ` , this must be in the current environment:
40+ The following tests the model interface implemented by the ` DecisionTreeClassifier ` model
41+ implemented in the package MLJDecisionTreeInterface.jl.
3942
4043``` julia
41- Pkg. add (" MLJGLMInterface" )
42- import MLJBase, MLJTestIntegration
43- using DataFrames # to view summary
44- X, y = MLJTestIntegration. MLJ. make_regression ();
45- regressors = MLJTestIntegration. MLJ. models (matching (X, y)) do m
46- m. package_name == " GLM"
47- end
48-
49- # to test code loading:
50- failures, summary =
51- MLJTestIntegration. test (regressors, X, y, verbosity= 2 , mod= @__MODULE__ , level= 1 )
52- @assert isempty (failures)
53-
54- # comprehensive tests:
55- failures, summary =
56- MLJTestIntegration. test (regressors, X, y, verbosity= 2 , mod= @__MODULE__ , level= 4 )
57-
58- summary |> DataFrame
44+ import MLJDecisionTreeInterface
45+ import MLJTestIntegration
46+ using Test
47+ X, y = MLJTestIntegration. make_multiclass ()
48+ failures, summary = MLJTestIntegration. test (
49+ [MLJDecisionTreeInterface. DecisionTreeClassifier, ],
50+ X, y,
51+ verbosity= 0 , # set to 2 when debugging
52+ throw= false , # set to `true` when debugging
53+ mod= @__MODULE__ ,
54+ )
55+ @test isempty (failures)
5956```
6057
58+ For models supporting tabular data ` X ` , we recommend repeating the tests with ` (X, y) `
59+ replaced with ` (Tables.rowtable(X)), y) ` to ensure support for different table types,
60+ which new implementation sometimes fail to do.
61+
6162# Datasets
6263
6364The following commands generate datasets of the form ` (X, y) ` suitable for integration
6465tests:
6566
66- - ` MLJTestIntegration.make_binary `
67+ - ` MLJTestIntegration.make_binary `
6768
68- - ` MLJTestIntegration.make_multiclass `
69+ - ` MLJTestIntegration.make_multiclass `
6970
70- - ` MLJTestIntegration.make_regression `
71+ - ` MLJTestIntegration.make_regression `
7172
72- - ` MLJTestIntegration.make_count `
73+ - ` MLJTestIntegration.make_count `
7374
75+ The binary and multiclass sets are deliberately small and will catch failures to properly
76+ track target class pools, a common gotcha in new implementations.
0 commit comments