Abstract Types

Common API


fit(::Template, output::AbstractMatrix, input::AbstractMatrix, [weights]) -> Model

Fit the Template to the output and input data and return a trained Model. Convention is that weights defaults to StatsBase.uweights(Float32, size(outputs, 2))

predict(model::Model, inputs::AbstractMatrix)
predict(model::Model, inputs::AbstractVector{<:AbstractVector})

Predict targets for the provided the collection of inputs and Model.

A Model subtype for which the predict_input_type(model) is PointPredictInput will only need to implement a predict function that operates on an AbstractMatrix of inputs.

If the estimate_type(model) is PointEstimate then this function should return another AbstractMatrix in which each column contains the prediction for a single input.

If the estimate_type(model) is DistributionEstimate then this function should return a AbstractVector{<:Distribution}.

submodels(::Union{Template, Model})

Return all submodels within a multistage model/template.

Submodels are models within a model that have their own inputs (which may or may not be combined with outputs of earlier submodels, before actually being passed as input to the submodel). Such multistage models take a tuple of inputs (which may be nested if the submodel itself has submodels). The order of submodels returned by submodels is as per the order of the inputs in the tuple.

For single-stage models, (i.e. ones that simply take a matrix as input), this returns an empty tuple. Wrapper models which do not expose their inner models to seperate inputs, including ones that only wrap a single model, should not define submodels as they are (from the outside API perspective) single-stage models.