File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ machine learning models into
77
88| Linux | Coverage |
99| :-----------: | :------: |
10- | [ ![ 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 ) |
10+ | [ ![ 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)
1111
1212[ ![ Stable] ( https://img.shields.io/badge/docs-stable-blue.svg )] ( https://juliaai.github.io/MLJModelInterface.jl/dev/ )
1313
Original file line number Diff line number Diff line change @@ -27,3 +27,21 @@ EnsembleModel(model=tree, n=100)
2727
2828This is the only case in MLJ where positional arguments in a model constructor are
2929allowed.
30+
31+ ## Handling generic constructors
32+
33+ Model wrappers frequently have a public facing constructor with a name different from that
34+ of the model type constructed. For example, ` TunedModel(model, ...) ` is a constructor that
35+ will construct either an instance of ` DeterministicTunedModel ` or
36+ ` ProbabilisticTunedModel ` , depending on the type of ` model ` . In this case it is necessary
37+ to overload the ` constructor ` trait, which in that case looks like this:
38+
39+ ``` julia
40+ MLJModelInterface. constructor (:: Type {<: Union {
41+ DeterministicTunedModel,
42+ ProbabilisticTunedModel,
43+ }}) = TunedModel
44+ ```
45+
46+ This allows the MLJ Model Registry to correctly associate model metadata to the
47+ constructor, rather than the (private) types.
You can’t perform that action at this time.
0 commit comments