new_model_class {fabletools} | R Documentation |
Create a new class of models
Description
Suitable for extension packages to create new models for fable.
Usage
new_model_class(
model = "Unknown model",
train = function(.data, formula, specials, ...)
abort("This model has not defined a training method."),
specials = new_specials(),
check = function(.data) {
},
prepare = function(...) {
},
...,
.env = caller_env(),
.inherit = model_definition
)
new_model_definition(.class, formula, ..., .env = caller_env(n = 2))
Arguments
model |
The name of the model |
train |
A function that trains the model to a dataset. |
specials |
Special functions produced using |
check |
A function that is used to check the data for suitability with the model. This can be used to check for missing values (both implicit and explicit), regularity of observations, ordered time index, and univariate responses. |
prepare |
This allows you to modify the model class according to user
inputs. |
... |
Further arguments to |
.env |
The environment from which functions should inherit from. |
.inherit |
A model class to inherit from. |
.class |
A model class (typically created with |
formula |
The user's model formula. |
Details
This function produces a new R6 model definition. An understanding of R6 is
not required, however could be useful to provide more sophisticated model
interfaces. All functions have access to self
, allowing the functions for
training the model and evaluating specials to access the model class itself.
This can be useful to obtain elements set in the %TODO