Learn R Programming

DALEX (version 0.4.9)

model_performance: Calculate Model Performance

Description

Prepare a data frame with model residuals.

Usage

model_performance(explainer, ...)

Arguments

explainer

a model to be explained, preprocessed by the explain function

...

other parameters

Value

An object of the class model_performance_explainer.

References

Predictive Models: Visual Exploration, Explanation and Debugging https://pbiecek.github.io/PM_VEE/

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
library("randomForest")
HR_rf_model <- randomForest(as.factor(status == "fired")~., data = HR, ntree = 100)
explainer_rf  <- explain(HR_rf_model, data = HR, y = HR$status == "fired")
# resulting dataframe has predicted values and residuals
model_performance(explainer_rf)

HR_glm_model <- glm(status == "fired"~., data = HR, family = "binomial")
explainer_glm <- explain(HR_glm_model, data = HR, y = HR$status == "fired",
                    predict_function = function(m,x) predict.glm(m,x,type = "response"))
mp_ex_glm <- model_performance(explainer_glm)
mp_ex_glm
plot(mp_ex_glm)

HR_lm_model <- lm(status == "fired"~., data = HR)
explainer_lm <- explain(HR_lm_model, data = HR, y = HR$status == "fired")
model_performance(explainer_lm)
 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab