Installation#
Shapash requires Python 3.11 or newer. Install it with pip:
pip install shapash
Optional extras#
Some features need extra dependencies, available as extras:
Extra |
Use |
|---|---|
|
Generate the Shapash Report. |
|
Explain text classifiers (preview). Installs PyTorch, Transformers, Captum and related libraries. |
|
Use LIME instead of SHAP to compute contributions. |
|
Install a version of these libraries that Shapash supports. |
For example:
pip install "shapash[report]"
pip install "shapash[report,lime]"
Jupyter#
Shapash plots are Plotly figures. They display in JupyterLab, Jupyter Notebook 7 and VS Code without any extra configuration. To check that Plotly works in your environment:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
fig.update_layout(title="Hello Figure")
fig.show()
If the figure doesn’t display, see Plotly’s troubleshooting guide.
Compatibility issues#
If you get an error from one of the model libraries (XGBoost, LightGBM, CatBoost), install the matching extra to get a version that Shapash supports, for example:
pip install "shapash[xgboost]"