binary_cross_entropy()
estimates the inverse binary cross-entropy on
the individual and state-level.
binary_cross_entropy(
pred,
data.valid,
loss.unit = c("individuals", "L2 units"),
y,
L2.unit
)
Returns a tibble containing two binary cross-entropy prediction errors. The first is measured at the level of individuals and the second is measured at the context level. The tibble dimensions are 2x3 with variables: measure, value and level.
Predictions of outcome. A numeric vector of outcome predictions.
Test data set. A tibble of data that was not used for prediction.
Loss function unit. A character-valued scalar indicating
whether performance loss should be evaluated at the level of individual
respondents (individuals
) or geographic units (L2 units
).
Default is individuals
.
Outcome variable. A character vector containing the column names of the outcome variable.
Geographic unit. A character scalar containing the column name
of the geographic unit in survey
and census
at which outcomes
should be aggregated.