Knowledge Base Regulation Tracker Standards & Frameworks OSS Directory AI Incident Database Research Paper Library Case Studies Society Articles News Jobs About Charter Sign inBecome a Member

Shapash

Explainability and feature attribution

Library that makes model explanations understandable to non-specialists, wrapping SHAP and LIME outputs in clear labels, an interactive web app and exportable reports.

explainabilityreportingweb app

How Shapash Works

Shapash is a Python library developed by MAIF Data Scientists to enhance the interpretability of machine learning models. It achieves this by wrapping outputs from SHAP (SHapley Additive exPlanations) and LIME (Local Interpretable Model-agnostic Explanations) into clear, labeled visualizations and reports. The library is designed to bridge the gap between technical model outputs and understandable explanations for both data scientists and non-technical stakeholders.

At its core, Shapash translates complex model explanations into explicit labels for features and their modalities, ensuring that results are accessible to users without deep technical expertise. This is accomplished through a combination of interactive visualizations, an embedded web application for navigation, and exportable HTML reports.

Shapash operates by integrating with existing model explainability tools like SHAP and LIME, but it refines their outputs into more digestible formats. For instance, it provides a SmartExplainer class that simplifies the process of generating explanations with minimal arguments, though additional effort in data cleaning and documentation can further enhance clarity. The library also includes a SmartPredictor object, which allows users to group features in production environments, facilitating seamless integration from model training to deployment.

This ensures that explainability remains consistent whether models are being explored during development or used in real-world applications.

One of Shapash’s key strengths is its ability to freeze various aspects of a data science project, such as model parameters, feature encodings, and explanations. This creates a reproducible foundation for audit reports, ensuring transparency and accountability in model decision-making. Additionally, Shapash allows users to filter subsets of data for deeper analysis, focusing on correct or incorrect predictions and specific features to refine understanding.

The library’s compatibility with encoders like category_encoders and scikit-learn’s ColumnTransformer ensures that categorical and transformed features are correctly interpreted. The interactive web app further enhances usability by enabling users to navigate between global and local explanations effortlessly, providing a dynamic way to explore model behavior.

While basic explanations can be generated with minimal input, users are encouraged to invest time in data documentation to produce clearer and more actionable results. This balance between ease of use and depth of customization makes Shapash a practical tool for both technical and non-technical audiences.

Use Cases

For data scientists, it simplifies the process of sharing model insights with colleagues or business teams who may lack technical expertise. For example, a data scientist working on a binary classification model for customer churn prediction can use Shapash to generate a summary of the most influential features driving predictions, such as customer tenure or payment history.

In production environments, Shapash’s SmartPredictor object enables seamless integration with deployed models. This is useful for operationalizing explainability, where real-time or batch explanations are required to justify model decisions. For instance, a financial institution using Shapash in an API-based deployment can provide clear explanations for loan approval decisions, enhancing transparency and trust with end users.

The library’s support for subset selection allows for targeted analysis of model behavior.

This versatility makes it a go-to tool for teams looking to embed explainability into their workflows without switching between multiple tools.

By freezing project aspects such as feature encodings and model parameters, teams can generate reproducible reports that serve as evidence of model fairness, accuracy, and compliance.

Key Features & Capabilities

  • Clear and Explicit Labels: Shapash translates technical model outputs into human-readable labels for features and their values. This ensures that explanations are accessible to non-specialists, reducing the cognitive load required to interpret complex data.
  • Interactive Web Application: The embedded web app allows users to explore global and local explanations dynamically.
  • Exportable Reports: Shapash generates HTML reports that summarize model explanations, making it easy to share findings with stakeholders. These reports can include visualizations, feature contributions, and subset analyses, providing a comprehensive overview of model behavior.
  • Users can quickly summarize feature contributions without extensive configuration, though additional customization options are available for more detailed analysis.
  • Compatibility with Major Frameworks: Shapash supports a wide range of models, including those from scikit-learn, LightGBM, CatBoost, and XGBoost.
  • Subset Selection and Filtering: Users can filter data based on explanatory features, prediction outcomes, or additional criteria. This allows for focused analysis of specific model behaviors, such as investigating why certain predictions were incorrect.
  • This ensures that categorical and transformed features are correctly interpreted, maintaining accuracy in explanations.
  • Audit and Documentation Support: By freezing project aspects such as feature encodings and model parameters, Shapash enables the creation of reproducible audit reports.
  • Minimal Configuration for Quick Results: While Shapash can be used with minimal arguments to generate explanations quickly, users are encouraged to invest time in data cleaning and documentation to produce clearer and more actionable results.

Sources

Contribute

Spot an error, or know a record we should add? Members can propose additions and submit corrections.