Skip to content

Commit

Permalink
Merge pull request #1072 from alan-turing-institute/mljflow-compat-up…
Browse files Browse the repository at this point in the history
…date

Bump compat: MLJFlow 0.3
  • Loading branch information
ablaom authored Nov 21, 2023
2 parents 6b39b31 + 16a91b1 commit 4c021a9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MLJ"
uuid = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7"
authors = ["Anthony D. Blaom <[email protected]>"]
version = "0.20.1"
version = "0.20.2"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down Expand Up @@ -34,7 +34,7 @@ Distributions = "0.21,0.22,0.23, 0.24, 0.25"
MLJBalancing = "0.1"
MLJBase = "1"
MLJEnsembles = "0.4"
MLJFlow = "0.2"
MLJFlow = "0.3"
MLJIteration = "0.6"
MLJModels = "0.16"
MLJTuning = "0.8"
Expand Down
46 changes: 25 additions & 21 deletions docs/src/adding_models_for_general_use.md
Original file line number Diff line number Diff line change
Expand Up @@ -1209,35 +1209,39 @@ Your document string must include the following components, in order:
Unsupervised models implement the MLJ model interface in a very
similar fashion. The main differences are:

- The `fit` method has only one training argument `X`, as in `MLJModelInterface.fit(model,
verbosity, X)`. However, it has the same return value `(fitresult, cache, report)`. An
`update` method (e.g., for iterative models) can be optionally implemented in the same
way. For models that subtype `Static <: Unsupervised` (see also [Static
transformers](@ref) `fit` has no training arguments but does not need to be implemented
as a fallback returns `(nothing, nothing, nothing)`.

- A `transform` method is compulsory and has the same signature as
`predict`, as in `MLJModelInterface.transform(model, fitresult, Xnew)`.
- The `fit` method, which still returns `(fitresult, cache, report)` will typically have
only one training argument `X`, as in `MLJModelInterface.fit(model, verbosity, X)`,
although this is not a hard requirement. For example, a feature selection tool (wrapping
some supervised model) might also include a target `y` as input. Furthermore, in the
case of models that subtype `Static <: Unsupervised` (see also [Static
transformers](@ref) `fit` has no training arguments at all, but does not need to be
implemented as a fallback returns `(nothing, nothing, nothing)`.

- A `transform` and/or `predict` method is implemented, and has the same signature as
`predict` does in the supervised case, as in `MLJModelInterface.transform(model,
fitresult, Xnew)`. However, it may only have one data argument `Xnew`, unless `model <:
Static`, in which case there is no restriction. A use-case for `predict` is K-means
`MLJModelInterface.predict(model, fitresult, Xnew)`. A use-case is
clustering that `predict`s labels and `transform`s
input features into a space of lower dimension. See [Transformers
that also predict](@ref) for an example.

- Instead of defining the `target_scitype` trait, one declares an
`output_scitype` trait (see above for the meaning).
- The `target_scitype` trait continues to refer to the output of `predict`, if
implemented, while a trait, `output_scitype`, is for the output of `transform`.

- An `inverse_transform` can be optionally implemented. The signature
is the same as `transform`, as in
`MLJModelInterface.inverse_transform(model, fitresult, Xout)`, which:

- must make sense for any `Xout` for which `scitype(Xout) <:
output_scitype(SomeSupervisedModel)` (see below); and

output_scitype(SomeSupervisedModel)` (see below); and
- must return an object `Xin` satisfying `scitype(Xin) <:
input_scitype(SomeSupervisedModel)`.
input_scitype(SomeSupervisedModel)`.

For sample implementatations, see MLJ's [built-in
transformers](https://github.com/JuliaAI/MLJModels.jl/blob/dev/src/builtins/Transformers.jl)
and the clustering models at
[MLJClusteringInterface.jl](https://github.com/jbrea/MLJClusteringInterface.jl).

- A `predict` method may be optionally implemented, and has the same
signature as for supervised models, as in
`MLJModelInterface.predict(model, fitresult, Xnew)`. A use-case is
clustering algorithms that `predict` labels and `transform` new
input features into a space of lower dimension. See [Transformers
that also predict](@ref) for an example.

## Static models (models that do not generalize)

Expand Down
2 changes: 1 addition & 1 deletion test/exported_names.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Save()

# MLJFlow

MLFlowLogger
MLJFlow.Logger

# StatisticalMeasures

Expand Down

0 comments on commit 4c021a9

Please sign in to comment.