Source-linked AI summary

GeoShapley: A Game Theory Approach to Measuring Spatial Effects in Machine Learning Models

Ziqi Li

arXiv:2312.03675v2cs.LGstat.ML

TL;DR

Existing model explanations are not explicitly spatial, while location features and their interactions require dedicated treatment. GeoShapley addresses this gap by treating location as a player in a Shapley-based prediction game, and its explanations are validated against known data-generating processes and demonstrated on simulated and real-world data.

  • Problem

    Existing explanations are not explicitly spatial, and location features and their interactions require dedicated treatment in model interpretation.

  • Method

    GeoShapley extends the Shapley framework by treating location as a player and quantifying intrinsic location, interaction, and remaining model effects.

  • Results

    GeoShapley explanations are validated against true models with known data-generating processes and demonstrated using simulated and real-world data.

  • Takeaways & Limitations

    GeoShapley provides a model-agnostic tool whose interpretation links spatial effects with spatially varying coefficient models and non-spatial effects with additive models.

  • Takeaways & Limitations

    Empirical adoption of Shapley values faces a major computational challenge, and the current GeoShapley implementation has stated limitations and future directions.

Abstract

from arXiv · show

This paper introduces GeoShapley, a game theory approach to measuring spatial effects in machine learning models. GeoShapley extends the Nobel Prize-winning Shapley value framework in game theory by conceptualizing location as a player in a model prediction game, which enables the quantification of the importance of location and the synergies between location and other features in a model. GeoShapley is a model-agnostic approach and can be applied to statistical or black-box machine learning models in various structures. The interpretation of GeoShapley is directly linked with spatially varying coefficient models for explaining spatial effects and additive models for explaining non-spatial effects. Using simulated data, GeoShapley values are validated against known data-generating processes and are used for cross-comparison of seven statistical and machine learning models. An empirical example of house price modeling is used to illustrate GeoShapley's utility and interpretation with real world data. The method is available as an open-source Python package named geoshapley.

1 Introduction

Geospatial machine-learning models offer predictive advantages but are difficult to interpret spatially. GeoShapley addresses this gap by treating location as a player in the Shapley framework to measure spatial and non-spatial effects across model types.

  • 1 Introduction: Global interpretation methods can miss observation-specific feature contributions, motivating local explanations for individual predictions.Permutation importance and related methods often provide average explanations, while contributions may vary across observations.
  • 1 Introduction: Existing geospatial XAI applications primarily explain non-spatial nonlinearity or interactions rather than effects explicitly linked to location.The paper distinguishes general local interpretation from spatial effects involving location, nearby locations, and spatially varying relationships.
  • 1 Introduction: Simulated-data evidence indicates that SHAP explanations from XGBoost can approximate spatial effects similarly to the Spatial Lag Model and multi-scale geographically weighted regression.This comparison motivates XAI as a bridge between spatial statistical and machine-learning approaches.
  • 1 Introduction: Traditional spatial statistical approaches face challenges involving linearity assumptions, model specification and selection, and computational overhead.These challenges motivate using machine learning and XAI to examine more intricate spatial and non-spatial effects.
  • 1 Introduction: Off-the-shelf SHAP is limited because interaction values are supported only for tree-based models, restricting use with architectures such as neural networks.The limitation matters because spatial effects are treated as interaction effects and neural networks are increasingly used for geospatial modeling.
  • 1 Introduction: GeoShapley treats location and joint features as participants in the prediction game, measuring spatial and non-spatial effects in a model-agnostic way.The proposed method is intended for statistical and machine-learning models and is accompanied by efficient estimation algorithms and an open-source Python package.

2 Shapley value basics

Shapley values fairly allocate a model outcome among players by averaging marginal contributions across coalitions, while extensions support regression and prediction explanations. Classical computation is exponentially costly, motivating approximations such as Kernel SHAP, whose interpretation depends on background-data choices.

  • Shapley value: Shapley value assigns each player a weighted average of marginal contributions across all possible coalitions.The framework considers players joining coalitions and weights contributions according to coalition size.
  • Shapley value properties: The framework satisfies efficiency, symmetry, null-player, and additivity properties, yielding a fair and unique solution when all four hold.Efficiency requires contributions to sum to the total outcome, while the other properties govern equal, zero, and additive contributions.
  • Extensions: Shapley regression values allocate a model’s R2 among covariates by estimating regression models for combinations of covariates.This extends the coalition framework from game outcomes to coefficient-of-determination outcomes.
  • Prediction explanations: Shapley values also explain individual predictions additively, with each feature’s value representing its marginal contribution relative to a base value.This creates a direct connection between Shapley explanations and additive models such as linear regression.
  • Kernel SHAP: Kernel SHAP approximates missing features with a background dataset, where larger datasets reduce estimate variance but increase computation.Possible backgrounds include the full dataset, sampled or representative observations, or a single reference value.
  • Alternative estimators: Tree SHAP is more computationally efficient than Kernel SHAP but applies only to tree-based models.It also supports estimation of Shapley interaction effects.

3 GeoShapley

GeoShapley treats all location features as one joint player and decomposes predictions into intrinsic location, non-spatial, and location–feature interaction effects. It extends Kernel SHAP through a reduced joint-feature coalition space while preserving Shapley-based interpretations and providing an open-source implementation.

  • 3.1 Principles: GeoShapley groups location inputs into a single joint player to measure their combined marginal contribution while holding other features constant.This joint location effect is analogous to a spatial fixed effect or local intercept in geographically weighted regression.
  • Location features: The method accommodates coordinates or transformed location embeddings, but high-dimensional embeddings can be difficult to interpret individually.GeoShapley therefore interprets their collective contribution as a location effect rather than assigning meaning to each embedding dimension.
  • 3.1 Principles: Location–feature interaction values quantify spatially varying effects and correspond to spatially varying coefficient components in models such as GWR.For a GWR explanation, combining the non-spatial and interaction contributions yields location-specific coefficients.
  • 3.1 Principles: GeoShapley extends Kernel SHAP with joint location features, reducing the coalition space and adding columns for possible feature interactions.Two features can interact only when both are present in the feature set.
  • Implementation: GeoShapley values are estimated for observations and averaged over a background dataset using the same weighted least-squares procedure as Kernel SHAP.The method is implemented for pre-trained models through an open-source Python package compatible with several machine-learning libraries.
  • 3.1 Principles: GeoShapley decomposes each prediction into a base value, intrinsic location effect, location-invariant feature effects, and spatially varying interaction effects.If the model has no spatial effects, the location and interaction terms are zero and the decomposition reduces to the classic Shapley prediction form.

4 Simulated examples

The simulated experiments validate GeoShapley against known spatial and non-spatial data-generating processes, then compare its use across statistical and machine-learning models.

  • 4.1 Simulation design: The simulation combined three spatially varying processes with one linear and one nonlinear location-invariant process.This design provided known behaviors for benchmarking explanation accuracy.
  • 4.2 True model validation: The summary plot ranks feature contributions by GeoShapley value and encodes feature values by color across individual observations.Horizontal position represents the GeoShapley value, while accumulated dots show the distribution within each feature row.
  • 4.2 True model validation: GeoShapley values reflected the designed feature effects: X1 and X2 contributed similarly, X3 contributed about two-thirds as much, and X4 contributed only positively.The X1×GEO and X2×GEO interactions had similar magnitudes, while X3 and X4 showed no location interactions.
  • 4.2 True model validation: GeoShapley exactly recovered the simulated spatial and non-spatial processes, achieving 100% explanation accuracy on the true model.The reconstructed explanations matched the original data-generating process.
  • 4.3 GeoShapley applied to models: Across simulated models, MGWR achieved R² = 0.943, Random Forest achieved R² = 0.906, and other models reached R² values between 0.96 and 0.97.XGBoost outperformed Random Forest, while SVM, GP, and NN nearly captured both spatial and non-spatial effects.
  • 4.3 GeoShapley applied to models: GeoShapley is model-agnostic and supports comparison of estimated spatial effects across statistical and machine-learning model structures.The approach requires access to the original data, predictions, and prediction functions.

5 An empirical example of house price modeling

The house-price application uses GeoShapley to explain location and housing-feature effects in an XGBoost model. Location was the strongest contributor, with substantial geographic variation and weaker location–attribute interactions.

  • 5.1 Data and model: XGBoost outperformed all other models on the house-price data and was selected as the final model for computing GeoShapley values.Its residuals showed little-to-no spatial autocorrelation, with Moran’s I = 0.037.
  • 5.2 GeoShapley results: Housing characteristics such as living area and grade followed location in importance, while waterfront and view could increase value by nearly 50%.The reported effects are conditional on the other factors in the model.
  • 5.2 GeoShapley results: Location–housing interactions were weaker than the main non-spatial effects, although property age showed location-specific variation.The overall location–age interaction was weak, and age became insignificant for most houses older than 50.
  • 5.2 GeoShapley results: Location was the strongest house-price factor, changing predicted value by approximately −43% to +123% relative to the base value.Central and northern Seattle and Bellevue near Lake Washington had positive location contributions, while southern rural Seattle had negative contributions.
  • 5.2 GeoShapley results: Two otherwise identical properties could differ in price by approximately 3 to 4 times because of location.The comparison contrasts a property in Bellevue with one in southern rural Seattle.

6 Discussion

The discussion presents GeoShapley as a model-agnostic framework for explaining spatial and non-spatial effects in machine-learning models, while identifying inferential and computational limitations.

  • GeoShapley is model agnostic, enabling explanation and cross-comparison across linear, spatial, XGBoost, and neural-network models.Its Shapley framework and Kernel SHAP estimator avoid dependence on a model’s internal structure.
  • GeoShapley links machine-learning explanations to additive and spatially varying coefficient models, giving geographers familiar interpretations of spatial effects.
  • The framework addresses nonlinearities and interactions that make traditional spatial-model specification difficult, supporting analysis of complex relationships in large geospatial datasets.Traditional spatial models may require explicit interaction terms, nonlinear components, and transformations, creating specification and selection challenges.
  • GeoShapley can diagnose existing geospatial machine-learning models by identifying issues related to process accuracy rather than only overall predictive accuracy.
  • GeoShapley lacks formal inferential capabilities, although bootstrap confidence intervals can provide information about uncertainty in GeoShapley values.
  • Repeated model fitting and explanation create substantial computational overhead, making the approach more suitable when datasets and available hardware permit the cost.

7 Conclusion

The paper introduces GeoShapley as a Shapley-based explanation tool that treats location as a player and separates intrinsic spatial, interaction, and other effects. Its explanations are validated against known data-generating processes and demonstrated on simulated and real-world data.

  • GeoShapley treats location as a player in a model prediction game to measure spatial effects in machine learning models.
  • The method combines joint Shapley and Shapley interaction frameworks and estimates values using Kernel SHAP.
  • GeoShapley quantifies intrinsic location effects, location–feature interactions, and remaining linear or nonlinear effects.
  • GeoShapley explanations are validated against true models with known data-generating processes and demonstrated on simulated and real-world data.
  • GeoShapley is available as the open-source Python package geoshapley.

List of Figure Captions

The figure captions cover Shapley-value background, validation and true-process explanations, cross-model comparisons, feature contributions, and a house-price application. The final figures focus on housing-feature effects and location-related contributions to house prices.

  • Figure 1 illustrates the Shapley value and feature value under a linear regression system.
  • Figures 2, 5, and 6 depict validation, true-model explanation, and cross-comparison of GeoShapley explanations across various models.
  • Figure 7 presents a correlation matrix of the features used in predictive models.
  • Figures 8 and 9 summarize feature contribution rankings and distributions, including marginal relationships between housing features and house-price changes.
  • Figure 10 depicts house-price changes due to location and to the interaction between location and age.

Appendix A

Appendix A provides a summary-statistics table for GeoShapley values in the Seattle example.

  • Table A1 reports minimum, quartile, median, and maximum GeoShapley values for the Seattle example.

Appendix B

An experiment examines how background sample size affects the sampling variance of GeoShapley values. The variance decreases sharply after 20 samples and becomes negligible after 50.

  • Sampling variance decreases drastically after a background sample size of 20 and becomes negligible after 50.The experiment uses the validation dataset to assess this relationship.
  • The experiment evaluates GeoShapley sampling variance as a function of background sample size.
  • Figure B1 shows the effect of background sample size on GeoShapley sampling variance.
Loading 2312.03675v2…