diff --git a/docs/src/anatomy_of_an_implementation.md b/docs/src/anatomy_of_an_implementation.md index 3c4bb757..d9ef3e68 100644 --- a/docs/src/anatomy_of_an_implementation.md +++ b/docs/src/anatomy_of_an_implementation.md @@ -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: diff --git a/docs/src/list_of_public_names.md b/docs/src/list_of_public_names.md index f0359508..71069abd 100644 --- a/docs/src/list_of_public_names.md +++ b/docs/src/list_of_public_names.md @@ -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 diff --git a/docs/src/predict_transform.md b/docs/src/predict_transform.md index a7db8251..1f336767 100644 --- a/docs/src/predict_transform.md +++ b/docs/src/predict_transform.md @@ -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`: diff --git a/docs/src/reference.md b/docs/src/reference.md index 6cf6285d..acc5cd27 100644 --- a/docs/src/reference.md +++ b/docs/src/reference.md @@ -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. @@ -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) diff --git a/src/fit_update.jl b/src/fit_update.jl index ab7f3ff8..8cbeecca 100644 --- a/src/fit_update.jl +++ b/src/fit_update.jl @@ -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. @@ -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). diff --git a/src/traits.jl b/src/traits.jl index 4fefee7a..848b821f 100644 --- a/src/traits.jl +++ b/src/traits.jl @@ -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()