lnr_nnet
lnr_rf_binary
lnr_logistic
lnr_multinomial_nnet
lnr_multinomial_vglm
Details
The important thing to know about binary learners is that they
need to produce predictions that the outcome is == 1
or TRUE
.
Also, for binary outcomes, we should make sure to use the
determine_weights_for_binary_outcomes
in our calls to
super_learner()
which calculates the estimated probability of the observed
outcome (either 0 or 1) and then applies the negative log loss function
afterwards. This can be done automatically by declaring outcome_type = 'binary'
in calling super_learner()
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
.
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
if (FALSE) { # \dontrun{
super_learner(
data = mtcars,
learners = list(logistic1 = lnr_logistic, logistic2 = lnr_logistic, lnr_rf_binary),
formulas = list(
.default = am ~ .,
logistic2 = am ~ mpg * hp + .),
outcome_type = 'binary',
verbose = TRUE
)
} # }
if (FALSE) { # \dontrun{
super_learner(
data = iris,
learners = list(lnr_multinomial_vglm, lnr_multinomial_vglm, lnr_multinomial_nnet),
formulas = list(
.default = Species ~ .,
multinomial_vglm2 = Species ~ Petal.Length*Petal.Width + .),
outcome_type = 'multiclass',
verbose = TRUE
)
} # }