generated from JuliaAI/MLJExampleInterface.jl
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatasets.jl
68 lines (58 loc) · 1.72 KB
/
datasets.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using Test
using MLJTestIntegration
using MLJ
using MLJModels
const MTI = MLJTestIntegration
Rgs = @load KNNRegressor pkg=NearestNeighborModels verbosity=0
Clf = @load KNNClassifier pkg= NearestNeighborModels verbosity=0
Trf = @load Standardizer pkg=MLJModels verbosity=0
Rgs_proxy = models() do m
m.name == "KNNRegressor" && m.package_name == "NearestNeighborModels"
end |> only
# a Static model with two arguments:
struct StaticModel <: Static end
MLJ.input_scitype(::Type{<:StaticModel}) =
Tuple{Table(Continuous), AbstractVector{<:Finite}}
sets = MTI.datasets(Rgs)
@test length(sets) == 2
@test scitype.(sets) |> Set ==
scitype.([
MTI.make_regression(),
MTI.make_regression(row_table=true),
]) |> Set
sets = MTI.datasets(Rgs_proxy)
@test length(sets) == 2
@test scitype.(sets) |> Set ==
scitype.([
MTI.make_regression(),
MTI.make_regression(row_table=true),
]) |> Set
sets = MTI.datasets(Rgs_proxy)
@test length(sets) == 2
@test scitype.(sets) |> Set ==
scitype.([
MTI.make_regression(),
MTI.make_regression(row_table=true),
]) |> Set
sets = MTI.datasets(Clf)
@test length(sets) == 4
@test scitype.(sets) |> Set ==
scitype.([
MTI.make_binary(),
MTI.make_multiclass(),
MTI.make_binary(row_table=true),
MTI.make_multiclass(row_table=true),
]) |> Set
sets = MTI.datasets(Trf)
@test length(sets) == 2
@test scitype(sets[1][1]) == scitype(MTI.make_regression()[1])
sets = MTI.datasets(StaticModel)
@test length(sets) == 4
@test scitype.(sets) |> Set ==
scitype.([
MTI.make_binary(),
MTI.make_multiclass(),
MTI.make_binary(row_table=true),
MTI.make_multiclass(row_table=true),
]) |> Set
true