44- [ Supervised classifiers] ( @ref )
55- [ Transformers] ( @ref )
66
7- Refer to the front end [docstrings](@ref front_ends) for options ignored below.
7+ Refer to the front end [ docstrings] (@ref front_ends) for options ignored below.
88
99## Supervised regressors
1010
@@ -31,35 +31,35 @@ Your [`LearnAPI.fit`](@ref) implementation will then look like this:
3131
3232``` julia
3333function LearnAPI. fit (
34- learner:: MyLearner ,
35- observations:: Obs ;
36- verbosity= 1 ,
37- )
38- X = observations. features # p x n matrix
39- y = observations. target # n-vector (use `Saffron(multitarget=true)` for matrix)
40- feature_names = observations. names
34+ learner:: MyLearner ,
35+ observations:: Obs ;
36+ verbosity= 1 ,
37+ )
38+ X = observations. features # p x n matrix
39+ y = observations. target # n-vector (use `Saffron(multitarget=true)` for matrix)
40+ feature_names = observations. names
4141
42- # do stuff with `X`, `y` and `feature_names`:
43- ...
42+ # do stuff with `X`, `y` and `feature_names`:
43+ ...
4444
4545end
4646LearnAPI. fit (learner:: MyLearner , data; kwargs... ) =
47- LearnAPI. fit (learner, LearnAPI. obs (learner, data); kwargs... )
47+ LearnAPI. fit (learner, LearnAPI. obs (learner, data); kwargs... )
4848```
4949
5050For each [ ` KindOfProxy ` ] ( @ref ) subtype ` K ` to be supported (e.g., ` Point ` ), your
5151[ ` LearnAPI.predict ` ] ( @ref ) implementation(s) will look like this:
5252
5353``` julia
5454function LearnAPI. predict (model:: MyModel , :K , observations:: Obs )
55- X = observations. features # p x n matrix
56- names = observations. names # if really needed
55+ X = observations. features # p x n matrix
56+ names = observations. names # if really needed
5757
58- # do stuff with `X`:
59- ...
58+ # do stuff with `X`:
59+ ...
6060end
6161LearnAPI. predict (model:: MyModel , kind_of_proxy, X) =
62- LearnAPI. predict (model, kind_of_proxy, obs (model, X))
62+ LearnAPI. predict (model, kind_of_proxy, obs (model, X))
6363```
6464
6565## Supervised classifiers
@@ -94,13 +94,13 @@ function LearnAPI.fit(
9494 X = observations. features # p x n matrix
9595 y = observations. target # n-vector
9696 decoder = observations. decoder
97- classes_seen = observatioins . classes_seen
97+ levels_seen = observations . levels_seen
9898 feature_names = observations. names
9999
100100 # do stuff with `X`, `y` and `feature_names`:
101- # return a `model` object which also stores the `decoder` and/or `classes_seen `
102- # to make them available to `predict`.
103- ...
101+ # return a `model` object which also stores the `decoder` and/or `levels_seen `
102+ # to make them available to `predict`.
103+ ...
104104end
105105LearnAPI. fit (learner:: MyLearner , data; kwargs... ) =
106106 LearnAPI. fit (learner, LearnAPI. obs (learner, data); kwargs... )
@@ -116,10 +116,10 @@ function LearnAPI.predict(model::MyModel, :K, observations::Obs)
116116
117117 # Do stuff with `X` and `model` to obtain raw `predictions` (a vector of integer
118118 # codes for `K = Point`, or an `n x c` matrix of probabilities for `K = Distribution`).
119- # Extract `decoder` or `classes_seen ` from `model`.
119+ # Extract `decoder` or `levels_seen ` from `model`.
120120 # For `K = Point`, return `decoder.(predictions)`.
121121 # For `K = Distribution`, return, say,
122- # `CategoricalDistributions.Univariate(classes_seen , predictions)`.
122+ # `CategoricalDistributions.Univariate(levels_seen , predictions)`.
123123 ...
124124end
125125LearnAPI. predict (model:: MyModel , kind_of_proxy, X) = LearnAPI. predict (model,
@@ -152,29 +152,29 @@ Your [`LearnAPI.fit`](@ref) implementation will then look like this:
152152
153153``` julia
154154function LearnAPI. fit (
155- learner:: MyLearner ,
156- observations:: Obs ;
157- verbosity= 1 ,
158- )
159- x = observations. features # p x n matrix
160- feature_names = observations. names
161-
162- # do stuff with `x` and `feature_names`:
163- ...
155+ learner:: MyLearner ,
156+ observations:: Obs ;
157+ verbosity= 1 ,
158+ )
159+ x = observations. features # p x n matrix
160+ feature_names = observations. names
161+
162+ # do stuff with `x` and `feature_names`:
163+ ...
164164end
165165LearnAPI. fit (learner:: MyLearner , data; kwargs... ) =
166- LearnAPI. fit (learner, LearnAPI. obs (learner, data); kwargs... )
166+ LearnAPI. fit (learner, LearnAPI. obs (learner, data); kwargs... )
167167```
168168
169169Your [ ` LearnAPI.transform ` ] ( @ref ) implementation will look like this:
170170
171171``` julia
172172function LearnAPI. transform (model:: MyModel , observations:: Obs )
173- x = observations. features # p x n matrix
174- feature_names = observations. names # if really needed
173+ x = observations. features # p x n matrix
174+ feature_names = observations. names # if really needed
175175
176- # do stuff with `x`:
177- ...
176+ # do stuff with `x`:
177+ ...
178178end
179179LearnAPI. transform (model:: MyModel , X) = LearnAPI. transform (model, obs (model, X))
180180```
0 commit comments