@@ -53,27 +53,35 @@ expectiles at 50% will provide `Point` instead.
53
53
"""
54
54
abstract type IID <: KindOfProxy end
55
55
56
- struct Point <: IID end
57
- struct Sampleable <: IID end
58
- struct Distribution <: IID end
59
- struct LogDistribution <: IID end
60
- struct Probability <: IID end
61
- struct LogProbability <: IID end
62
- struct Parametric <: IID end
63
- struct LabelAmbiguous <: IID end
64
- struct LabelAmbiguousSampleable <: IID end
65
- struct LabelAmbiguousDistribution <: IID end
66
- struct LabelAmbiguousFuzzy <: IID end
67
- struct ConfidenceInterval <: IID end
68
- struct Fuzzy <: IID end
69
- struct ProbabilisticFuzzy <: IID end
70
- struct SurvivalFunction <: IID end
71
- struct SurvivalDistribution <: IID end
72
- struct HazardFunction <: IID end
73
- struct OutlierScore <: IID end
74
- struct Continuous <: IID end
75
- struct Quantile <: IID end
76
- struct Expectile <: IID end
56
+ const IID_SYMBOLS = [
57
+ :Point ,
58
+ :Sampleable ,
59
+ :Distribution ,
60
+ :LogDistribution ,
61
+ :Probability ,
62
+ :LogProbability ,
63
+ :Parametric ,
64
+ :LabelAmbiguous ,
65
+ :LabelAmbiguousSampleable ,
66
+ :LabelAmbiguousDistribution ,
67
+ :LabelAmbiguousFuzzy ,
68
+ :ConfidenceInterval ,
69
+ :Fuzzy ,
70
+ :ProbabilisticFuzzy ,
71
+ :SurvivalFunction ,
72
+ :SurvivalDistribution ,
73
+ :HazardFunction ,
74
+ :OutlierScore ,
75
+ :Continuous ,
76
+ :Quantile ,
77
+ :Expectile ,
78
+ ]
79
+
80
+ for S in IID_SYMBOLS
81
+ quote
82
+ struct $ S <: IID end
83
+ end |> eval
84
+ end
77
85
78
86
79
87
"""
@@ -92,9 +100,18 @@ space ``Y^n``, where ``Y`` is the space from which the target variable takes its
92
100
93
101
"""
94
102
abstract type Joint <: KindOfProxy end
95
- struct JointSampleable <: Joint end
96
- struct JointDistribution <: Joint end
97
- struct JointLogDistribution <: Joint end
103
+
104
+ const JOINT_SYMBOLS = [
105
+ :JointSampleable ,
106
+ :JointDistribution ,
107
+ :JointLogDistribution ,
108
+ ]
109
+
110
+ for S in JOINT_SYMBOLS
111
+ quote
112
+ struct $ S <: Joint end
113
+ end |> eval
114
+ end
98
115
99
116
"""
100
117
Single <: KindOfProxy
@@ -114,32 +131,24 @@ single object representing a probability distribution.
114
131
115
132
"""
116
133
abstract type Single <: KindOfProxy end
117
- struct SingleSampeable <: Single end
118
- struct SingleDistribution <: Single end
119
- struct SingleLogDistribution <: Single end
120
-
121
- const CONCRETE_TARGET_PROXY_TYPES = [
122
- subtypes (IID)... ,
123
- subtypes (Single)... ,
124
- subtypes (Joint)... ,
134
+
135
+ const SINGLE_SYMBOLS = [
136
+ :SingleSampeable ,
137
+ :SingleDistribution ,
138
+ :SingleLogDistribution ,
125
139
]
126
140
127
- const CONCRETE_TARGET_PROXY_TYPES_SYMBOLS = map (CONCRETE_TARGET_PROXY_TYPES) do T
128
- Symbol (last (split (string (T), ' .' )))
141
+ for S in SINGLE_SYMBOLS
142
+ quote
143
+ struct $ S <: Single end
144
+ end |> eval
129
145
end
130
146
131
- const CONCRETE_TARGET_PROXY_TYPES_LIST = join (
132
- map (CONCRETE_TARGET_PROXY_TYPES_SYMBOLS) do s
133
- " `$s ()`"
134
- end ,
135
- " , " ,
136
- " and " ,
137
- )
138
-
139
- const DOC_HOW_TO_LIST_PROXIES =
140
- " The instances of [`LearnAPI.KindOfProxy`](@ref) are: " *
141
- " $(LearnAPI. CONCRETE_TARGET_PROXY_TYPES_LIST) . "
142
-
147
+ const CONCRETE_TARGET_PROXY_SYMBOLS = [
148
+ IID_SYMBOLS... ,
149
+ SINGLE_SYMBOLS... ,
150
+ JOINT_SYMBOLS... ,
151
+ ]
143
152
144
153
"""
145
154
@@ -151,12 +160,25 @@ the form of target predictions in [`predict`](@ref) calls.
151
160
152
161
See LearnAPI.jl documentation for an explanation of "targets" and "target proxies".
153
162
154
- For example, `Distribution` is a concrete subtype of `LearnAPI.KindOfProxy` and a call
155
- like `predict(model, Distribution(), Xnew)` returns a data object whose observations are
156
- probability density/mass functions, assuming `learner` supports predictions of that
157
- form.
163
+ For example, `Distribution` is a concrete subtype of `IID <: LearnAPI.KindOfProxy` and a
164
+ call like `predict(model, Distribution(), Xnew)` returns a data object whose observations
165
+ are probability density/mass functions, assuming `learner = LearnAPI.learner(model)`
166
+ supports predictions of that form, which is true if `Distribution() in`
167
+ [`LearnAPI.kinds_of_proxy(learner)`](@ref).
168
+
169
+ Proxy types are grouped under three abstract subtypes:
170
+
171
+ - [`LearnAPI.IID`](@ref): The main type, for proxies consisting of uncorrelated individual
172
+ components, one for each input observation
173
+
174
+ - [`LearnAPI.Joint`](@ref): For learners that predict a single probabilistic structure
175
+ encapsulating correlations between target predictions for different input observations
176
+
177
+ - [`LearnAPI.Single`](@ref): For learners, such as density estimators, that are trained on
178
+ a target variable only (no features); `predict` consumes no data and the returned target
179
+ proxy is a single probabilistic structure.
158
180
159
- $DOC_HOW_TO_LIST_PROXIES
181
+ For lists of all concrete instances, refer to documentation for the relevant subtype.
160
182
161
183
"""
162
184
KindOfProxy
0 commit comments