Skip to content

Commit 76a3df8

Browse files
committed
doc tweaks
1 parent 7f1d537 commit 76a3df8

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

docs/src/index.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,15 @@ then overloading `obs` is completely optional. Plain iteration interfaces, with
9292
knowledge of the number of observations, can also be specified (to support, e.g., data
9393
loaders reading images from disk).
9494

95-
## Hooks for adding functionality
96-
97-
A key to enabling toolboxes to enhance LearnAPI.jl algorithm functionality is the
98-
implementation of two key additional methods, beyond the usual `fit` and
99-
`predict`/`transform`. Given any training `data` consumed by `fit` (such as `data = (X,
100-
y)` in the example above) [`LearnAPI.features(algorithm, data)`](@ref input) tells us what
101-
part of `data` comprises *features*, which is something that can be passed onto to
102-
`predict` or `transform` (`X` in the example) while [`LearnAPI.target(algorithm,
103-
data)`](@ref), if implemented, tells us what part comprises the target (`y` in the
104-
example). By explicitly requiring such methods, we free algorithms to consume data in
105-
multiple forms, including optimised, algorithm-specific forms, as described above.
95+
## Hooks adding algorithm-generic functonality
96+
97+
Given any training `data` consumed by `fit` (such as `data = (X, y)` in the example above)
98+
[`LearnAPI.features(algorithm, data)`](@ref input) tells us what part of `data` comprises
99+
*features*, which is something that can be passed onto to `predict` or `transform` (`X` in
100+
the example) while [`LearnAPI.target(algorithm, data)`](@ref), if implemented, tells us
101+
what part comprises the target (`y` in the example). By explicitly requiring such methods,
102+
LearnAPI.jl frees algorithms to consume data in multiple forms, including optimised,
103+
algorithm-specific forms, as described above.
106104

107105
## Learning more
108106

src/fit_update.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ overloaded to return `true`.
3636
3737
The signature must include `verbosity`.
3838
39+
If `data` encapsulates a *target* variable, as defined in LearnAPI.jl documentation, then
40+
[`LearnAPI.target(data)`] must be overloaded to return it. If [`predict`](@ref) or
41+
[`transform`](@ref) are implemented and consume data, then
42+
[`LearnAPI.features(data)`](@ref) must return something that can be passed as data to
43+
these methods. A fallback returns `first(data)` if `data` is a tuple, and `data`
44+
otherwise`.
45+
3946
The LearnAPI.jl specification has nothing to say regarding `fit` signatures with more than
4047
two arguments. For convenience, for example, an algorithm is free to implement a slurping
4148
signature, such as `fit(algorithm, X, y, extras...) = fit(algorithm, (X, y, extras...))` but

0 commit comments

Comments
 (0)