View source: R/machine_learning.R
| ASexplainer | R Documentation |
This function simplifies the use of DALEX with models trained
using AStrain from ASML. It automatically creates
DALEX explainers for all trained models (one per algorithm in the portfolio),
allowing users to easily apply DALEX functions to analyze model performance,
evaluate feature importance, and generate partial dependence plots (PDPs), among other analyses.
ASexplainer(training, data, y, labels = NULL, ...)
training |
An object of class |
data |
A |
y |
A |
labels |
Optional character vector of labels for the explainers. If |
... |
Additional arguments passed to |
A named list of DALEX explainer objects, one per trained model. Names are taken from labels or names(training).
Biecek, P. (2018). DALEX: Explainers for Complex Predictive Models in R. Journal of Machine Learning Research, 19(84), 1–5. http://jmlr.org/papers/v19/18-416.html
## Not run:
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))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.