1
1
module MLJModelInterface
2
2
3
- const MODEL_TRAITS =
4
- [ :input_scitype ,
3
+ const MODEL_TRAITS = [
4
+ :input_scitype ,
5
5
:output_scitype ,
6
6
:target_scitype ,
7
7
:fit_data_scitype ,
@@ -29,25 +29,27 @@ const MODEL_TRAITS =
29
29
:hyperparameter_ranges ,
30
30
:iteration_parameter ,
31
31
:supports_training_losses ,
32
- :deep_properties ]
33
-
34
- const ABSTRACT_MODEL_SUBTYPES =
35
- [:Supervised ,
36
- :Unsupervised ,
37
- :Probabilistic ,
38
- :Deterministic ,
39
- :Interval ,
40
- :JointProbabilistic ,
41
- :Static ,
42
- :Annotator ,
43
- :SupervisedAnnotator ,
44
- :UnsupervisedAnnotator ,
45
- :SupervisedDetector ,
46
- :UnsupervisedDetector ,
47
- :ProbabilisticSupervisedDetector ,
48
- :ProbabilisticUnsupervisedDetector ,
49
- :DeterministicSupervisedDetector ,
50
- :DeterministicUnsupervisedDetector ]
32
+ :deep_properties
33
+ ]
34
+
35
+ const ABSTRACT_MODEL_SUBTYPES = [
36
+ :Supervised ,
37
+ :Unsupervised ,
38
+ :Probabilistic ,
39
+ :Deterministic ,
40
+ :Interval ,
41
+ :JointProbabilistic ,
42
+ :Static ,
43
+ :Annotator ,
44
+ :SupervisedAnnotator ,
45
+ :UnsupervisedAnnotator ,
46
+ :SupervisedDetector ,
47
+ :UnsupervisedDetector ,
48
+ :ProbabilisticSupervisedDetector ,
49
+ :ProbabilisticUnsupervisedDetector ,
50
+ :DeterministicSupervisedDetector ,
51
+ :DeterministicUnsupervisedDetector
52
+ ]
51
53
52
54
53
55
# ------------------------------------------------------------------------
@@ -56,6 +58,8 @@ using ScientificTypesBase
56
58
using StatisticalTraits
57
59
using Random
58
60
61
+ import StatisticalTraits: info
62
+
59
63
# ------------------------------------------------------------------------
60
64
# exports
61
65
@@ -64,6 +68,7 @@ export LightInterface, FullInterface
64
68
65
69
# model types
66
70
export MLJType, Model
71
+
67
72
for T in ABSTRACT_MODEL_SUBTYPES
68
73
@eval (export $ T)
69
74
end
89
94
90
95
# data operations
91
96
export matrix, int, classes, decoder, table,
92
- nrows, selectrows, selectcols, select
97
+ nrows, selectrows, selectcols, select, info
93
98
94
99
# equality
95
100
export is_same_except, isrepresented
96
101
97
102
# re-exports from ScientificTypesBase
98
103
export Scientific, Found, Unknown, Known, Finite, Infinite,
99
- OrderedFactor, Multiclass, Count, Continuous, Textual,
100
- Binary, ColorImage, GrayImage, Image, Table
101
- export scitype, scitype_union, elscitype, nonmissing, trait, info
104
+ OrderedFactor, Multiclass, Count, Continuous, Textual,
105
+ Binary, ColorImage, GrayImage, Image, Table, nonmissing
102
106
103
107
# ------------------------------------------------------------------------
104
108
# To be extended
105
109
106
110
import Base.==
107
111
import Base: in, isequal
108
- #
112
+
109
113
# ------------------------------------------------------------------------
110
114
# Mode trick
111
115
112
- abstract type Mode end
113
- struct LightInterface <: Mode end
114
- struct FullInterface <: Mode end
116
+ struct LightInterface end
117
+ struct FullInterface end
118
+
119
+ const Mode = Union{LightInterface, FullInterface}
115
120
116
121
const INTERFACE_MODE = Ref {Mode} (LightInterface ())
117
122
@@ -124,33 +129,33 @@ struct InterfaceError <: Exception
124
129
end
125
130
126
131
abstract type MLJType end
127
- abstract type Model <: MLJType end
132
+ abstract type Model <: MLJType end
128
133
129
134
# ------------------------------------------------------------------------
130
135
# Model subtypes
131
136
132
- abstract type Supervised <: Model end
133
- abstract type Unsupervised <: Model end
134
- abstract type Annotator <: Model end
137
+ abstract type Supervised <: Model end
138
+ abstract type Unsupervised <: Model end
139
+ abstract type Annotator <: Model end
135
140
136
141
abstract type Probabilistic <: Supervised end
137
142
abstract type Deterministic <: Supervised end
138
- abstract type Interval <: Supervised end
143
+ abstract type Interval <: Supervised end
139
144
140
145
abstract type JointProbabilistic <: Probabilistic end
141
146
142
- abstract type Static <: Unsupervised end
147
+ abstract type Static <: Unsupervised end
143
148
144
- abstract type SupervisedAnnotator <: Annotator end
149
+ abstract type SupervisedAnnotator <: Annotator end
145
150
abstract type UnsupervisedAnnotator <: Annotator end
146
151
147
152
abstract type UnsupervisedDetector <: UnsupervisedAnnotator end
148
- abstract type SupervisedDetector <: SupervisedAnnotator end
153
+ abstract type SupervisedDetector <: SupervisedAnnotator end
149
154
150
- abstract type ProbabilisticSupervisedDetector <: SupervisedDetector end
155
+ abstract type ProbabilisticSupervisedDetector <: SupervisedDetector end
151
156
abstract type ProbabilisticUnsupervisedDetector <: UnsupervisedDetector end
152
157
153
- abstract type DeterministicSupervisedDetector <: SupervisedDetector end
158
+ abstract type DeterministicSupervisedDetector <: SupervisedDetector end
154
159
abstract type DeterministicUnsupervisedDetector <: UnsupervisedDetector end
155
160
156
161
# ------------------------------------------------------------------------
@@ -164,5 +169,4 @@ include("model_def.jl")
164
169
include (" model_api.jl" )
165
170
include (" equality.jl" )
166
171
167
-
168
172
end # module
0 commit comments