Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/src/anatomy_of_an_implementation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Anatomy of an Implementation

This section is a tutorial for developers wanting to implement the LearnAPI.jl interface
for their machine learning / statistical algorithms.

LearnAPI.jl supports three core patterns. The default pattern, known as the
[`LearnAPI.Descriminative`](@ref) pattern, looks like this:

Expand Down
4 changes: 3 additions & 1 deletion docs/src/list_of_public_names.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ See [here](@ref proxy_types).

- [`@trait`](@ref): for simultaneously declaring multiple traits

- [`@functions`](@ref): for listing functions available for use with a learner
- [`@functions`](@ref): for listing functions available for use with a learner

- [`LearnAPI.default_verbosity`](@ref): setter/getter for the default verbosity level
2 changes: 1 addition & 1 deletion docs/src/predict_transform.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The above signatures apply in the case that [`LearnAPI.kind_of(learner)`](@ref)
returns [`LearnAPI.Generative()`](@ref), as in [density
estimation](@ref density_estimation).

## [Typical worklows](@id predict_workflow)
## [Typical workflows](@id predict_workflow)

Train some supervised `learner`:

Expand Down
12 changes: 7 additions & 5 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,18 @@ generally requires overloading `Base.==` for the struct.
!!! important

No LearnAPI.jl method is permitted to mutate a learner. In particular, one should make
deep copies of RNG hyperparameters before using them in an implementation of
[`fit`](@ref).
copies of RNG hyperparameters before using them in an implementation of
[`fit`](@ref). (Do not make *deep* copies as this leads to wrong behavior in the case
of `Random.default_rng()`, which not an actual RNG but only a pointer to the task-local
default RNG.)


#### Kinds of learner

As previewed in [Anatomy of an Implementation](@ref), different
`fit`/`predict`/`transform` patterns lead to a division of learners into three distinct
kinds, [`LearnAPI.Descriminative()`](@ref), [`LearnAPI.Generative`](@ref), and
[`LearnAPI.Static`](@ref), which is detailed [here](@ref kinds_of_learner). See also
kinds, [`LearnAPI.Descriminative()`](@ref), [`LearnAPI.Generative()`](@ref), and
[`LearnAPI.Static()`](@ref), which is detailed [here](@ref kinds_of_learner). See also
[these workflows](@ref fit_workflows) for concrete examples.


Expand Down Expand Up @@ -190,7 +192,7 @@ Most learners will also implement [`predict`](@ref) and/or [`transform`](@ref).
proxies](@ref proxy) (such as probability density functions)

- [`transform`](@ref operations): similar to `predict`, but for arbitrary kinds of output,
and which can be paired with an `inverse_transform` method
and which can be optionally paired with an `inverse_transform` method

- [`inverse_transform`](@ref operations): for inverting the output of
`transform` ("inverting" broadly understood)
Expand Down
10 changes: 5 additions & 5 deletions src/fit_update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ model = fit(learner, data)
model = update_observations(model, new_data, epochs => 12, learning_rate => 0.1)
```

When following the call `fit(learner, data)`, the `update` call is semantically
equivalent to retraining ab initio using a concatenation of `data` and `new_data`,
When following the call `fit(learner, data)`, the `update` call is semantically equivalent
to retraining ab initio using an observation-wise concatenation of `data` and `new_data`,
*provided there are no hyperparameter replacements* (which rules out the example
above). Behaviour is otherwise learner-specific.

Expand Down Expand Up @@ -178,9 +178,9 @@ Return an updated version of the `model` object returned by a previous [`fit`](@
`update` call given the new features encapsulated in `new_data`. One may additionally
specify hyperparameter replacements in the form `:p1 => value1, :p2 => value2, ...`.

When following the call `fit(learner, data)`, the `update` call is semantically
equivalent to retraining ab initio using a concatenation of `data` and `new_data`,
*provided there are no hyperparameter replacements.* Behaviour is otherwise
When following the call `fit(learner, data)`, the `update_features` call is semantically
equivalent to retraining ab initio using a feature-wise concatenation of `data` and
`new_data`, *provided there are no hyperparameter replacements.* Behaviour is otherwise
learner-specific.

See also [`fit`](@ref), [`update`](@ref), [`update_features`](@ref).
Expand Down
2 changes: 1 addition & 1 deletion src/traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Return the `fit`/`predict`/`transform` signature pattern used by `learner`. See

# New implementations

The fallback value is [`LearnAPI.Descriminative()`].
The fallback value is [`LearnAPI.Descriminative()`](@ref).

"""
kind_of(learner) = Descriminative()
Expand Down
Loading