Skip to content

Commit d6d3559

Browse files
committed
add doc string for convenience functions
1 parent 2718783 commit d6d3559

File tree

2 files changed

+63
-10
lines changed

2 files changed

+63
-10
lines changed

src/special_cases.jl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# # HELPERS
22

3+
const DOC_AS_ABOVE =
4+
"""
5+
The same as above, but restricting to those registered models that are also
6+
in `models`, a vector of named tuples inlcuding `:name` and
7+
`:package_name` as keys. If `ignore=true`, then instead apply tests
8+
to all models but *excluding* those in `models`.
9+
"""
10+
311
function warn_not_testing_these(models)
412
"Not testing the following models, as incompatible with testing data:\n"*
513
"$models"
@@ -37,6 +45,19 @@ function _make_binary()
3745
return X, y
3846
end
3947

48+
"""
49+
MLJTestIntegration.test_single_target_classifiers(; keyword_options...)
50+
51+
Apply [`MLJTestIntegration.test`](@ref) to all models in the MLJ Model
52+
Registry that support single target classification, using a
53+
two-feature selection of the Crab dataset. The specifed
54+
`keyword_options` are passed to onto to `MLJTestIntegration.test`.
55+
56+
MLJTestIntegration.test_single_target_classifiers(models; ignore=false, keyword_options...)
57+
58+
$DOC_AS_ABOVE
59+
60+
"""
4061
test_single_target_classifiers(args...; kwargs...) =
4162
_test(args..., _make_binary(); kwargs...)
4263

@@ -49,6 +70,19 @@ function _make_baby_boston()
4970
return X, y
5071
end
5172

73+
"""
74+
MLJTestIntegration.test_single_target_regressors(; keyword_options...)
75+
76+
Apply [`MLJTestIntegration.test`](@ref) to all models in the MLJ Model
77+
Registry that support single target regression, using a two-feature
78+
selection of the Boston dataset. The specifed `keyword_options` are
79+
passed onto `MLJTestIntegration.test`.
80+
81+
MLJTestIntegration.test_single_target_regressors(models; ignore=false, keyword_options...)
82+
83+
$DOC_AS_ABOVE
84+
85+
"""
5286
test_single_target_regressors(args...; kwargs...) =
5387
_test(args..., _make_baby_boston(); kwargs...)
5488

@@ -61,6 +95,21 @@ function _make_count()
6195
return X, y
6296
end
6397

98+
"""
99+
MLJTestIntegration.test_single_count_regressors(; keyword_options...)
100+
101+
Apply [`MLJTestIntegration.test`](@ref) to all models in the MLJ Model
102+
Registry that support single target count regressors
103+
(`AbstractVector{Count}` target scitype) using a two-feature selection
104+
of the Boston datasetand the target variable discretized. The
105+
specifed `keyword_options` are passed onto
106+
`MLJTestIntegration.test`.
107+
108+
MLJTestIntegration.test_single_target_regressors(models; ignore=false, keyword_options...)
109+
110+
$DOC_AS_ABOVE
111+
112+
"""
64113
test_single_target_count_regressors(args...; kwargs...) =
65114
_test(args..., _make_count(); kwargs...)
66115

@@ -69,5 +118,17 @@ test_single_target_count_regressors(args...; kwargs...) =
69118

70119
_make_transformer() = (first(_make_baby_boston()),)
71120

121+
"""
122+
test_continuous_table_transformers(; keyword_options...)
123+
124+
Apply [`MLJTestIntegration.test`](@ref) to all models in the MLJ
125+
Model Registry that train on a single table with continuous features,
126+
using a two-feature selection of the Boston dataset. The specifed
127+
`keyword_options` are passed onto `MLJTestIntegration.test`.
128+
129+
test_continuous_table_transformers(models; ignore=false, keyword_options...)
130+
131+
$DOC_AS_ABOVE
132+
"""
72133
test_continuous_table_transformers(args...; kwargs...) =
73134
_test(args..., _make_transformer(); kwargs...)

src/test.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,14 @@ using `data` for training. Here `mod` should be the module from which
1717
`test` is called (generally, `mod=@__MODULE__` will work). Here
1818
`models` is either:
1919
20-
1. A collection of model types implementing the [MLJ model
21-
interface](https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/).
20+
1. A collection of model types implementing the [MLJ model interface](https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/).
2221
23-
2. A collection of named tuples, where each tuple includes `:name` and
24-
`:package_name` as keys, and whose corresponding values point to a
25-
model types appearing in the [MLJ Model
26-
Registry](https://github.com/JuliaAI/MLJModels.jl/tree/dev/src/registry).
27-
`MLJ.models(...)` always returns such a collection.
22+
2. A collection of named tuples, where each tuple includes `:name` and `:package_name` as keys, and whose corresponding values point to a model type appearing in the [MLJ Model Registry](https://github.com/JuliaAI/MLJModels.jl/tree/dev/src/registry). `MLJ.models(...)` always returns such a collection.
2823
2924
Ordinarily, code defining the model types to be tested must already be
3025
loaded into the module `mod`. An exception is described under "Testing
3126
with automatic code loading" below.
3227
33-
interface packages providing the models must be in the current
34-
environment, but the packages need not be loaded.
35-
3628
The extent of testing is controlled by `level`:
3729
3830
|`level` | description | tests (full list below) |

0 commit comments

Comments
 (0)