Skip to content

Commit cdcecad

Browse files
committed
put all abstract Model subtypes into a list for better downstream maintenance
oops
1 parent 687ac7f commit cdcecad

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/MLJModelInterface.jl

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ const MODEL_TRAITS = [
2626
:supports_training_losses,
2727
:deep_properties]
2828

29+
const ABSTRACT_MODEL_SUBTYPES =
30+
[:Supervised,
31+
:Unsupervised,
32+
:Probabilistic,
33+
:Deterministic,
34+
:Interval,
35+
:JointProbabilistic,
36+
:Static]
37+
2938
# ------------------------------------------------------------------------
3039
# Dependencies
3140
using ScientificTypesBase
@@ -38,10 +47,13 @@ using Random
3847
# mode
3948
export LightInterface, FullInterface
4049

41-
# MLJ model hierarchy
42-
export MLJType, Model, Supervised, Unsupervised,
43-
Probabilistic, JointProbabilistic, Deterministic, Interval, Static,
44-
UnivariateFinite
50+
# model types
51+
export MLJType, Model
52+
for T in ABSTRACT_MODEL_SUBTYPES
53+
@eval(export $T)
54+
end
55+
56+
export UnivariateFinite
4557

4658
# parameter_inspection:
4759
export params
@@ -95,13 +107,12 @@ struct InterfaceError <: Exception
95107
m::String
96108
end
97109

98-
# ------------------------------------------------------------------------
99-
# Model types
100-
101110
abstract type MLJType end
102-
103111
abstract type Model <: MLJType end
104112

113+
# ------------------------------------------------------------------------
114+
# Model subtypes
115+
105116
abstract type Supervised <: Model end
106117
abstract type Unsupervised <: Model end
107118

0 commit comments

Comments
 (0)