Preimplemented Loss Functions

loss_cross_entropy(observed, predicted, p_min = 1e-04, na.rm = TRUE)

Arguments

observed

observed scores or labels, these are supplied as explainer specific `y`

predicted

predicted scores, either vector of matrix, these are returned from the model specific `predict_function()``

p_min

for cross entropy, minimal value for probability to make sure that `log` will not explode

na.rm

logical, should missing values be removed?

Value

numeric - value of the loss function

Examples

library("randomForest") HR_rf_model <- randomForest(status~., data = HR, ntree = 100) loss_cross_entropy(HR$status, yhat(HR_rf_model))
#> [1] 5704.802