8
8
> returning the absolute values of the linear coefficients. The ridge regressor has a
9
9
> target variable and outputs literal predictions of the target (rather than, say,
10
10
> probabilistic predictions); accordingly the overloaded ` predict ` method is dispatched on
11
- > the ` TrueTarget ` subtype of ` KindOfProxy ` . An ** algorithm trait** declares this type as the
11
+ > the ` LiteralTarget ` subtype of ` KindOfProxy ` . An ** algorithm trait** declares this type as the
12
12
> preferred kind of target proxy. Other traits articulate the algorithm's training data type
13
13
> requirements and the input/output type of ` predict ` .
14
14
@@ -110,7 +110,7 @@ level API, using those traits.
110
110
Now we need a method for predicting the target on new input features:
111
111
112
112
``` @example anatomy
113
- function LearnAPI.predict(::MyRidge, ::LearnAPI.TrueTarget , fitted_params, Xnew)
113
+ function LearnAPI.predict(::MyRidge, ::LearnAPI.LiteralTarget , fitted_params, Xnew)
114
114
Xmatrix = Tables.matrix(Xnew)
115
115
report = nothing
116
116
return Xmatrix*fitted_params.coefficients, report
@@ -119,7 +119,7 @@ nothing # hide
119
119
```
120
120
121
121
The second argument of ` predict ` is always an instance of ` KindOfProxy ` , and will always
122
- be ` TrueTarget ()` in this case, as only literal values of the target (rather than, say
122
+ be ` LiteralTarget ()` in this case, as only literal values of the target (rather than, say
123
123
probabilistic predictions) are being supported.
124
124
125
125
In some algorithms ` predict ` computes something of interest in addition to the target
@@ -159,13 +159,13 @@ list). Accordingly, we are required to declare a preferred target proxy, which w
159
159
[ ` LearnAPI.preferred_kind_of_proxy ` ] ( @ref ) :
160
160
161
161
``` @example anatomy
162
- LearnAPI.preferred_kind_of_proxy(::Type{<:MyRidge}) = LearnAPI.TrueTarget ()
162
+ LearnAPI.preferred_kind_of_proxy(::Type{<:MyRidge}) = LearnAPI.LiteralTarget ()
163
163
nothing # hide
164
164
```
165
165
Or, you can use the shorthand
166
166
167
167
``` @example anatomy
168
- @trait MyRidge preferred_kind_of_proxy=LearnAPI.TrueTarget ()
168
+ @trait MyRidge preferred_kind_of_proxy=LearnAPI.LiteralTarget ()
169
169
nothing # hide
170
170
```
171
171
@@ -307,7 +307,7 @@ feature_importances(algorithm, fitted_params, fit_report)
307
307
Make a prediction using new data:
308
308
309
309
``` @example anatomy
310
- yhat, predict_report = predict(algorithm, LearnAPI.TrueTarget (), fitted_params, X[test])
310
+ yhat, predict_report = predict(algorithm, LearnAPI.LiteralTarget (), fitted_params, X[test])
311
311
```
312
312
313
313
Compare predictions with ground truth
0 commit comments