API
Abstract Types
Models.Template
— TypeModels.Model
— TypeModel
A Model is a trained Template
with which one can predict
on inputs. Defined as well are the traits:
Common API
StatsAPI.fit
— Functionfit(::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))
StatsAPI.predict
— Functionpredict(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}
.
Models.submodels
— Functionsubmodels(::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.
Models.estimate_type
— FunctionModels.output_type
— FunctionModels.predict_input_type
— Functionpredict_input_type(::T) where T = predict_input_type(T)
Traits
Models.EstimateTrait
— TypeEstimateTrait
The EstimateTrait
specifies if the model outputs a point or distribution estimate, denoted by PointEstimate
or DistributionEstimate
, respectively.
Models.PointEstimate
— TypePointEstimate <: EstimateTrait
Specifies that the Model
returns real-valued response variables.
Models.DistributionEstimate
— TypeDistributionEstimate <: EstimateTrait
Specifies that the Model
returns a distribution over the response variables.
Models.OutputTrait
— TypeOutputTrait
The OutputTrait
specifies if the model supports single or multiple response variables, denoted by SingleOutput
or MultiOutput
, respectively.
Models.SingleOutput
— TypeSingleOutput <: OutputTrait
Specifies that the Model
returns a single, univariate response variable.
Models.MultiOutput
— TypeMultiOutput <: OutputTrait
Specifies that the Model
returns a multivariate response variable.
Models.PredictInputTrait
— TypePredictInputTrait
The PredictInputTrait
specifies if the model supports point or distribution inputs to predict
, denoted by PointPredictInput
or PointOrDistributionPredictInput
.
Models.PointPredictInput
— TypePointPredictInput <: PredictInputTrait
Specifies that the Model
accepts real-valued input variables to predict
.
Models.PointOrDistributionPredictInput
— TypePointOrDistributionPredictInput <: PredictInputTrait
Specifies that the Model
accepts real-values or a joint distribution over the input variables to predict
.