Preimplemented Loss Functions
loss_cross_entropy(observed, predicted, p_min = 1e-04, na.rm = TRUE)
observed scores or labels, these are supplied as explainer specific `y`
predicted scores, either vector of matrix, these are returned from the model specific `predict_function()``
for cross entropy, minimal value for probability to make sure that `log` will not explode
logical, should missing values be removed?
numeric - value of the loss function
# NOT RUN { # } # NOT RUN { library("randomForest") HR_rf_model <- randomForest(status~., data = HR, ntree = 100) loss_cross_entropy(HR$status, yhat(HR_rf_model)) # }
Run the code above in your browser using DataCamp Workspace