BCG-X-Official/facet

Human-explainable AI.

What it solves

FACET addresses the difficulty of understanding why a supervised machine learning model makes its predictions. It goes beyond single-prediction explanations (like SHAP) to provide a global, feature-pair-level view of how the model uses information, and it lets you run virtual experiments to see how changing a feature would affect the predicted outcome. This helps practitioners inspect, trust, and optimise their models more effectively.

How it works

FACET combines three main capabilities:

  • Model inspection: It introduces a new algorithm that quantifies dependence and interaction between every pair of features in a trained model. It produces two key metrics: synergy (how much two features jointly contribute to a prediction, expressed as a percentage) and redundancy (how much one feature duplicates the information of another). These metrics are asymmetric, meaning the value depends on which feature you consider the reference. The results can be visualised as matrices or as dendrograms (using hierarchical clustering) to spot groups of features that work together or are redundant.
  • Model simulation: It allows you to run virtual experiments by creating artificial copies of your data where a chosen feature is fixed to a specific value. The model then re-predicts the target for each such scenario, showing how the predicted outcome changes (the "uplift"). This helps identify which feature values lead to better or worse outcomes, and bootstrapping methods (e.g., stationary and stratified bootstraps) give a sense of uncertainty in the simulated changes.
  • Enhanced workflow: FACET builds on scikit-learn and adds a version (sklearndf) that works directly with pandas DataFrames, keeping full traceability of features. It also provides tools like Sample (to bundle observations and target), LearnerSelector (to compare hyperparameters and learners easily) and integration with standard cross-validation and grid search. This makes it easier to set up reliable model comparisons and then run inspections or simulations on the best model.

The library is installed via pip install gamma-facet or through Anaconda. A typical workflow involves creating a pipeline, training it with cross-validation, using LearnerSelector to pick the best model, then feeding that model into LearnerInspector for synergy/redundancy analysis or into UnivariateUpliftSimulator for feature simulation.

Who it’s for

Data scientists and machine learning engineers who work with supervised models (especially scikit-learn based) and need to explain, validate, or optimise their models beyond simple feature importance. It is particularly useful when there are complex interactions between features, or when you want to explore “what-if” scenarios to guide decisions. It is not limited to any specific industry.

Highlights

  • Provides global, feature-pair-level metrics (synergy and redundancy) that go beyond local explanations like SHAP.
  • Includes model simulation for virtual experiments, showing how changing a feature affects predictions, with bootstrapping to quantify uncertainty.
  • Works with pandas DataFrames via sklearndf, ensuring end-to-end traceability of features.
  • Offers a LearnerSelector to easily compare hyperparameters and multiple models.
  • Visualisation support for synergy and redundancy matrices, dendrograms, and simulation results.
  • Stable, open-source (Apache 2.0) and backed by BCG GAMMA.

Related

  • Project
  • Project
  • Project
  • Project