Learn R Programming

DALEXtra (version 1.3.2)

aspect_importance_single: 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 explainer aspect_importance_single( x, new_observation, N = 100, sample_method = "default", n_var = 0, f = 2, ... )

# S3 method for default aspect_importance_single( x, data, predict_function = predict, new_observation, N = 100, label = class(x)[1], sample_method = "default", n_var = 0, f = 2, ... )

Arguments

x

an explainer created with the DALEX::explain() function or a model to be explained.

...

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

sample_method

sampling method in get_sample

n_var

how many non-zero coefficients for lasso fitting, if zero than linear regression is used

f

frequency in in get_sample

data

dataset, it will be extracted from x if it's an explainer NOTE: Target variable shouldn't be present in the data

predict_function

predict function, it will be extracted from x if it's an explainer

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

Run this code
# NOT RUN {
library("DALEX")

model_titanic_glm <- glm(survived == 1 ~ class + gender + age +
                         sibsp + parch + fare + embarked,
                         data = titanic_imputed,
                         family = "binomial")

aspect_importance_single(model_titanic_glm, data = titanic_imputed[,-8],
                         new_observation = titanic_imputed[1,-8])

# }

Run the code above in your browser using DataLab