print.individual_variable_effect: Print Individual Variable Effects

Description Usage Arguments Examples

View source: R/print_individual_variable_effect.R

Description

Print Individual Variable Effects

Usage

1
2
## S3 method for class 'individual_variable_effect'
print(x, ...)

Arguments

x

an individual variable importance explainer created with the individual_variable_effect function.

...

further arguments passed to or from other methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
have_shap <- reticulate::py_module_available("shap")

if(have_shap){
  library("shapper")
  library("DALEX")
  library("randomForest")
  Y_train <- HR$status
  x_train <- HR[ , -6]
  set.seed(123)
  model_rf <- randomForest(x = x_train, y = Y_train, ntree= 50)
  p_function <- function(model, data) predict(model, newdata = data, type = "prob")

  ive_rf <- individual_variable_effect(model_rf, data = x_train, predict_function = p_function,
                                     new_observation = x_train[1:2,], nsamples = 50)
  print(ive_rf)
}else{
    print('Python testing environment is required.')
}

shapper documentation built on Aug. 28, 2020, 9:08 a.m.