Skip to main content
QUICK REVIEW

[Paper Review] Shapley Decomposition of R-Squared in Machine Learning Models

Nickalus Redell|arXiv (Cornell University)|Aug 26, 2019
Explainable Artificial Intelligence (XAI)Computer Science18 references18 citations
TL;DR

This paper introduces a model-agnostic, Shapley-value-based R-squared decomposition that fairly allocates explained variance in machine learning models to individual features, ensuring feature-level contributions sum to the overall R². The method leverages pre-computed Shapley values to avoid iterative model retraining, enabling efficient computation with minimal overhead in gradient boosted trees and neural networks.

ABSTRACT

In this paper we introduce a metric aimed at helping machine learning practitioners quickly summarize and communicate the overall importance of each feature in any black-box machine learning prediction model. Our proposed metric, based on a Shapley-value variance decomposition of the familiar $R^2$ from classical statistics, is a model-agnostic approach for assessing feature importance that fairly allocates the proportion of model-explained variability in the data to each model feature. This metric has several desirable properties including boundedness at 0 and 1 and a feature-level variance decomposition summing to the overall model $R^2$. In contrast to related methods for computing feature-level $R^2$ variance decompositions with linear models, our method makes use of pre-computed Shapley values which effectively shifts the computational burden from iteratively fitting many models to the Shapley values themselves. And with recent advancements in Shapley value calculations for gradient boosted decision trees and neural networks, computing our proposed metric after model training can come with minimal computational overhead. Our implementation is available in the R package shapFlex.

Motivation & Objective

  • To develop a model-agnostic, global feature importance metric that fairly distributes explained variance in machine learning models.
  • To address the limitations of traditional R² in non-linear models by using Shapley values to decompose variance without refitting models.
  • To provide a stable, bounded (0 to 1) metric that sums to the overall model R², enhancing interpretability and communication of model behavior.
  • To reduce computational burden by shifting from iterative model fitting to pre-computed Shapley values, especially feasible with modern Tree SHAP and neural network approximations.
  • To bridge classical statistical R² with modern machine learning interpretability, supporting practical model analysis and communication.

Proposed method

  • The method uses a Shapley-value-based variance decomposition to attribute the total R² of a model to each individual feature.
  • It computes feature-level R² as the proportion of model-explained variance uniquely attributable to each feature via cooperative game theory.
  • The approach relies on pre-computed Shapley values, avoiding the need to retrain models on subsets of features.
  • The decomposition ensures that the sum of individual feature R² contributions equals the overall model R², preserving variance additivity.
  • The method is implemented in the R package shapFlex, using the r2() function for efficient computation on trained models.
  • It is compatible with both linear and non-linear models, including gradient boosted trees and neural networks, especially when using Tree SHAP for exact Shapley value computation.

Experimental results

Research questions

  • RQ1Can a Shapley-value-based R² decomposition fairly and efficiently allocate explained variance to features in non-linear machine learning models?
  • RQ2How stable is the feature-level R² decomposition across varying levels of model overfitting and hyperparameter tuning?
  • RQ3Does the proposed metric maintain boundedness (0 to 1) and sum-to-R² properties in complex, non-linear models?
  • RQ4To what extent does feature correlation affect the validity and stability of the Shapley-based R² decomposition?
  • RQ5Can this metric be applied effectively to both training and test data, and how does it perform in hierarchical or time-structured data?

Key findings

  • The proposed R² feature importance metric is stable across model complexity, with unique variance contributions (σ_unique) decreasing predictably from ~0.88 to ~0.68 as R² increased from 0.05 to 0.50 in the wine quality dataset.
  • In the forest fires dataset, σ_unique decreased from ~0.86 to ~0.67 over the same R² range, indicating consistent behavior across datasets with similar feature correlation (mean ~0.17).
  • The similarity in σ_unique trends across datasets suggests a potential link between feature correlation and the stability of Shapley-based variance decomposition.
  • The metric maintains boundedness (0 to 1) and sum-to-R² properties, confirming its theoretical soundness and interpretability.
  • Computational efficiency is achieved via pre-computed Shapley values, particularly with Tree SHAP, enabling near-instantaneous R² decomposition after model training.
  • The method shows promise for practical use in model interpretation, especially when communicating feature importance to non-technical stakeholders.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.