snowflake.ml.monitoring.explain_visualize.plot_force

snowflake.ml.monitoring.explain_visualize.plot_force(shap_row: Row, features_row: Row, base_value: float = 0.0, figsize: tuple[float, float] = DEFAULT_FIGSIZE, contribution_threshold: float = 0.05) LayerChart
snowflake.ml.monitoring.explain_visualize.plot_force(shap_row: Series, features_row: Series, base_value: float = 0.0, figsize: tuple[float, float] = DEFAULT_FIGSIZE, contribution_threshold: float = 0.05) LayerChart

Create a force plot for SHAP values with stacked bars based on influence direction.

Parameters:
  • shap_row – pandas Series or snowpark Row containing SHAP values for a specific instance

  • features_row – pandas Series or snowpark Row containing the feature values for the same instance

  • base_value – base value of the predictions. Defaults to 0, but is usually the model’s average prediction

  • figsize – tuple of (width, height) for the plot

  • contribution_threshold – Only features with magnitude greater than contribution_threshold as a percentage of the total absolute SHAP values will be plotted. Defaults to 0.05 (5%)

Returns:

Altair chart object

Raises:

SnowflakeMLException – If the contribution threshold is not between 0 and 1, or if no features with significant contributions are found.