Recycles scalar arguments to length N and builds one gpl loss function per
target.
Usage
new_gpl_df(
N = NULL,
target_names = NA,
g = "x",
dg = NA,
kappa = 1,
alpha = 1,
O = NA,
U = NA,
offset = 0
)Arguments
- N
number of targets. If
NULL, inferred from the longest argument.- target_names
names of the targets, one per row.
- g
a non-decreasing increment function, supplied either as a function or as a string in the variable
xsuch as"log(x)".- dg
derivative of
g. Defaults toNA, in which case it is derived symbolically fromgwhen needed.- kappa
scale factor.
- alpha
normalized loss when the outcome
yexceeds the allocationx. Exactly one ofalphaandUmust be supplied.- O
cost incurred when the allocation
xexceeds the outcomey; equalskappa * (1 - alpha).- U
cost incurred when the outcome
yexceeds the allocationx; equalskappa * alpha.- offset
a constant, or a function of
y, added to the loss. The default of0gives a loss withL(x, x) = 0.
Value
A tibble of class gpl_df with one row per target, columns for each
loss parameter, and a gpl_loss_fun list column of loss functions.
Examples
new_gpl_df(N = 3, alpha = c(0.5, 0.7, 0.9), target_names = c("a", "b", "c"))
#> # A tibble: 3 × 9
#> g dg target_names kappa alpha O U offset gpl_loss_fun
#> * <chr> <lgl> <chr> <dbl> <dbl> <lgl> <lgl> <dbl> <list>
#> 1 x NA a 1 0.5 NA NA 0 <fn>
#> 2 x NA b 1 0.7 NA NA 0 <fn>
#> 3 x NA c 1 0.9 NA NA 0 <fn>