get_obj_deriv_fn: A factory-esque arrangement (not sure if there is an actual...

Description Usage Arguments Value

Description

A factory-esque arrangement (not sure if there is an actual name for this pattern) to manufacture an function to calculate first and second order derivatives of the log-score objective, with needed quantities accessible in its parent environment. We do this becaues there's no way to use the info attribute of the dtrain object to store the component model log scores (as would be standard in the xgboost package). But we need to ensure that the objective function has access to these log scores when called in parallel.

Usage

1
get_obj_deriv_fn(component_model_log_scores, dtrain_Rmatrix)

Arguments

component_model_log_scores

N by M matrix where entry [i, m] has the log-score for observation i obtained from component model m

Value

a function that takes two arguments (preds and dtrain) and computes the first and second order derivatives of the log-score objective function for the stacked model. i.e., it converts preds to model weights for each component model m at each observation i and then combines the component model log scores with those weights to obtain stacked model log scores. See the package vignette for derivations of these calculations. This function is suitable for use as the "obj" function in a call to xgboost::xgb.train


reichlab/xgbstack documentation built on May 27, 2019, 4:54 a.m.