lnr_multinomial_nnetlnr_multinomial_vglm
Value
Every learner function shares the same structure: when
called with (data, formula, ...) it fits the underlying model
and returns a prediction closure which is a function of
newdata returning a numeric vector of predictions (predicted
probabilities of the second factor level for binary learners;
predicted densities for density learners; and a vector of the predicted
class probabilities for the observed classes for multiclass learners).
Details
Suppose one of these is trained on some data and the fit learner is stored.
Suppose we are going to call it on newdata and newdata$class is
the outcome variable being predicting.
The important thing to know about multiclass learners is that they
produce predictions that the outcome class is equal to
newdata$class given the covariates specified in
newdata.
This means that newdata passed to the returned prediction
closure must contain the outcome column, or else an error is produced.
Similar to density estimation, we want to use
determine_weights_using_neg_log_loss in our calls to
super_learner(). This can be done automatically by declaring
outcome_type = 'multiclass'
in calling super_learner()
Examples
super_learner(
data = iris,
learners = list(lnr_multinomial_vglm, lnr_multinomial_vglm, lnr_multinomial_nnet),
formulas = list(
.default = Species ~ .,
multinomial_vglm_2 = Species ~ Petal.Length * Petal.Width + .
),
outcome_type = "multiclass"
)
#>
#> Super Learner (nadir_sl_model)
#> outcome: Species (multiclass)
#> observations: 150 CV folds: 5
#> ensemble weights:
#> multinomial_vglm_2 1.000
#> multinomial_vglm_1 0.000
#> multinomial_nnet 0.000
#> captured conditions (see $errors_from_*, $warnings_from_*):
#> [warning] multinomial_vglm_1 @ cv-training: 11 diagonal elements of the working weights variable 'wz'... (x2)
#> [warning] multinomial_vglm_1 @ cv-training: 17 diagonal elements of the working weights variable 'wz'...
#> [warning] multinomial_vglm_1 @ cv-training: 24 diagonal elements of the working weights variable 'wz'...
#> [warning] multinomial_vglm_1 @ cv-training: 32 diagonal elements of the working weights variable 'wz'... (x3)
#> ... and 100 more unique conditions not shown
#>
#> Methods: predict(x, newdata), plot(x), summary(x), coef(x), fitted(x), ...
