loss_fun_dkp {BKP} | R Documentation |
Loss Function for Fitting the DKP Model
Description
Computes the loss used to fit the DKP model. Supports the Brier score (mean squared error) and negative log-loss (cross-entropy), under different prior specifications.
Usage
loss_fun_dkp(
gamma,
Xnorm,
Y,
prior = c("noninformative", "fixed", "adaptive"),
r0 = 2,
p0 = NULL,
loss = c("brier", "log_loss"),
kernel = c("gaussian", "matern52", "matern32")
)
Arguments
gamma |
A numeric vector of log-transformed kernel hyperparameters. |
Xnorm |
A numeric matrix of normalized inputs (each column scaled to
|
Y |
Matrix of observed multinomial counts, with dimension |
prior |
Type of prior to use. One of |
r0 |
Global prior precision (only used when |
p0 |
Global prior mean vector (only used when |
loss |
Loss function for kernel hyperparameter tuning. One of
|
kernel |
Kernel function for local weighting. Choose from
|
Value
A single numeric value representing the total loss (to be minimized).
See Also
loss_fun
, fit.DKP
, get_prior_dkp
,
kernel_matrix
Examples
set.seed(123)
n = 10
Xnorm = matrix(runif(2 * n), ncol = 2)
m = rep(10, n)
y = rbinom(n, size = m, prob = runif(n))
Y = cbind(y, m-y)
loss_fun_dkp(gamma = rep(0, 2), Xnorm = Xnorm, Y = Y)