Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ __pycache__/
.mypy_cache/
.ruff_cache/

outputs/
outputs/scenarios/
outputs/scenarios/*.csv
outputs/*
!outputs/real_cluster_mixture_stress_hw/
*.egg-info/
.DS_Store
.env
Expand Down
50 changes: 50 additions & 0 deletions data/scenario_dataset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Scenario dataset

Correlated binary default scenarios sampled from every generator, side-by-side,
across one real and two synthetic systems. Generated by
[`scripts/build_dataset.py`](../../scripts/build_dataset.py) and committed here so
it can be used without re-running the samplers.

Regenerate (deterministic — same seed reproduces these files):

```bash
uv run python scripts/build_dataset.py # -> data/scenario_dataset/
```

## Contents

`n_samples = 4000`, `seed = 12345`.

| source | kind | institutions | description |
|---|---|---|---|
| `real_gsib` | real | 38 | real G-SIB network + non-financial corporates (`build_system_spec`) |
| `synthetic_16` | synthetic | 16 | community-structured synthetic net (`make_synthetic_system`) |
| `synthetic_54` | synthetic | 54 | scale-free, ratings-based net, the n=54 hardware target (`make_scalable_system`) |

Generators (one file each per source): `bernoulli`, `gaussian_copula`,
`student_t_copula` (df=4), `entangled_born_machine`. The classical Ising
generator is intentionally excluded — it freezes into a degenerate all-default
state on sparse, low-PD networks.

Per source directory:

```
<source>/
spec.json # the SystemSpec (marginals, correlation, names, ...)
<source>__<generator>.csv # 4000 rows; one binary scenario per row; header = institutions
<source>__<generator>.npz # samples + node_names + target marginals/corr + seed
moments.json # per-generator fit quality + degeneracy flag
manifest.json # top-level index: shapes, seeds, moment errors
```

Each row is a scenario: `0` = institution survives, `1` = institution defaults.

## Notes

- On `real_gsib` the pairwise-correlation RMSE is high (~0.4) for **all**
generators. This is the rare-event wall, not a generator fault: at ~0.2%
default probabilities a co-default is essentially never observed in 4000
samples, so empirical correlation is dominated by noise. (This is the
motivation for the QAE tail-risk estimator.)
- `moments.json` carries a `degenerate` flag per generator (collapsed support or
marginals far off target) as a guard.
285 changes: 285 additions & 0 deletions data/scenario_dataset/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
{
"n_samples": 4000,
"seed": 12345,
"sources": {
"real_gsib": {
"kind": "real",
"n_institutions": 38,
"node_names": [
"JPMorgan Chase",
"Bank of America",
"Citigroup",
"Wells Fargo",
"Goldman Sachs",
"Morgan Stanley",
"U.S. Bancorp",
"PNC Financial",
"Truist Financial",
"Bank of New York Mellon",
"State Street",
"HSBC Holdings",
"Barclays",
"Lloyds Banking Group",
"Deutsche Bank",
"Banco Santander",
"Banco Bilbao Vizcaya Argentaria",
"ING Groep",
"UBS Group",
"Mitsubishi UFJ Financial Group",
"Sumitomo Mitsui Financial Group",
"Mizuho Financial Group",
"Nomura Holdings",
"Royal Bank of Canada",
"Toronto-Dominion Bank",
"Bank of Nova Scotia",
"Itau Unibanco",
"Banco Bradesco",
"Apple",
"Microsoft",
"ExxonMobil",
"Walmart",
"Boeing",
"AT&T",
"Toyota Motor",
"Volkswagen",
"Siemens",
"Petrobras"
],
"marginals_mean": 0.0023318421052631578,
"generators": {
"bernoulli": {
"shape": [
4000,
38
],
"fit_sample_seconds": 0.0,
"marginal_rmse": 0.0006052424481582826,
"mean_default_rate": 0.0023947368421052633,
"n_unique_scenarios": 54,
"corr_rmse": 0.46893489166667135,
"degenerate": false
},
"gaussian_copula": {
"shape": [
4000,
38
],
"fit_sample_seconds": 0.04,
"marginal_rmse": 0.0008746442885990552,
"mean_default_rate": 0.0022500000000000003,
"n_unique_scenarios": 72,
"corr_rmse": 0.44637849208606306,
"degenerate": false
},
"student_t_copula": {
"shape": [
4000,
38
],
"fit_sample_seconds": 24.7,
"marginal_rmse": 0.0009536301832030011,
"mean_default_rate": 0.002348684210526316,
"n_unique_scenarios": 72,
"corr_rmse": 0.3678959557141127,
"degenerate": false
},
"entangled_born_machine": {
"shape": [
4000,
38
],
"fit_sample_seconds": 0.41,
"marginal_rmse": 0.0006326136261573885,
"mean_default_rate": 0.002111842105263158,
"n_unique_scenarios": 53,
"corr_rmse": 0.43856411668045475,
"degenerate": false
}
}
},
"synthetic_16": {
"kind": "synthetic",
"n_institutions": 16,
"node_names": [
"Global Bank A",
"Global Bank B",
"Regional Bank",
"Mortgage Lender",
"Life Insurer",
"Reinsurer",
"Pension Fund",
"Credit Fund",
"Real Estate Fund",
"Industrial Corporate",
"Energy Corporate",
"Retail Corporate",
"Sovereign A",
"Sovereign B",
"Central Counterparty",
"Payments Utility"
],
"marginals_mean": 0.025995866928254723,
"generators": {
"bernoulli": {
"shape": [
4000,
16
],
"fit_sample_seconds": 0.0,
"marginal_rmse": 0.002368869422939838,
"mean_default_rate": 0.02540625,
"n_unique_scenarios": 122,
"corr_rmse": 0.19247607671412983,
"degenerate": false
},
"gaussian_copula": {
"shape": [
4000,
16
],
"fit_sample_seconds": 0.06,
"marginal_rmse": 0.0030662549019893222,
"mean_default_rate": 0.024781249999999998,
"n_unique_scenarios": 176,
"corr_rmse": 0.0626639935705719,
"degenerate": false
},
"student_t_copula": {
"shape": [
4000,
16
],
"fit_sample_seconds": 3.96,
"marginal_rmse": 0.002111160411327338,
"mean_default_rate": 0.024484375,
"n_unique_scenarios": 195,
"corr_rmse": 0.04798423846096638,
"degenerate": false
},
"entangled_born_machine": {
"shape": [
4000,
16
],
"fit_sample_seconds": 0.51,
"marginal_rmse": 0.02178975788255229,
"mean_default_rate": 0.033828125,
"n_unique_scenarios": 271,
"corr_rmse": 0.11819369361000172,
"degenerate": false
}
}
},
"synthetic_54": {
"kind": "synthetic",
"n_institutions": 54,
"node_names": [
"Global Bank A",
"Global Bank B",
"Continental Bank",
"Regional Bank",
"Community Bank",
"Mortgage Lender",
"Trade Finance Bank",
"Investment Bank",
"Merchant Bank",
"Universal Bank",
"Savings Bank",
"Commercial Bank",
"Private Bank",
"Custody Bank",
"Cooperative Bank",
"Digital Bank",
"Pension Fund",
"Credit Fund",
"Real Estate Fund",
"Money Market Fund",
"Hedge Fund",
"Sovereign Wealth Fund",
"Mutual Fund",
"Asset Manager",
"Private Equity Fund",
"Infrastructure Fund",
"Bond Fund",
"Equity Fund",
"Industrial Corporate",
"Energy Corporate",
"Retail Corporate",
"Transport Corporate",
"Telecom Corporate",
"Utility Corporate",
"Healthcare Corporate",
"Materials Corporate",
"Consumer Goods Corporate",
"Technology Corporate",
"Construction Corporate",
"Aerospace Corporate",
"Life Insurer",
"Reinsurer",
"Health Insurer",
"Property Insurer",
"Casualty Insurer",
"Credit Insurer",
"Title Insurer",
"Sovereign A",
"Sovereign B",
"Sovereign C",
"Sovereign D",
"Central Counterparty",
"Payments Utility",
"Securities Depository"
],
"marginals_mean": 0.012170370370370373,
"generators": {
"bernoulli": {
"shape": [
4000,
54
],
"fit_sample_seconds": 0.0,
"marginal_rmse": 0.0013196169477878378,
"mean_default_rate": 0.011999999999999999,
"n_unique_scenarios": 313,
"corr_rmse": 0.020914191448296073,
"degenerate": false
},
"gaussian_copula": {
"shape": [
4000,
54
],
"fit_sample_seconds": 0.82,
"marginal_rmse": 0.0018608291660400175,
"mean_default_rate": 0.012407407407407407,
"n_unique_scenarios": 367,
"corr_rmse": 0.03176753134435303,
"degenerate": false
},
"student_t_copula": {
"shape": [
4000,
54
],
"fit_sample_seconds": 56.59,
"marginal_rmse": 0.001813708090359923,
"mean_default_rate": 0.01261111111111111,
"n_unique_scenarios": 400,
"corr_rmse": 0.1005041548982943,
"degenerate": false
},
"entangled_born_machine": {
"shape": [
4000,
54
],
"fit_sample_seconds": 0.0,
"marginal_rmse": 0.0015610863975900695,
"mean_default_rate": 0.011819444444444445,
"n_unique_scenarios": 317,
"corr_rmse": 0.01611964525281019,
"degenerate": false
}
}
}
}
}
30 changes: 30 additions & 0 deletions data/scenario_dataset/real_gsib/moments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"bernoulli": {
"marginal_rmse": 0.0006052424481582826,
"mean_default_rate": 0.0023947368421052633,
"n_unique_scenarios": 54,
"corr_rmse": 0.46893489166667135,
"degenerate": false
},
"gaussian_copula": {
"marginal_rmse": 0.0008746442885990552,
"mean_default_rate": 0.0022500000000000003,
"n_unique_scenarios": 72,
"corr_rmse": 0.44637849208606306,
"degenerate": false
},
"student_t_copula": {
"marginal_rmse": 0.0009536301832030011,
"mean_default_rate": 0.002348684210526316,
"n_unique_scenarios": 72,
"corr_rmse": 0.3678959557141127,
"degenerate": false
},
"entangled_born_machine": {
"marginal_rmse": 0.0006326136261573885,
"mean_default_rate": 0.002111842105263158,
"n_unique_scenarios": 53,
"corr_rmse": 0.43856411668045475,
"degenerate": false
}
}
Loading
Loading