# Rosa real-world multi-class test pack

Two datasets built from real US survey microdata, with the configuration we ran them with, so you can run
Rosa on a real multi-group characteristic yourself and compare your results with ours. The nine-group
dataset is the main one: on it, Rosa removed about three quarters of the measured bias on average, for about two
percentage points of downstream accuracy. The
three-group dataset is a second test, and on it removal was weaker.

## What is in the pack

| file | what it is |
|---|---|
| `acs_fl_hisp_k9_train.csv` | nine groups: training file, 12,242 rows |
| `acs_fl_hisp_k9_holdout.csv` | nine groups: held-out file, 8,161 rows |
| `acs_fl_hisp_k9_config.json` | the Rosa configuration for both nine-group files |
| `acs_fl_hisp_k3_train.csv` | three groups: training file, 8,608 rows |
| `acs_fl_hisp_k3_holdout.csv` | three groups: held-out file, 5,739 rows |
| `acs_fl_hisp_k3_config.json` | the Rosa configuration for both three-group files |

## The data

**Source.** The US Census Bureau's American Community Survey (ACS) Public Use Microdata Sample, 2018
one-year, for Florida, retrieved with the `folktables` package (Ding, Hardt, Miller and Schmidt, 2021,
*Retiring Adult: New Datasets for Fair Machine Learning*). The ACS microdata are public, released under
the Census Bureau's terms of service, and need no registration or data use agreement.

**People included.** Respondents aged 17 or over, with personal income above $100 and a positive number of
usual weekly working hours, who reported a Hispanic origin.

**The bias characteristic is `origin`, detailed Hispanic origin,** restricted to the most common origins in
Florida. These are real national-origin groups at their real, uneven sizes:

- nine groups: Cuban, Puerto Rican, Mexican, Colombian, Venezuelan, Dominican, Nicaraguan, Peruvian and
  Honduran
- three groups: the three largest of those, Cuban, Puerto Rican and Mexican, with the other six left out
  rather than merged in

**Columns.**

| column | meaning | how the configuration treats it |
|---|---|---|
| `audit_row_id` | a unique row identifier we added | ignored (passed through untouched) |
| `AGEP` | age in years | numeric |
| `WKHP` | usual hours worked per week | numeric |
| `COW` | class of worker | categorical |
| `SCHL` | educational attainment | categorical |
| `MAR` | marital status | categorical |
| `RELP` | relationship to the household reference person | categorical |
| `SEX` | sex | categorical |
| `origin` | detailed Hispanic origin | the bias characteristic |
| `income_gt_50k` | 1 if personal income is above $50,000, otherwise 0 | ignored (passed through untouched) |

Both datasets are well inside the trial's post-encoding limit of 150. Two ACS columns you might expect are left
out deliberately: occupation has 529 categories and place of birth 219, so either one alone would exceed
that limit if declared categorical.

**The split.** Each dataset was split 60/40 into training and held-out files, stratified on `origin`, with a
fixed seed. No values were altered: every file is a selection of rows and columns from the survey.

**Group sizes.** In the nine-group training file the smallest group, Honduran, has 344 rows and the largest,
Cuban, 4,291. Rosa trains on a representative sample of about 10,000 rows, so in the sample it actually
trains on the smallest group is about 257 to 286 rows. The three-group training file is under 10,000 rows,
so it is not sampled; its smallest group, Mexican, has 1,618.

## How to run it

For each group count:

1. Submit the training file to `remove_bias_training` (or `diagnose`) with its configuration file.
2. Submit the held-out file to `remove_bias_inference`, naming the training job you just ran.

The configuration declares `origin` as the bias characteristic, the five survey categoricals and `origin` as
categorical, and the outcome and row identifier as ignored.

**To confirm you ran exactly our files,** compare the `input_hash` on your Run Manifest with the SHA-256
below. On every one of our recorded runs they matched.

| file | SHA-256 |
|---|---|
| `acs_fl_hisp_k3_train.csv` | `29ea831497f3b2c7158fb3f590f69c434543211b34d97c1f39b7669c92dab720` |
| `acs_fl_hisp_k3_holdout.csv` | `dddb4120639cf4513b250960a16dce97c4dfcb0209292747d5feef6f64d88ab2` |
| `acs_fl_hisp_k9_train.csv` | `5b4ddb667eed9f701916e3dc94307369cc0ddfa20e2b67bd96cb882f34bc5b14` |
| `acs_fl_hisp_k9_holdout.csv` | `87b0b7a0b88bead7a9578c815c17d366f5811743a6deca6b8472346dffbc0c51` |

## What we measured

Ten training runs and ten inference runs at each group count, on Rosa v1.61.0 (image `sha256:9c815f4e`).

| | nine groups | three groups |
|---|---|---|
| rows in the smallest group, in the sample Rosa trained on | 257 to 286 | 1,618 |
| rows of the smallest group scored in the held-out test | 41 to 54 | 283 to 311 |
| detected | 10 of 10 | 10 of 10 |
| mean measured bias | 0.083 | 0.191 |
| mean residual bias after debiasing | 0.022 | 0.127 |
| share of the measured bias removed, mean (range) | 74% (57% to 91%) | 33% (26% to 42%) |
| residual still detected after debiasing | 4 of 10 | 10 of 10 |
| accuracy change, logistic regression (gradient boosting) | -1.8 points (-2.5) | -0.3 points (-0.7) |

**On nine groups, Rosa removed about three quarters of the measured bias:** a mean of 74% across the ten
runs, and from 57% to 91% run by run. The cost to accuracy was about two percentage points. A logistic regression predicting whether
income is above $50,000 went from 80.5% accurate on the original data to 78.7% on Rosa's output, a fall
of 1.8 points (from 1.3 to 2.3 across the runs); gradient boosting fell by 2.5 points. On 6 of the 10 runs Rosa's own residual test no longer detected the
characteristic after debiasing. **Detection held on every run**, each at p = 0.04, the finest the trial's
test can resolve.

**Independent probes confirm the reduction and put it lower.** A class-weighted logistic regression, a
small neural network and gradient boosting, each scored on balanced accuracy and on AUC, found national
origin less recoverable after Rosa on every run, removing between 35% and 53% of their excess over chance
at nine groups. All three still recovered it above chance after debiasing, at both group counts: Rosa
reduced how recoverable the characteristic was, and did not take it to chance.

**Accuracy is scored against the survey's own income label**, because real data has no fair outcome to
score against, so these figures are the cost in predictive accuracy, not a measure of how fair the
model's decisions became. Each model was trained on the same rows Rosa trained on and scored on the
held-out file, ten runs at each group count.

**A limit, on the three largest groups on their own.** The three-group dataset started from a measured
bias more than twice as strong, and there Rosa removed about a third of it (a mean of 33%, from 26% to
42%). With less removed, accuracy also fell less there: 0.3 points on
logistic regression and 0.7 on gradient boosting. Its own residual test still detected the characteristic on every run. We have not isolated why
removal was weaker on this dataset, so do not assume the nine-group result carries over to your data:
read the residual verdict on your own report.

**Your own runs will not reproduce these numbers exactly.** Rosa is stochastic and exposes no seed, so read
your results against the ranges above rather than against a single figure. If you score recoverability with
your own probe, quote the probe family and the metric with the result: on these two datasets, before any
debiasing, balanced accuracy and AUC ranked the same fitted probes in opposite orders.
