shap.plots.force(base_value, shap_values=None, features=None, feature_names=None, out_names=None, link='identity', plot_cmap='RdBu', matplotlib=False, show=True, figsize=(20, 3), ordering_keys=None, ordering_keys_time_format=None, text_rotation=0, contribution_threshold=0.05)

Visualize the given SHAP values with an additive force layout.


This is the reference value that the feature contributions start from. For SHAP values it should be the value of explainer.expected_value.


Matrix of SHAP values (# features) or (# samples x # features). If this is a 1D array then a single force plot will be drawn, if it is a 2D array then a stacked force plot will be drawn.


Matrix of feature values (# features) or (# samples x # features). This provides the values of all the features, and should be the same shape as the shap_values argument.


List of feature names (# features).


The name of the output of the model (plural to support multi-output plotting in the future).

link“identity” or “logit”

The transformation used when drawing the tick mark labels. Using logit will change log-odds numbers into probabilities.


Whether to use the default Javascript output, or the (less developed) matplotlib output. Using matplotlib can be helpful in scenarios where rendering Javascript/HTML is inconvenient.


Controls the feature names/values that are displayed on force plot. Only features that the magnitude of their shap value is larger than min_perc * (sum of all abs shap values) will be displayed.