Model Performance Plots

# S3 method for model_performance_explainer
plot(x, ..., geom = "ecdf",
  show_outliers = 0, ptlabel = "name", lossFunction = function(x)
  sqrt(mean(x^2)))

Arguments

x

a model to be explained, preprocessed by the 'explain' function

...

other parameters

geom

either "ecdf" or "boxplot" determines how residuals shall be summarized

show_outliers

number of largest residuals to be presented (only when geom = boxplot).

ptlabel

either "name" or "index" determines the naming convention of the outliers

lossFunction

function that calculates the loss for a model based on model residuals. By default it's the root mean square.

Value

An object of the class 'model_performance_explainer'.

Examples

library("randomForest") HR_rf_model <- randomForest(status == "fired"~., data = HR, ntree = 100)
#> Warning: The response has five or fewer unique values. Are you sure you want to do regression?
explainer_rf <- explain(HR_rf_model, data = HR, y = HR$status == "fired") mp_rf <- model_performance(explainer_rf) plot(mp_rf)
plot(mp_rf, geom = "boxplot", show_outliers = 1)
HR_rf_model2 <- randomForest(status == "fired"~age + hours, data = HR, ntree = 100)
#> Warning: The response has five or fewer unique values. Are you sure you want to do regression?
explainer_rf2 <- explain(HR_rf_model2, data = HR, y = HR$status == "fired") mp_rf2 <- model_performance(explainer_rf2) plot(mp_rf, mp_rf2)
HR_glm_model <- glm(status == "fired"~., data = HR, family = "binomial") explainer_glm <- explain(HR_glm_model, data = HR, y = HR$status == "fired", label = "glm", predict_function = function(m,x) predict.glm(m,x,type = "response")) mp_glm <- model_performance(explainer_glm) plot(mp_glm)
HR_lm_model <- lm(status == "fired"~., data = HR) explainer_lm <- explain(HR_lm_model, data = HR, y = HR$status == "fired") mp_lm <- model_performance(explainer_lm) plot(mp_lm)
plot(mp_rf, mp_glm, mp_lm)
plot(mp_rf, mp_glm, mp_lm, geom = "boxplot")
plot(mp_rf, mp_glm, mp_lm, geom = "boxplot", show_outliers = 1)