Skip to content

Commit 6e06450

Browse files
authored
Merge pull request #127 from JuliaAI/dev
For a 1.3.4 release
2 parents 1bfe302 + fa98744 commit 6e06450

17 files changed

+839
-606
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name = "MLJModelInterface"
22
uuid = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
33
authors = ["Thibaut Lienart and Anthony Blaom"]
4-
version = "1.3.3"
4+
version = "1.3.4"
55

66
[deps]
77
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
88
ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161"
99
StatisticalTraits = "64bff920-2084-43da-a3e6-9bb72801c0c9"
1010

1111
[compat]
12-
ScientificTypesBase = "2.1"
13-
StatisticalTraits = "2.1"
12+
ScientificTypesBase = "3.0"
13+
StatisticalTraits = "3.0"
1414
julia = "1"
1515

1616
[extras]

src/MLJModelInterface.jl

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module MLJModelInterface
22

3-
const MODEL_TRAITS =
4-
[:input_scitype,
3+
const MODEL_TRAITS = [
4+
:input_scitype,
55
:output_scitype,
66
:target_scitype,
77
:fit_data_scitype,
@@ -29,25 +29,27 @@ const MODEL_TRAITS =
2929
:hyperparameter_ranges,
3030
:iteration_parameter,
3131
: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+
]
5153

5254

5355
# ------------------------------------------------------------------------
@@ -56,6 +58,8 @@ using ScientificTypesBase
5658
using StatisticalTraits
5759
using Random
5860

61+
import StatisticalTraits: info
62+
5963
# ------------------------------------------------------------------------
6064
# exports
6165

@@ -64,6 +68,7 @@ export LightInterface, FullInterface
6468

6569
# model types
6670
export MLJType, Model
71+
6772
for T in ABSTRACT_MODEL_SUBTYPES
6873
@eval(export $T)
6974
end
@@ -89,29 +94,29 @@ end
8994

9095
# data operations
9196
export matrix, int, classes, decoder, table,
92-
nrows, selectrows, selectcols, select
97+
nrows, selectrows, selectcols, select, info
9398

9499
# equality
95100
export is_same_except, isrepresented
96101

97102
# re-exports from ScientificTypesBase
98103
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
102106

103107
# ------------------------------------------------------------------------
104108
# To be extended
105109

106110
import Base.==
107111
import Base: in, isequal
108-
#
112+
109113
# ------------------------------------------------------------------------
110114
# Mode trick
111115

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}
115120

116121
const INTERFACE_MODE = Ref{Mode}(LightInterface())
117122

@@ -124,33 +129,33 @@ struct InterfaceError <: Exception
124129
end
125130

126131
abstract type MLJType end
127-
abstract type Model <: MLJType end
132+
abstract type Model <: MLJType end
128133

129134
# ------------------------------------------------------------------------
130135
# Model subtypes
131136

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
135140

136141
abstract type Probabilistic <: Supervised end
137142
abstract type Deterministic <: Supervised end
138-
abstract type Interval <: Supervised end
143+
abstract type Interval <: Supervised end
139144

140145
abstract type JointProbabilistic <: Probabilistic end
141146

142-
abstract type Static <: Unsupervised end
147+
abstract type Static <: Unsupervised end
143148

144-
abstract type SupervisedAnnotator <: Annotator end
149+
abstract type SupervisedAnnotator <: Annotator end
145150
abstract type UnsupervisedAnnotator <: Annotator end
146151

147152
abstract type UnsupervisedDetector <: UnsupervisedAnnotator end
148-
abstract type SupervisedDetector <: SupervisedAnnotator end
153+
abstract type SupervisedDetector <: SupervisedAnnotator end
149154

150-
abstract type ProbabilisticSupervisedDetector <: SupervisedDetector end
155+
abstract type ProbabilisticSupervisedDetector <: SupervisedDetector end
151156
abstract type ProbabilisticUnsupervisedDetector <: UnsupervisedDetector end
152157

153-
abstract type DeterministicSupervisedDetector <: SupervisedDetector end
158+
abstract type DeterministicSupervisedDetector <: SupervisedDetector end
154159
abstract type DeterministicUnsupervisedDetector <: UnsupervisedDetector end
155160

156161
# ------------------------------------------------------------------------
@@ -164,5 +169,4 @@ include("model_def.jl")
164169
include("model_api.jl")
165170
include("equality.jl")
166171

167-
168172
end # module

0 commit comments

Comments
 (0)