garch_densities / README.md
thijs-simu-ai's picture
fixed usage
ab195d3
|
Raw
History Blame Contribute Delete
4.4 kB
---
pretty_name: GARCH Densities
license: cc-by-4.0
task_categories: [other]
language: [en]
tags: [garch, finance, density-estimation, time-series]
size_categories: [10M<n<100M]
configs:
- config_name: default
default: true
data_files:
- split: train
path: data/train/*.parquet
- split: test
path: data/test/*.parquet
- split: sample
path: data/sample/*.parquet
---
# GARCH Densities Dataset
GJR-GARCH simulations with Hansen skewed-t innovations, for option pricing and risk modeling. Each row pairs a parameter set Θ with **inverse-CDF quantiles** of terminal returns at a given maturity step.
![Example CDF and derived PDF curves](cdf_and_pdf_comparison.png)
## Dataset Description
Each example is a tuple *(Θ, ti, x)* where:
- **Θ** = (`alpha`, `gamma`, `beta`, `var0`, `eta`, `lam`)
- **`ti`** = maturity **step index** (integer steps)
- **`x`** = vector of **Q=512** quantiles at probabilities
**p = linspace(0.001, 0.999, 512)**
Parameters are sampled by **Sobol** low-discrepancy sequences under the persistence constraint \( \alpha + \gamma + \beta < 0.95 \).
### Features
- `alpha` (float32) — persistence term
- `gamma` (float32) — effective leverage term (GJR component)
- `beta` (float32) — persistence term
- `var0` (float32) — initial variance \( \sigma_0^2 \), log-uniform in [1/30, 30]
- `eta` (float32) — skewed-t degrees of freedom \( \nu \), log-uniform in [4, 100]
- `lam` (float32) — skewed-t skew \( \lambda \) in [-0.98, 0.98]
- `ti` (float32) — maturity step index [1, 1000]
- `x` (list<float32>[512]) — quantiles of normalized terminal return \( R_T \) at p above
_All numeric columns are float32 for I/O efficiency._
### Parameter Sampling
- (`alpha`, `gamma`, `beta`) with \( \alpha + \gamma + \beta < 0.95 \)
- \( \nu \in [4, 100] \) (log-uniform), \( \lambda \in [-0.98, 0.98] \) (uniform)
- \( \sigma_0^2 \in [1/30, 30] \) (log-uniform)
## Dataset Statistics
- **Train:** 110 shards, ~145 MB each
- **Test:** 29 shards, ~145 MB each
- **Row groups:** zstd compression, ~64–128 MiB target (streaming-friendly)
![Parameter Distributions](parameter_distributions.png)
![Parameter Correlations](parameter_correlations.png)
## Usage
### Recommended loading
```python
from datasets import load_dataset
ds = load_dataset("sitmo/garch_densities", token=False) # -> DatasetDict(train/test/sample)
train, test = ds["train"], ds["test"]
print(train)
print(train.features)
```
### PyTorch formatting
```python
import torch
from torch.utils.data import DataLoader
param_cols = ["alpha","gamma","beta","var0","eta","lam","ti"]
cols = param_cols + ["x"]
train = train.with_format("torch", columns=cols)
loader = DataLoader(train, batch_size=256, shuffle=True, num_workers=4, pin_memory=torch.cuda.is_available())
batch = next(iter(loader))
params = torch.stack([batch[c] for c in param_cols], dim=1) # [B,7]
targets = batch["x"] # [B,512]
print(params.shape, targets.shape)
```
### Inspect a sample
```python
ex = train[0]
len(ex["x"]) # 512
```
## Methodology
1. **Sobol sampling** of Θ in 6D under \( \alpha+\gamma+\beta<0.95 \)
2. **Monte Carlo**: GJR-GARCH with Hansen skewed-t innovations
3. **Quantiles**: empirical quantiles of terminal returns on p = linspace(0.001, 0.999, 512)
4. **Performance**: inverse-CDF accelerations for skewed-t sampling
## Train/Test Split
- **Train:** 10,000,000 paths per case
- **Test:** 10,000,000 paths per case
- Independent parameter cases; split preserves Sobol low-discrepancy structure.
## Applications
- Option pricing across strikes (quantile-based)
- VaR / CVaR risk metrics
- Learning \( \Theta \mapsto \) return distribution (NNs)
- Validation/benchmarking of GARCH implementations
## Limitations
- Restricted to GJR-GARCH with Hansen skewed-t
- Fixed parameter ranges
- Finite MC precision and finite quantile grid resolution (512 points)
## Provenance
- Synthetic data from our simulator (GJR-GARCH + Hansen skewed-t)
- Parquet: **zstd**, row groups ~64–128 MiB, shards ~145 MB
## Citation
```bibtex
@dataset{garch_densities_2025,
title = {GARCH Densities Dataset},
author = {Thijs van den Berg, Paul Wilmott},
year = {2025},
url = {https://huggingface.co/datasets/sitmo/garch-densities}
}
```