Skip to content

Commit 8360ad4

Browse files
committed
doc tweaks
1 parent a33bea4 commit 8360ad4

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

docs/src/index.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ A base Julia interface for machine learning and statistics </span>
99
<br>
1010
```
1111

12-
LearnAPI.jl is a lightweight, functional-style interface, providing a
13-
collection of [methods](@ref Methods), such as `fit` and `predict`, to be implemented by
14-
algorithms from machine learning and statistics. Through such implementations, these
15-
algorithms buy into functionality, such as hyperparameter optimization and model
16-
composition, as provided by ML/statistics toolboxes and other packages. LearnAPI.jl also
17-
provides a number of Julia [traits](@ref traits) for promising specific behavior.
12+
LearnAPI.jl is a lightweight, functional-style interface, providing a collection of
13+
[methods](@ref Methods), such as `fit` and `predict`, to be implemented by algorithms from
14+
machine learning and statistics. Its careful design ensures algorithms implementing
15+
LearnAPI.jl can buy into functionality, such as external performance estimates,
16+
hyperparameter optimization and model composition, provided by ML/statistics toolboxes and
17+
other packages. LearnAPI.jl includes a number of Julia [traits](@ref traits) for promising
18+
specific behavior.
1819

1920
LearnAPI.jl's only dependency is the standard library `InteractiveUtils`.
2021

@@ -91,6 +92,18 @@ then overloading `obs` is completely optional. Plain iteration interfaces, with
9192
knowledge of the number of observations, can also be specified (to support, e.g., data
9293
loaders reading images from disk).
9394

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 passsed 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.
106+
94107
## Learning more
95108

96109
- [Anatomy of an Implementation](@ref): informal introduction to the main actors in a new

docs/src/obs.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ end
7777

7878
## Implementation guide
7979

80-
| method | compulsory? | fallback |
81-
|:----------------------------------------|:-----------:|:--------------:|
82-
| [`obs(algorithm_or_model, data)`](@ref) | depends | returns `data` |
83-
| | | |
80+
| method | comment | compulsory? | fallback |
81+
|:-------------------------------|:------------------------------------|:-------------:|:---------------|
82+
| [`obs(algorithm, data)`](@ref) | here `data` is `fit`-consumable | not typically | returns `data` |
83+
| [`obs(model, data)`](@ref) | here `data` is `predict`-consumable | not typically | returns `data` |
84+
8485

8586
A sample implementation is given in [Providing an advanced data interface](@ref).
8687

docs/src/predict_transform.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ instead, which does not dispatch on [`LearnAPI.KindOfProxy`](@ref), but can be o
7272
paired with an implementation of [`inverse_transform`](@ref), for returning (approximate)
7373
right inverses to `transform`.
7474

75+
Of course, the one algorithm can implement both a `predict` and `transform` method. For
76+
example a K-means clustering algorithm can `predict` labels and `transform` to reduce
77+
dimension using distances from the cluster centres.
78+
7579

7680
### [One-liners combining fit and transform/predict](@id one_liners)
7781

src/obs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Return an algorithm-specific representation of `data`, suitable for passing to `
88
algorithm, `algorithm`.
99
1010
The returned object is guaranteed to implement observation access as indicated by
11-
[`LearnAPI.data_interface(algorithm)`](@ref) (typically
12-
[`LearnAPI.RandomAccess()`](@ref)).
11+
[`LearnAPI.data_interface(algorithm)`](@ref), typically
12+
[`LearnAPI.RandomAccess()`](@ref).
1313
1414
Calling `fit`/`predict`/`transform` on the returned objects may have performance
1515
advantages over calling directly on `data` in some contexts. And resampling the returned

0 commit comments

Comments
 (0)