Skip to content

Commit 66b7962

Browse files
authored
Merge pull request #199 from JuliaAI/dev
Generate new documentation. No new release
2 parents c8e2599 + 61a7240 commit 66b7962

22 files changed

+316
-304
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A light-weight interface for developers wanting to integrate
44
machine learning models into
5-
[MLJ](https://github.com/alan-turing-institute/MLJ.jl).
5+
[MLJ](https://github.com/JuliaAI/MLJ.jl).
66

77

88
| Linux | Coverage |
@@ -12,8 +12,8 @@ machine learning models into
1212
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaai.github.io/MLJModelInterface.jl/dev/)
1313

1414

15-
[MLJ](https://alan-turing-institute.github.io/MLJ.jl/dev/) is a framework for evaluating,
15+
[MLJ](https://JuliaAI.github.io/MLJ.jl/dev/) is a framework for evaluating,
1616
combining and optimizing machine learning models in Julia. A third party package wanting
1717
to integrate their machine learning models into MLJ must import the module
1818
`MLJModelInterface` defined in this package, as described in the
19-
[documentation](https://juliaai.github.io/MLJModelInterface.jl/dev/).
19+
[documentation](https://JuliaAI.github.io/MLJModelInterface.jl/dev/).

docs/src/document_strings.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,39 @@ Your document string must include the following components, in order:
2929
implementation. Generally, defer details on the role of
3030
hyperparameters to the "Hyperparameters" section (see below).
3131

32-
- Instructions on *how to import the model type* from MLJ (because a user can already inspect the doc-string in the Model Registry, without having loaded the code-providing package).
32+
- Instructions on *how to import the model type* from MLJ (because a user can
33+
already inspect the doc-string in the Model Registry, without having loaded
34+
the code-providing package).
3335

3436
- Instructions on *how to instantiate* with default hyperparameters or with keywords.
3537

36-
- A *Training data* section: explains how to bind a model to data in a machine with all possible signatures (eg, `machine(model, X, y)` but also `machine(model, X, y, w)` if, say, weights are supported); the role and scitype requirements for each data argument should be itemized.
38+
- A *Training data* section: explains how to bind a model to data in a machine
39+
with all possible signatures (eg, `machine(model, X, y)` but also
40+
`machine(model, X, y, w)` if, say, weights are supported); the role and
41+
scitype requirements for each data argument should be itemized.
3742

3843
- Instructions on *how to fit* the machine (in the same section).
3944

4045
- A *Hyperparameters* section (unless there aren't any): an itemized list of the parameters, with defaults given.
4146

42-
- An *Operations* section: each implemented operation (`predict`, `predict_mode`, `transform`, `inverse_transform`, etc ) is itemized and explained. This should include operations with no data arguments, such as `training_losses` and `feature_importances`.
47+
- An *Operations* section: each implemented operation (`predict`,
48+
`predict_mode`, `transform`, `inverse_transform`, etc ) is itemized and
49+
explained. This should include operations with no data arguments, such as
50+
`training_losses` and `feature_importances`.
4351

44-
- A *Fitted parameters* section: To explain what is returned by `fitted_params(mach)` (the same as `MLJModelInterface.fitted_params(model, fitresult)` - see later) with the fields of that named tuple itemized.
52+
- A *Fitted parameters* section: To explain what is returned by `fitted_params(mach)`
53+
(the same as `MLJModelInterface.fitted_params(model, fitresult)` - see later)
54+
with the fields of that named tuple itemized.
4555

46-
- A *Report* section (if `report` is non-empty): To explain what, if anything, is included in the `report(mach)` (the same as the `report` return value of `MLJModelInterface.fit`) with the fields itemized.
56+
- A *Report* section (if `report` is non-empty): To explain what, if anything,
57+
is included in the `report(mach)` (the same as the `report` return value of
58+
`MLJModelInterface.fit`) with the fields itemized.
4759

48-
- An optional but highly recommended *Examples* section, which includes MLJ examples, but which could also include others if the model type also implements a second "local" interface, i.e., defined in the same module. (Note that each module referring to a type can declare separate doc-strings which appear concatenated in doc-string queries.)
60+
- An optional but highly recommended *Examples* section, which includes MLJ
61+
examples, but which could also include others if the model type also
62+
implements a second "local" interface, i.e., defined in the same module. (Note
63+
that each module referring to a type can declare separate doc-strings which
64+
appear concatenated in doc-string queries.)
4965

5066
- A closing *"See also"* sentence which includes a `@ref` link to the raw model type (if you are wrapping one).
5167

docs/src/implementing_a_data_front_end.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,30 +84,34 @@ Suppose a supervised model type `SomeSupervised` supports sample
8484
weights, leading to two different `fit` signatures, and that it has a
8585
single operation `predict`:
8686

87-
fit(model::SomeSupervised, verbosity, X, y)
88-
fit(model::SomeSupervised, verbosity, X, y, w)
87+
```julia
88+
fit(model::SomeSupervised, verbosity, X, y)
89+
fit(model::SomeSupervised, verbosity, X, y, w)
8990

90-
predict(model::SomeSupervised, fitresult, Xnew)
91+
predict(model::SomeSupervised, fitresult, Xnew)
92+
```
9193

9294
Without a data front-end implemented, suppose `X` is expected to be a
9395
table and `y` a vector, but suppose the core algorithm always converts
9496
`X` to a matrix with features as rows (each record corresponds to
9597
a column in the table). Then a new data-front end might look like
9698
this:
9799

98-
constant MMI = MLJModelInterface
99-
100-
# for fit:
101-
MMI.reformat(::SomeSupervised, X, y) = (MMI.matrix(X)', y)
102-
MMI.reformat(::SomeSupervised, X, y, w) = (MMI.matrix(X)', y, w)
103-
MMI.selectrows(::SomeSupervised, I, Xmatrix, y) =
104-
(view(Xmatrix, :, I), view(y, I))
105-
MMI.selectrows(::SomeSupervised, I, Xmatrix, y, w) =
106-
(view(Xmatrix, :, I), view(y, I), view(w, I))
107-
108-
# for predict:
109-
MMI.reformat(::SomeSupervised, X) = (MMI.matrix(X)',)
110-
MMI.selectrows(::SomeSupervised, I, Xmatrix) = (view(Xmatrix, :, I),)
100+
```julia
101+
constant MMI = MLJModelInterface
102+
103+
# for fit:
104+
MMI.reformat(::SomeSupervised, X, y) = (MMI.matrix(X)', y)
105+
MMI.reformat(::SomeSupervised, X, y, w) = (MMI.matrix(X)', y, w)
106+
MMI.selectrows(::SomeSupervised, I, Xmatrix, y) =
107+
(view(Xmatrix, :, I), view(y, I))
108+
MMI.selectrows(::SomeSupervised, I, Xmatrix, y, w) =
109+
(view(Xmatrix, :, I), view(y, I), view(w, I))
110+
111+
# for predict:
112+
MMI.reformat(::SomeSupervised, X) = (MMI.matrix(X)',)
113+
MMI.selectrows(::SomeSupervised, I, Xmatrix) = (view(Xmatrix, :, I),)
114+
```
111115

112116
With these additions, `fit` and `predict` are refactored, so that `X`
113117
and `Xnew` represent matrices with features as rows.

docs/src/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Adding Models for General Use
22

33
The machine learning tools provided by
4-
[MLJ](https://alan-turing-institute.github.io/MLJ.jl/dev/) can be applied to the models in
4+
[MLJ](https://JuliaAI.github.io/MLJ.jl/dev/) can be applied to the models in
55
any package that imports
66
[MLJModelInterface](https://github.com/JuliaAI/MLJModelInterface.jl) and implements the
77
API defined there, as outlined in this document.
@@ -15,7 +15,7 @@ or by a stand-alone "interface-only" package, using the template
1515
[MLJExampleInterface.jl](https://github.com/JuliaAI/MLJExampleInterface.jl) (see [Where to
1616
place code implementing new models](@ref) below). For a list of packages implementing the
1717
MLJ model API (natively, and in interface packages) see
18-
[here](https://alan-turing-institute.github.io/MLJ.jl/dev/list_of_supported_models/).
18+
[here](https://JuliaAI.github.io/MLJ.jl/dev/list_of_supported_models/).
1919

2020
## Important
2121

@@ -31,7 +31,7 @@ project's [extras] and [targets]. In testing, simply use `MLJBase` in
3131
place of `MLJModelInterface`.
3232

3333
It is assumed the reader has read the [Getting
34-
Started](https://alan-turing-institute.github.io/MLJ.jl/dev/getting_started/) section of
34+
Started](https://JuliaAI.github.io/MLJ.jl/dev/getting_started/) section of
3535
the MLJ manual. To implement the API described here, some familiarity with the following
3636
packages is also helpful:
3737

@@ -52,5 +52,5 @@ packages is also helpful:
5252
In MLJ, the basic interface exposed to the user, built atop the model interface described
5353
here, is the *machine interface*. After a first reading of this document, the reader may
5454
wish to refer to [MLJ
55-
Internals](https://alan-turing-institute.github.io/MLJ.jl/dev/internals/) for context.
55+
Internals](https://JuliaAI.github.io/MLJ.jl/dev/internals/) for context.
5656

docs/src/iterative_models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ If an MLJ `Machine` is being `fit!` and it is not the first time, then `update`
1818
instead of `fit`, unless the machine `fit!` has been called with a new `rows` keyword
1919
argument. However, `MLJModelInterface` defines a fallback for `update` which just calls
2020
`fit`. For context, see the
21-
[Internals](https://alan-turing-institute.github.io/MLJ.jl/dev/internals/) section of the
21+
[Internals](https://JuliaAI.github.io/MLJ.jl/dev/internals/) section of the
2222
MLJ manual.
2323

2424
Learning networks wrapped as models constitute one use case (see the [Composing
25-
Models](https://alan-turing-institute.github.io/MLJ.jl/dev/composing_models/) section of
25+
Models](https://JuliaAI.github.io/MLJ.jl/dev/composing_models/) section of
2626
the MLJ manual): one would like each component model to be retrained only when
2727
hyperparameter changes "upstream" make this necessary. In this case, MLJ provides a
2828
fallback (specifically, the fallback is for any subtype of `SupervisedNetwork =

docs/src/quick_start_guide.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ understanding of how things work with MLJ. In particular, you are familiar with
1818
- [CategoricalArrays.jl](https://github.com/JuliaData/CategoricalArrays.jl), if working
1919
with finite discrete data, e.g., doing classification; see also the [Working with
2020
Categorical
21-
Data](https://alan-turing-institute.github.io/MLJ.jl/dev/working_with_categorical_data/)
21+
Data](https://JuliaAI.github.io/MLJ.jl/dev/working_with_categorical_data/)
2222
section of the MLJ manual.
2323

2424
If you're not familiar with any one of these points, the [Getting
25-
Started](https://alan-turing-institute.github.io/MLJ.jl/dev/getting_started/) section of
25+
Started](https://JuliaAI.github.io/MLJ.jl/dev/getting_started/) section of
2626
the MLJ manual may help.
2727

2828
*But tables don't make sense for my model!* If a case can be made that
@@ -99,8 +99,7 @@ Further to the last point, `a::Float64 = 0.5::(_ > 0)` indicates that
9999
the field `a` is a `Float64`, takes `0.5` as its default value, and
100100
expects its value to be positive.
101101

102-
Please see [this
103-
issue](https://github.com/JuliaAI/MLJBase.jl/issues/68)
102+
Please see [this issue](https://github.com/JuliaAI/MLJBase.jl/issues/68)
104103
for a known issue and workaround relating to the use of `@mlj_model`
105104
with negative defaults.
106105

@@ -201,7 +200,7 @@ For a classifier, the steps are fairly similar to a regressor with these differe
201200
1. `y` will be a categorical vector and you will typically want to use
202201
the integer encoding of `y` instead of `CategoricalValue`s; use
203202
`MLJModelInterface.int` for this.
204-
1. You will need to pass the full pool of target labels (not just
203+
2. You will need to pass the full pool of target labels (not just
205204
those observed in the training data) and additionally, in the
206205
`Deterministic` case, the encoding, to make these available to
207206
`predict`. A simple way to do this is to pass `y[1]` in the
@@ -210,19 +209,19 @@ For a classifier, the steps are fairly similar to a regressor with these differe
210209
method for recovering categorical elements from their integer
211210
representations (e.g., `d(2)` is the categorical element with `2`
212211
as encoding).
213-
2. In the case of a *probabilistic* classifier you should pass all
212+
3. In the case of a *probabilistic* classifier you should pass all
214213
probabilities simultaneously to the [`UnivariateFinite`](@ref) constructor
215214
to get an abstract `UnivariateFinite` vector (type
216215
`UnivariateFiniteArray`) rather than use comprehension or
217216
broadcasting to get a vanilla vector. This is for performance
218217
reasons.
219-
218+
220219
If implementing a classifier, you should probably consult the more
221220
detailed instructions at [The predict method](@ref).
222221

223222
**Examples**:
224223

225-
- GLM's [BinaryClassifier](https://github.com/JuliaAI/MLJModels.jl/blob/3687491b132be8493b6f7a322aedf66008caaab1/src/GLM.jl#L119-L131) (`Probabilistic`)
224+
- GLM's [BinaryClassifier](https://github.com/JuliaAI/MLJModels.jl/blob/3687491b132be8493b6f7a322aedf66008caaab1/src/GLM.jl#L119-L131) (`Probabilistic`)
226225

227226
- LIBSVM's [SVC](https://github.com/JuliaAI/MLJModels.jl/blob/master/src/LIBSVM.jl) (`Deterministic`)
228227

@@ -273,7 +272,7 @@ implementation creates:
273272
affect the outcome of training. It is okay to add "control"
274273
parameters (such as specifying an `acceleration` parameter specifying
275274
computational resources, as
276-
[here](https://github.com/alan-turing-institute/MLJ.jl/blob/master/src/ensembles.jl#L193)).
275+
[here](https://github.com/JuliaAI/MLJ.jl/blob/master/src/ensembles.jl#L193)).
277276
- Use `report` to return *everything else*, including model-specific
278277
*methods* (or other callable objects). This includes feature rankings,
279278
decision boundaries, SVM support vectors, clustering centres,
@@ -349,8 +348,8 @@ MLJModelInterface.metadata_model(YourModel1,
349348
output_scitype = MLJModelInterface.Table(MLJModelInterface.Continuous), # for an unsupervised, what output?
350349
supports_weights = false, # does the model support sample weights?
351350
descr = "A short description of your model"
352-
load_path = "YourPackage.SubModuleContainingModelStructDefinition.YourModel1"
353-
)
351+
load_path = "YourPackage.SubModuleContainingModelStructDefinition.YourModel1"
352+
)
354353
```
355354

356355
*Important.* Do not omit the `load_path` specification. Without a

docs/src/serialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ implemented in languages other than Julia.
1010

1111
The MLJ user can serialize and deserialize machines, as she would any other julia
1212
object. (This user has the option of first removing data from the machine. See the [Saving
13-
machines](https://alan-turing-institute.github.io/MLJ.jl/dev/machines/#Saving-machines)
13+
machines](https://JuliaAI.github.io/MLJ.jl/dev/machines/#Saving-machines)
1414
section of the MLJ manual for details.) However, a problem can occur if a model's
1515
`fitresult` (see [The fit method](@ref)) is not a persistent object. For example, it might
1616
be a C pointer that would have no meaning in a new Julia session.

docs/src/static_models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A model type subtypes `Static <: Unsupervised` if it does not generalize to new data but
44
nevertheless has hyperparameters. See the [Static
5-
transformers](https://alan-turing-institute.github.io/MLJ.jl/dev/transformers/#Static-transformers)
5+
transformers](https://JuliaAI.github.io/MLJ.jl/dev/transformers/#Static-transformers)
66
section of the MLJ manual for examples. In the `Static` case, `transform` can have
77
multiple arguments and `input_scitype` refers to the allowed scitype of the slurped data,
88
*even if there is only a single argument.* For example, if the signature is

docs/src/summary_of_methods.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Optional, if `SomeSupervisedModel <: Probabilistic`:
4343

4444
```julia
4545
MMI.predict_mode(model::SomeSupervisedModel, fitresult, Xnew) =
46-
mode.(predict(model, fitresult, Xnew))
46+
mode.(predict(model, fitresult, Xnew))
4747
MMI.predict_mean(model::SomeSupervisedModel, fitresult, Xnew) =
48-
mean.(predict(model, fitresult, Xnew))
48+
mean.(predict(model, fitresult, Xnew))
4949
MMI.predict_median(model::SomeSupervisedModel, fitresult, Xnew) =
50-
median.(predict(model, fitresult, Xnew))
50+
median.(predict(model, fitresult, Xnew))
5151
```
5252

5353
Required, if the model is to be registered (findable by general users):

docs/src/supervised_models.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ The following sections were written with `Supervised` models in mind, but also c
1919
material relevant to general models:
2020

2121
- [Summary of methods](@ref)
22-
- [The form of data for fitting and predicting](@ref)
22+
- [The form of data for fitting and predicting](@ref)
2323
- [The fit method](@ref)
2424
- [The fitted_params method](@ref)
25-
- [The predict method](@ref)
26-
- [The predict_joint method](@ref)
27-
- [Training losses](@ref)
28-
- [Feature importances](@ref)
29-
- [Trait declarations](@ref)
30-
- [Iterative models and the update! method](@ref)
31-
- [Implementing a data front end](@ref)
32-
- [Supervised models with a transform method](@ref)
25+
- [The predict method](@ref)
26+
- [The predict_joint method](@ref)
27+
- [Training losses](@ref)
28+
- [Feature importances](@ref)
29+
- [Trait declarations](@ref)
30+
- [Iterative models and the update! method](@ref)
31+
- [Implementing a data front end](@ref)
32+
- [Supervised models with a transform method](@ref)
3333
- [Models that learn a probability distribution](@ref)

0 commit comments

Comments
 (0)