optim_risk_sl_nloglik: Cross-validated negative log-likelihood for computing super...

Description Usage Arguments Details Value Examples

Description

In general, the function passed to sl_control$optim_risk should expect a named list of outcomes (Y) and predictions (pred) in validation folds and should return a criteria by which super learner weights may be optimized. The weights are input to the function via sl_weight and are optimized in the sl_control$weight_fn. See Examples section below for an example of the format of the input list used for sl_control$optim_risk functions.

Usage

1
2
optim_risk_sl_nloglik(sl_weight, input, sl_control, l = 0, u = 1,
  trim = 0.001)

Arguments

sl_weight

A numeric vector of super learner weights corresponding to each learner. Typically, this is what is maximized over in sl_control$weight_fn.

input

A list where each entry corresponds to a validation fold. Each entry is a list with entries: Y (univariate outcome for this validation fold), pred (matrix of predictions from learner and columns correspond to different leaners).

sl_control

Super learner control options.

l

Lower bound on outcomes

u

Upper bound on outcomes

trim

Where to trim qlogis to avoid NAs.

Details

In this case, the function computes cross-validated (quasi-) log-likelihood for the outcomes scaled to be between 0 and 1. The option trim must be a value greater than zero in order that the loss is bounded. The bounds on the outcome are set via l and u.

Value

Numeric value of cross-validated negative log-likelihood

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#Simulate data with proper format:
#Y is one component of the multivariate outcome, and 
#pred is the predictions made by learners.
input <- list(Y = rnorm(50), pred = cbind(rnorm(50), rnorm(50)))

#Made up weights:
sl_weight <- c(0.5, 0.5)

#Linear ensemble:
sl_control <- list(ensemble_fn = "ensemble_linear")

#Get risk by setting l and u to min and max:
risk <- optim_risk_sl_nloglik(sl_weight, input, sl_control, l = min(input$Y), u = max(input$Y))

benkeser/cvma documentation built on May 5, 2019, 1:37 p.m.