Learn R Programming

DALEX (version 0.4.9)

loss_cross_entropy: Calculate Loss Functions

Description

Calculate Loss Functions

Usage

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

loss_sum_of_squares(observed, predicted, na.rm = TRUE)

loss_root_mean_square(observed, predicted, na.rm = TRUE)

loss_accuracy(observed, predicted, na.rm = TRUE)

loss_one_minus_auc(observed, predicted)

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

Run this code
# NOT RUN {
 
# }
# NOT RUN {
library("randomForest")
HR_rf_model <- randomForest(as.factor(status == "fired")~., data = HR, ntree = 100)
loss_sum_of_squares(as.numeric(HR$status == "fired"), yhat(HR_rf_model))
 
# }

Run the code above in your browser using DataLab