# Chapter 3 Model understanding

In this chapter we introduce three groups of explainers that can be used to boost our understanding of black-box models.

• Section 3.1 presents explainers for model performance. A single number may be misleading when we need to compare complex models. In this section you will also find plots that give more information about model performance in a consistent form.
• Section 3.2 presents explainers for variable importance. Knowing which variables are important allows us to validate the model and increase our understanding of the domain.
• Section 3.3 presents explainers for variable effect. You may find in it plots that summarize the relation between model response and particular variables.

All explainers are illustrated on the basis of two models fitted to the apartments data.

library("DALEX")
apartments_lm_model <- lm(m2.price ~ construction.year + surface + floor +
no.rooms + district, data = apartments)
library("randomForest")
set.seed(59)
apartments_rf_model <- randomForest(m2.price ~ construction.year + surface + floor +
no.rooms + district, data = apartments)

First we need to prepare wrappers for these models. They are in explainer_lm and explainer_rf objects.

explainer_lm <- explain(apartments_lm_model,
data = apartmentsTest[,2:6], y = apartmentsTest$m2.price) explainer_rf <- explain(apartments_rf_model, data = apartmentsTest[,2:6], y = apartmentsTest$m2.price)