generated from JuliaAI/MLJExampleInterface.jl
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathattemptors.jl
53 lines (43 loc) · 1.24 KB
/
attemptors.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Test
using Pkg
using MLJTestIntegration
using MLJ
using MLJ.MLJModels
const MTI = MLJTestIntegration
@testset "model_type with model proxy instead of type" begin
# test error thrown (not caught) if pkg missing from environment:
@test_throws ArgumentError MLJTestIntegration.MLJTestInterface.model_type(
(name="PCA", package_name="MultivariateStats"),
@__MODULE__
)
M, outcome = MLJTestIntegration.MLJTestInterface.model_type(
(name="DecisionTreeClassifier", package_name="DecisionTree"),
@__MODULE__;
verbosity=0
)
end
clf = (@load DecisionTreeClassifier pkg=DecisionTree verbosity=0)()
rgs = (@load DecisionTreeRegressor pkg=DecisionTree verbosity=0)()
Xclf, yclf = make_moons(rng=123)
Xrgs, yrgs = make_regression(rng=123)
@testset "stack_evaluation" begin
# with probablistic classifier:
e, outcome = MTI.stack_evaluation(
clf,
[CPU1(), CPUThreads()],
Xclf, yclf;
throw=true,
verbosity=0,
)
@test outcome == "✓"
# with deterministic regressor:
e, outcome = MTI.stack_evaluation(
rgs,
[CPU1(), CPUThreads()],
Xrgs, yrgs;
throw=false,
verbosity=0,
)
@test outcome == "✓"
end
true