# Stealthily Biased Sampling Eval

> This evaluation probes a decision-maker's ability to stealthily sample a subset of a dataset to artificially satisfy fairness metrics (Demographic Parity) while remaining statistically indistinguishable from the original data distribution. It measures how well biased sampling algorithms can evade detection by ideal auditors using distributional tests like Kolmogorov-Smirnov or Wasserstein distance. Use when the user wants to benchmark on Synthetic Loan Check, COMPAS, Adult, or asks about evaluating this task. Reports Demographic Parity (DP).

- Skill: `qhjqhj00/stealthily-biased-sampling-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/stealthily-biased-sampling-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/stealthily-biased-sampling-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/stealthily-biased-sampling-eval

---


# stealthily-biased-sampling-eval

> Faking Fairness via Stealthily Biased Sampling — Fukuchi et al. (2019) (arXiv:1901.08291, 2019)

## What this evaluates

This evaluation probes a decision-maker's ability to stealthily sample a subset of a dataset to artificially satisfy fairness metrics (Demographic Parity) while remaining statistically indistinguishable from the original data distribution. It measures how well biased sampling algorithms can evade detection by ideal auditors using distributional tests like Kolmogorov-Smirnov or Wasserstein distance.

## Datasets

- **Synthetic Loan Check** — total 1000; splits: sampling_pool (1000), referential (200); repo https://github.com/sato9hara/stealthily-biased-sampling
- **COMPAS** — total 5278; splits: sampling_pool (4000), referential (1278); repo https://github.com/sato9hara/stealthily-biased-sampling
- **Adult** — total 48842; splits: train (10000), test (20000), referential (18842); repo https://github.com/sato9hara/stealthily-biased-sampling

## Metrics

- `Demographic Parity (DP)` **(primary)** — range: [0, 1]
  - DP = |P(y=1|s=1) - P(y=1|s=0)|, where y is the binary decision and s is the binary sensitive attribute. Values closer to 0 indicate higher fairness.
- `Kolmogorov-Smirnov (KS) rejection rate` — range: [0, 1]
  - Binary indicator of whether the two-sample KS test rejects the null hypothesis that the feature distributions of the sampled subset Z and referential dataset D' are identical, at a significance level of 0.05.
- `Wasserstein Distance (WD)` — range: other
  - Minimum-cost flow distance between the empirical distributions of Z and D', computed using squared Euclidean distance d(x_i, x_j) = ||x_i - x_j||^2 as the ground metric.

## Input / output format

**Input**: A dataset D containing feature vectors x, sensitive attributes s, and decisions y. A held-out referential dataset D' containing features x and sensitive attributes s sampled from the underlying distribution.

**Output**: A sampled subset Z ⊆ D of a specified size, along with computed fairness metrics (DP) and detection metrics (KS rejection rate or WD) comparing Z to D'.

## Scoring recipe

```python
def compute_dp(y, s):
    p1 = mean(y[s == 1])
    p0 = mean(y[s == 0])
    return abs(p1 - p0)

def compute_ks_rejection(x_z, x_d_prime, alpha=0.05):
    _, p_val = ks_2samp(x_z, x_d_prime)
    return 1 if p_val < alpha else 0

def compute_wd(x_z, x_d_prime):
    # Solve min-cost flow with squared Euclidean distance
    return min_flow_cost(x_z, x_d_prime)
```

## Common pitfalls

- The synthetic experiment's detector assumes knowledge of the single predictive feature (income), whereas real auditors must use multi-dimensional tests which the authors note have very low power.
- The Adult dataset experiment relies on classifier-generated labels (y) rather than ground-truth outcomes, meaning the fairness audit applies to model predictions, not raw data.
- The referential dataset D' is strictly held out for distribution comparison and is not used to guide the sampling process, differing from standard cross-validation or training setups.

## Evidence (verbatim from paper)

> In the experiments, we adopted the demographic parity (DP) as the fairness metric for auditing. Here, let s∈{0,1} be a sensitive feature and y∈{0,1} be a decision. The DP is then defined as DP=|P(y=1|s=1)−P(y=1|s=0)|. A large DP indicates that the decision is unfair because the decision-maker favors providing positive decisions to one group over the other group.

## Citation

```bibtex
@misc{fukuchi2019fakingfairness,
  title={Faking Fairness via Stealthily Biased Sampling},
  author={Fukuchi et al. (2019)},
  year={2019},
  note={arXiv:1901.08291}
}
```

- arXiv: 1901.08291

