Skip to content

Commit 780f020

Browse files
authored
Merge pull request #50 from JuliaAI/levels
Extend support for MLJ 0.22
2 parents fc9ab0c + 2fcf420 commit 780f020

File tree

2 files changed

+38
-35
lines changed

2 files changed

+38
-35
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MLJTestIntegration"
22
uuid = "697918b4-fdc1-4f9e-8ff9-929724cee270"
33
authors = ["Anthony D. Blaom <[email protected]>"]
4-
version = "0.5.3"
4+
version = "0.5.4"
55

66
[deps]
77
MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
@@ -12,7 +12,7 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1212
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1313

1414
[compat]
15-
MLJ = "0.18, 0.19, 0.20, 0.21"
15+
MLJ = "0.18, 0.19, 0.20, 0.21, 0.22"
1616
MLJModels = "0.16, 0.17, 0.18"
1717
MLJTestInterface = "0.2.4"
1818
MLJTransforms = "0.1.3"

README.md

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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
55
interface.
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

2124
This 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+
3035
For 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

6364
The following commands generate datasets of the form `(X, y)` suitable for integration
6465
tests:
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

Comments
 (0)