This repository contains the official PyTorch implementation of Causal Manifold Fairness (CMF).
CMF is a novel framework that approaches fairness through the lens of Riemannian Geometry. Instead of simply aligning data points in a latent space, CMF enforces that the geometry (the local metric and curvature) of the learned representation remains invariant under counterfactual interventions on sensitive attributes.
Standard fairness methods often treat data as static points. However, sensitive attributes (like Age or Gender) often act as parameters that warp the manifold of the data—stretching, compressing, or twisting the relationship between features.
The Goal: Learn a representation
-
Left (Baseline): The model separates data based on the sensitive attribute
$A$ (Red vs Blue). It learns the bias. - Right (CMF): The model aligns the distributions. Crucially, the intrinsic manifold structure (color gradient) is preserved.
Clone the repo and install dependencies:
git clone https://github.com/your-username/causal-manifold-fairness.git
cd causal-manifold-fairness
pip install torch numpy matplotlib seaborn pandasTo train both the Baseline and CMF models, and generate the visualizations/metrics:
python main.pyNote: The script calculates second-order derivatives (Hessians) which can be computationally intensive.

