torot_data_5M / README.md
ivanjaenm's picture
Dataset card: license, code link, cost types
aa0fa8e verified
|
Raw History Blame Contribute Delete
4.22 kB
---
license: mit
pretty_name: ToR-OT synthetic discrete OT instances
dataset_info:
features:
- name: n
dtype: int32
- name: m
dtype: int32
- name: dim
dtype: int32
- name: cost_type
dtype:
class_label:
names:
'0': sqeuclidean
'1': euclidean
'2': canberra
'3': sqrt_euclidean
'4': cubic_euclidean
'5': gaussian
- name: family_src
dtype: string
- name: family_tgt
dtype: string
- name: coords_src
list:
list: float64
- name: coords_tgt
list:
list: float64
- name: a
list: float64
- name: b
list: float64
- name: plan_rows
list: int32
- name: plan_cols
list: int32
- name: plan_vals
list: float64
- name: ot_cost
dtype: float64
- name: seed
dtype: int64
splits:
- name: train
num_bytes: 19249854200
num_examples: 5000000
- name: val
num_bytes: 9494824
num_examples: 2500
- name: test_id
num_bytes: 19330928
num_examples: 5000
- name: test_extrap
num_bytes: 57781232
num_examples: 5000
- name: test_ood
num_bytes: 7858384
num_examples: 1728
download_size: 17054524157
dataset_size: 19344319568
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: val
path: data/val-*
- split: test_id
path: data/test_id-*
- split: test_extrap
path: data/test_extrap-*
- split: test_ood
path: data/test_ood-*
---
# ToR-OT synthetic optimal-transport corpus
Discrete Kantorovich instances with exact sparse optimal plans, generated by
`python -m torot.data.generate` from the ToR-OT code release (https://github.com/vsingh-group/TOR-OT)
("Learning Optimal Transport Plans Via Autoregressive Token Regression", NeurIPS 2026).
Each record is one instance:
| field | description |
|---|---|
| `n`, `m` | number of source / target bins |
| `dim` | support dimension (1) |
| `cost_type` | one of `sqeuclidean`, `euclidean`, `canberra`, `sqrt_euclidean`, `cubic_euclidean`, `gaussian` |
| `coords_src`, `coords_tgt` | bin centres of a regular grid on [0,1], canonical order |
| `a`, `b` | marginals (float64, sum to 1); for the random splits drawn by the `marginals` sampler of the generation config (`simplex`: uniform on the probability simplex, Dirichlet(1,…,1); `normalized_uniform`: normalised i.i.d. U(0,1) weights) |
| `plan_rows`, `plan_cols`, `plan_vals` | COO of the optimal plan returned by POT's network simplex (`ot.emd`) |
| `ot_cost` | optimal cost with the max-normalised cost matrix |
| `family_src`, `family_tgt` | the marginal sampler (`simplex` or `normalized_uniform`), or the named density for the OOD evaluation split |
| `seed` | per-instance seed (instances are fully reproducible) |
The cost matrix is not stored; it is `torot.data.cost.cost_matrix(coords_src, coords_tgt, cost_type)`.
## Cost types
`cost_type` holds the code name; the paper writes the costs as below. L2^p is the Euclidean distance to the power p
(in 1D, L2 = |x - y|, which on a line also equals L1 and L∞). Each cost matrix is divided by its largest entry.
| `cost_type` | paper | c(x, y) |
|---|---|---|
| `euclidean` | L2 | ‖x − y‖₂ |
| `sqrt_euclidean` | L2^(1/2) | ‖x − y‖₂^(1/2) |
| `sqeuclidean` | L2^2 | ‖x − y‖₂² |
| `cubic_euclidean` | L2^3 | ‖x − y‖₂³ |
| `canberra` | Canberra | Σ_d \|x_d − y_d\| / (\|x_d\| + \|y_d\|) |
| `gaussian` | Gaussian | 1 − exp(−‖x − y‖₂² / 2σ²), σ = 0.2 |
## Splits
| split | instances |
|---|---|
| `train` | 5000000 |
| `val` | 2500 |
| `test_id` | 5000 |
| `test_extrap` | 5000 |
| `test_ood` | 1728 |
## Generation configuration
```json
{
"n_min": 5,
"n_max": 100,
"extrap_n_min": 120,
"extrap_n_max": 200,
"equal_sizes": true,
"marginals": "simplex",
"cost_types": [
"sqeuclidean",
"euclidean",
"canberra",
"sqrt_euclidean",
"cubic_euclidean",
"gaussian"
],
"ood_sizes": [
30,
100
]
}
```
Command:
```
python -m torot.data.generate --out_dir ./torot_data_5M --repo_id ivanjaenm/torot_data_5M --push --train 5000000 --val 2500 --test_id 5000 --test_extrap 5000 --seed 0 --workers 32
```