aspect_importance_single {triplot} | R Documentation |
Aspects importance for single aspects
Description
Calculates aspect_importance for single aspects (every aspect contains only one feature).
Usage
aspect_importance_single(x, ...)
## S3 method for class 'explainer'
aspect_importance_single(
x,
new_observation,
N = 1000,
n_var = 0,
sample_method = "default",
f = 2,
...
)
## Default S3 method:
aspect_importance_single(
x,
data,
predict_function = predict,
label = class(x)[1],
new_observation,
N = 1000,
n_var = 0,
sample_method = "default",
f = 2,
...
)
Arguments
x |
an explainer created with the |
... |
other parameters |
new_observation |
selected observation with columns that corresponds to variables used in the model, should be without target variable |
N |
number of observations to be sampled (with replacement) from data
NOTE: Small |
n_var |
how many non-zero coefficients for lasso fitting, if zero than linear regression is used |
sample_method |
sampling method in |
f |
frequency in in |
data |
dataset, it will be extracted from |
predict_function |
predict function, it will be extracted from |
label |
name of the model. By default it's extracted from the 'class' attribute of the model. |
Value
An object of the class 'aspect_importance'. Contains dataframe that describes aspects' importance.
Examples
library("DALEX")
model_titanic_glm <- glm(survived == 1 ~ class + gender + age +
sibsp + parch + fare + embarked,
data = titanic_imputed,
family = "binomial")
explainer_titanic <- explain(model_titanic_glm,
data = titanic_imputed[,-8],
verbose = FALSE)
aspect_importance_single(explainer_titanic,
new_observation = titanic_imputed[1,-8])