loss_function {autoMrP} | R Documentation |
loss_function()
estimates the loss based on a loss function.
loss_function( pred, data.valid, loss.unit = c("individuals", "L2 units"), loss.fun = c("MSE", "MAE", "cross-entropy"), y, L2.unit )
pred |
Predictions of outcome. A numeric vector of outcome predictions. |
data.valid |
Test data set. A tibble of data that was not used for prediction. |
loss.unit |
Loss function unit. A character-valued scalar indicating
whether performance loss should be evaluated at the level of individual
respondents ( |
loss.fun |
Loss function. A character-valued scalar indicating whether
prediction loss should be measured by the mean squared error ( |
y |
Outcome variable. A character vector containing the column names of the outcome variable. |
L2.unit |
Geographic unit. A character scalar containing the column name
of the geographic unit in |
Returns a tibble with number of rows equal to the number of loss functions tested (defaults to 4 for cross-entropy, f1, MSE, and msfe). The number of columns is 2 where the first is called measure and contains the names of the loss-functions and the second is called value and contains the loss-function scores.