
Determine Weights Appropriately for Super Learner given Binary Outcomes
Source:R/determine_weights.R
determine_weights_for_binary_outcomes.RdDetermine Weights Appropriately for Super Learner given Binary Outcomes
Usage
determine_weights_for_binary_outcomes(
data,
y_variable,
obs_weights = NULL,
bound_eps = 0.001
)Arguments
- data
A data.frame with columns corresponding to predicted probabilities of 1 from each learner and the true y_variable from held-out data
- y_variable
A character indicating the outcome variable in the data.frame.
- obs_weights
A vector of weights for each observation that dictate how prediction should be more targeted to higher weighted observations.
- bound_eps
A numeric value used to truncate probabilities away from 0 and 1.
Examples
predicted_probabilities <- data.frame(
logistic = lnr_logistic(mtcars, am ~ hp)(mtcars),
nnet = lnr_nnet(mtcars, am ~ hp)(mtcars),
am = mtcars$am
)
determine_weights_for_binary_outcomes(predicted_probabilities, y_variable = "am")
#> [1] 0.8330272 0.1669728