| plotD3.shap | R Documentation | 
Plots Shapley values.
## S3 method for class 'shap'
plotD3(
  x,
  ...,
  baseline = NA,
  max_features = 10,
  digits = 3,
  rounding_function = round,
  bar_width = 12,
  margin = 0.2,
  scale_height = FALSE,
  min_max = NA,
  vcolors = NA,
  chart_title = NA,
  time = 0,
  max_vars = NULL,
  reload = FALSE
)
| x | an explanation created with  | 
| ... | other parameters. | 
| baseline | if numeric then veritical line will start in  | 
| max_features | maximal number of features to be included in the plot. By default it's  | 
| digits | number of decimal places ( | 
| rounding_function | a function to be used for rounding numbers.
This should be  | 
| bar_width | width of bars in px. By default it's 12px | 
| margin | extend x axis domain range to adjust the plot. Usually value between 0.1 and 0.3, by default it's 0.2 | 
| scale_height | if  | 
| min_max | a range of OX axis. By deafult  | 
| vcolors | If  | 
| chart_title | a character. Set custom title | 
| time | in ms. Set the animation length | 
| max_vars | alias for the  | 
| reload | Reload the plot on resize. By default it's  | 
a r2d3 object.
Explanatory Model Analysis. Explore, Explain and Examine Predictive Models. https://ema.drwhy.ai
library("DALEX")
library("iBreakDown")
set.seed(1313)
model_titanic_glm <- glm(survived ~ gender + age + fare,
                       data = titanic_imputed, family = "binomial")
explain_titanic_glm <- explain(model_titanic_glm,
                           data = titanic_imputed,
                           y = titanic_imputed$survived,
                           label = "glm")
s_glm <- shap(explain_titanic_glm, titanic_imputed[1, ])
s_glm
plotD3(s_glm)
## Not run: 
## Not run:
library("randomForest")
HR_small <- HR[2:500,]
m_rf <- randomForest(status ~. , data = HR_small)
new_observation <- HR_test[1,]
new_observation
p_fun <- function(object, newdata){predict(object, newdata=newdata, type = "prob")}
s_rf <- shap(m_rf,
             data = HR_small[,-6],
             new_observation =  new_observation,
             predict_function = p_fun)
plotD3(s_rf, time = 500)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.