SHGR: A Generalized Maximal Correlation Coefficient

Samuel Stocksieker, Denys PommeretNeurIPS 2025

TL;DR

Researchers have introduced SHGR (Spearman Hirschfeld-Gebelein-Rényi), a new way to measure complex, nonlinear relationships between variables by combining deep learning with rank-based statistics. By maximizing Spearman’s correlation rather than Pearson’s, SHGR provides a robust, scalable, and differentiable tool that detects hidden dependencies while remaining immune to the "hallucinations" and outliers that plague traditional methods.

What Problem Does This Paper Address?

In data science, we often rely on Pearson’s correlation to see if two things are related. But Pearson only looks for straight lines. If your data has a U-shape or a complex wiggle, Pearson might say there is "zero correlation" when a clear relationship actually exists.

The Hirschfeld-Gebelein-Rényi (HGR) maximal correlation coefficient was designed to fix this by finding the best possible nonlinear transformations to reveal a relationship. However, HGR is notoriously hard to estimate. Recent neural network-based attempts to solve this often suffer from two major flaws:

  1. Sensitivity to Outliers: A single extreme data point can trick the model into seeing a strong correlation where none exists.
  2. Hallucinations: In high-noise environments, complex neural networks can "overfit" to random noise, reporting a high correlation between completely independent variables.

Methods

The authors propose SHGR, which swaps out the standard Pearson-based objective for a Spearman rank-based one.

Key technical innovations include:

  • Copula-based Formulation: By operating on the ranks of the data rather than the raw values, the measure becomes naturally invariant to monotonic transformations and highly robust to outliers.
  • Stacked Cross-Encoders: Instead of training a separate model for every pair of variables, the authors designed a neural architecture that can estimate an entire correlation matrix (bivariate, multivariate, or groupwise) simultaneously.
Neural architectures for estimating bivariate and full correlations using SHGR.
  • Differentiable Sorting: Since "ranking" data is usually not a differentiable operation (you can't take a gradient of a sort), they utilize TorchSort. This allows the entire system to be trained end-to-end using standard backpropagation.
  • Rényi Axiom Compliance: The authors mathematically prove that SHGR satisfies the fundamental axioms of a "good" dependence measure, such as being zero if and only if variables are independent and being bounded between 0 and 1.

Datasets

The paper validates SHGR across a rigorous battery of tests:

  • Synthetic Benchmarks: Data generated with specific nonlinear relationships (cubic, sinusoidal, exponential, and quadratic) and varying levels of additive white noise.
  • Real-World Tabular Data: Nine diverse datasets from the UCI Machine Learning Repository used for feature selection tasks, including Abalone, AirQuality, Appliance Energy, Boston Housing, and Concrete Compressive Strength.

Key Insights and Ideas

  • Ranks are a Shield: The "aha moment" here is that by forcing the neural network to look at ranks (Spearman) instead of raw values (Pearson), you prevent the model from "cheating" by stretching the axes to focus on a few extreme outliers.
  • Efficiency through Architecture: Most HGR estimators are slow because they are iterative or kernel-based. SHGR’s stacked encoder approach makes it computationally competitive, allowing it to process 1,000 variables in about a minute.
  • Significance Testing: Unlike many black-box dependence measures, SHGR allows for formal hypothesis testing. You can actually calculate a p-value to decide if a detected correlation is statistically significant or just noise.

Key Results

  • Robustness to Noise: In "noisy" settings, SHGR consistently outperformed state-of-the-art baselines like ACE (Alternating Conditional Expectations) and RDC (Randomized Dependence Coefficient). While ACE performs well on clean data, its accuracy plummets as noise increases; SHGR remains remarkably stable.
Performance comparison showing SHGR's minimal distance to the reference correlation matrix against baseline methods.
  • Zero Hallucinations: When tested on completely independent variables, SHGR correctly reported near-zero correlation, whereas other neural-based HGR methods often "hallucinated" correlations as high as 0.4 or 0.5.
  • Feature Selection: In real-world regression tasks, selecting features based on SHGR led to lower Root Mean Squared Error (RMSE) compared to using standard Pearson or Spearman coefficients, proving that it captures "useful" nonlinear information that other measures miss.

Limitations and Future Work

While SHGR is a significant step forward, the authors acknowledge a few hurdles:

  • Interpretability: Like most HGR-based measures, knowing that a high correlation exists is easier than explaining what that relationship looks like in plain English (though the authors provide visualization tools to help).
  • Hyperparameter Tuning: The "expressiveness" of the neural network is a double-edged sword. If the network is too small, it misses dependencies; if it's too large, it might still overfit, requiring careful calibration of the "stacked" architecture.
  • High-Dimensional Scaling: While fast, the behavior of these measures in extremely high-dimensional spaces (thousands of features with few samples) remains an open research question.

The authors have made their code available on GitHub, inviting the community to integrate SHGR into modern deep learning pipelines and fairness-aware AI applications.

Summary updated

BibTeX
@inproceedings{stocksieker2025shgr,
  author = {Samuel Stocksieker and Denys Pommeret},
  title = {{SHGR: A Generalized Maximal Correlation Coefficient}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=c1snZ9dvCR},
}
Figure