File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ # Model wrappers
2+
3+ A model that can have one or more other models as hyper-parameters should overload the trait ` is_wrapper ` , as in this example:
4+
5+ ``` julia
6+ MLJModelInterface. target_in_fit (:: Type{<:MyWrapper} ) = true
7+ ```
8+
9+ The constructor for such a model does not need provide default values for the model-valued
10+ hyper-parameters. If only a single model is wrapped, then the hyper-parameter should have
11+ the name ` :model ` and this should be an optional positional argument, as well as a keyword
12+ argument.
13+
14+ For example, ` EnsembleModel ` is a model wrapper, and we can construct an instance like this:
15+
16+ ``` julia
17+ using MLJ
18+ atom = ConstantClassfier ()
19+ EnsembleModel (tree, n= 100 )
20+ ```
21+
22+ but also like this:
23+
24+ ``` julia
25+ EnsembleModel (model= tree, n= 100 )
26+ ```
27+
28+ This is the only case in MLJ where positional arguments in a model constructor are
29+ allowed.
You can’t perform that action at this time.
0 commit comments