if (FALSE) {
library(ASML)
library(DALEX)
data(branching)
features <- branching$x
KPI <- branching$y
lab_rules <- c("max", "sum", "dual", "range", "eig-VI", "eig-CMI")
# Preprocess data
data_obj <- partition_and_normalize(
features,
KPI,
family_column = 1,
split_by_family = TRUE,
better_smaller = TRUE
)
# Train models
training <- AStrain(data_obj, method = "rf", parallel = TRUE)
# Create explainers
out <- ASexplainer(
training,
data = data_obj$x.test,
y = data_obj$y.test,
labels = lab_rules,
verbose = FALSE
)
# Model performance
mp_regr_rf <- lapply(out, DALEX::model_performance)
do.call(plot, unname(mp_regr_rf))
do.call(plot, c(unname(mp_regr_rf), list(geom = "boxplot")))
# Variable importance
vi_regr_rf <- lapply(out, DALEX::model_parts)
do.call(plot, c(unname(vi_regr_rf), list(max_vars = 5)))
# Partial dependence plots
pdp_regr_rf <- lapply(out, DALEX::model_profile, variable = "degree", type = "partial")
do.call(plot, unname(pdp_regr_rf))
}
Run the code above in your browser using DataLab