Print Individual Variable Effects

# S3 method for 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

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.') }
#> gender age hours evaluation salary _id_ _ylevel_ _yhat_ _yhat_mean_ #> 1 male 32.58267 41.88626 3 1 1 fired 0.9 0.3787180 #> 1.3 male 32.58267 41.88626 3 1 1 fired 0.9 0.3787180 #> 1.4 male 32.58267 41.88626 3 1 1 fired 0.9 0.3787180 #> 1.5 male 32.58267 41.88626 3 1 1 fired 0.9 0.3787180 #> 1.6 male 32.58267 41.88626 3 1 1 fired 0.9 0.3787180 #> 1.1 male 32.58267 41.88626 3 1 1 ok 0.1 0.2730292 #> _vname_ _attribution_ _sign_ _label_ #> 1 gender -0.02056803 - randomForest #> 1.3 age 0.03448379 + randomForest #> 1.4 hours 0.32636349 + randomForest #> 1.5 evaluation 0.11472954 + randomForest #> 1.6 salary 0.06627323 + randomForest #> 1.1 gender 0.01840784 + randomForest