Skip to content

Commit

Permalink
Merge pull request #210 from JuliaAI/dev
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
ablaom authored Sep 9, 2024
2 parents fae094c + 03ccc2d commit 7fb5487
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ machine learning models into

| Linux | Coverage |
| :-----------: | :------: |
| [![Build Status](https://github.com/JuliaAI/MLJModelInterface.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/MLJModelInterface.jl/actions) | [![codecov.io](http://codecov.io/github/JuliaAI/MLJModelInterface.jl/coverage.svg?branch=master)](http://codecov.io/github/JuliaAI/MLJModelInterface.jl?branch=master) |
| [![Build Status](https://github.com/JuliaAI/MLJModelInterface.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/MLJModelInterface.jl/actions) | [![codecov](https://codecov.io/github/JuliaAI/MLJModelInterface.jl/graph/badge.svg?token=rkvwHku1dW)](https://codecov.io/github/JuliaAI/MLJModelInterface.jl)

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliaai.github.io/MLJModelInterface.jl/dev/)

Expand Down
18 changes: 18 additions & 0 deletions docs/src/model_wrappers.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ EnsembleModel(model=tree, n=100)

This is the only case in MLJ where positional arguments in a model constructor are
allowed.

## Handling generic constructors

Model wrappers frequently have a public facing constructor with a name different from that
of the model type constructed. For example, `TunedModel(model, ...)` is a constructor that
will construct either an instance of `DeterministicTunedModel` or
`ProbabilisticTunedModel`, depending on the type of `model`. In this case it is necessary
to overload the `constructor` trait, which in that case looks like this:

```julia
MLJModelInterface.constructor(::Type{<:Union{
DeterministicTunedModel,
ProbabilisticTunedModel,
}}) = TunedModel
```

This allows the MLJ Model Registry to correctly associate model metadata to the
constructor, rather than the (private) types.

0 comments on commit 7fb5487

Please sign in to comment.