1
1
# # HELPERS
2
2
3
- _strip (proxy) = (name= proxy. name, package_name= proxy. package_name)
4
-
5
- function _filter (proxies, bad)
6
- sbad = _strip .(bad)
7
- filter (proxies) do proxy
8
- ! (_strip (proxy) in sbad)
9
- end
3
+ function warn_not_testing_these (models)
4
+ " Not testing the following models, as incompatible with testing data:\n " *
5
+ " $models "
10
6
end
11
7
12
- # fallback:
13
- function _test (data, ignore; kwargs... )
14
- proxies = _filter (models (matching (data... )), ignore)
15
- test (proxies, data... ; kwargs... )
8
+ strip (proxy) = (name= proxy. name, package_name= proxy. package_name)
9
+
10
+ function actual_proxies (raw_proxies, data, ignore, verbosity)
11
+ proxies = strip .(raw_proxies)
12
+ from_registry = strip .(models (matching (data... )))
13
+ if ignore
14
+ actual_proxies = setdiff (from_registry, proxies)
15
+ else
16
+ actual_proxies = intersect (proxies, from_registry)
17
+ rejected = setdiff (proxies, actual_proxies)
18
+ if ! isempty (rejected) && verbosity > 0
19
+ @warn warn_not_testing_these (rejected)
20
+ end
21
+ end
22
+ return actual_proxies
16
23
end
17
24
18
- # when there are no models to exclude:
19
- function _test (data, ignore:: Nothing ; kwargs... )
20
- proxies = models (matching (data... ))
21
- test (proxies, data... ; kwargs... )
25
+ function _test (proxies, data; ignore:: Bool = false , verbosity= 1 , kwargs... )
26
+ test (actual_proxies (proxies, data, ignore, verbosity), data... ; kwargs... )
22
27
end
28
+ _test (data; ignore= true , kwargs... ) = _test ([], data; ignore, kwargs... )
23
29
24
30
25
31
# # SINGLE TARGET CLASSIFICATION
@@ -31,8 +37,8 @@ function _make_binary()
31
37
return X, y
32
38
end
33
39
34
- test_single_target_classifiers (; ignore = nothing , kwargs... ) =
35
- _test (_make_binary (), ignore ; kwargs... )
40
+ test_single_target_classifiers (args ... ; kwargs... ) =
41
+ _test (args ... , _make_binary (); kwargs... )
36
42
37
43
38
44
# # SINGLE TARGET REGRESSION
@@ -43,8 +49,8 @@ function _make_baby_boston()
43
49
return X, y
44
50
end
45
51
46
- test_single_target_regressors (; ignore = nothing , kwargs... ) =
47
- _test (_make_baby_boston (), ignore ; kwargs... )
52
+ test_single_target_regressors (args ... ; kwargs... ) =
53
+ _test (args ... , _make_baby_boston (); kwargs... )
48
54
49
55
50
56
# # SINGLE TARGET COUNT REGRESSORS
@@ -55,13 +61,13 @@ function _make_count()
55
61
return X, y
56
62
end
57
63
58
- test_single_target_count_regressors (; ignore = nothing , kwargs... ) =
59
- _test (_make_count (), ignore ; kwargs... )
64
+ test_single_target_count_regressors (args ... ; kwargs... ) =
65
+ _test (args ... , _make_count (); kwargs... )
60
66
61
67
62
68
# # CONTINUOUS TABLE TRANSFORMERS
63
69
64
70
_make_transformer () = (first (_make_baby_boston ()),)
65
71
66
- test_continuous_table_transformers (; ingore = nothing , kwargs... ) =
67
- _test (_make_transformer (), ignore ; kwargs... )
72
+ test_continuous_table_transformers (args ... ; kwargs... ) =
73
+ _test (args ... , _make_transformer (); kwargs... )
0 commit comments