torot_data_4M_2d / README.md
ivanjaenm's picture
Dataset card: license, code link, cost types
71ce03e verified
|
Raw History Blame Contribute Delete
5.75 kB
metadata
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: 15834841370
      num_examples: 4000000
    - name: val
      num_bytes: 9892354
      num_examples: 2500
    - name: test_id
      num_bytes: 19654680
      num_examples: 5000
    - name: test_extrap
      num_bytes: 64457269
      num_examples: 5000
    - name: test_ood
      num_bytes: 3105512
      num_examples: 588
  download_size: 14355140311
  dataset_size: 15931951185
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 or 2)
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]^dim, canonical order (2D: k x k grid, x-major)
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

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 4000000
val 2500
test_id 5000
test_extrap 5000
test_ood 588

Generation configuration

{
  "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
  ],
  "dim": 2,
  "side_min": 3,
  "side_max": 10,
  "extrap_side_min": 11,
  "extrap_side_max": 14,
  "ood_sides": [
    6,
    10
  ],
  "empty_bins_prob": 0.5,
  "empty_frac_min": 0.1,
  "empty_frac_max": 0.7
}

Command:

python -m torot.data.generate --dim 2 --out_dir ./torot_data_4M_2d --repo_id ivanjaenm/torot_data_4M_2d --push --train 4000000 --val 2500 --test_id 5000 --test_extrap 5000 --seed 3 --workers 8 --empty_bins 0.5

Empty bins

In the random splits (train, val, test_id, test_extrap) each marginal independently, with probability 0.5, has a fraction f ~ U(0.1, 0.7) of its bins set to exactly 0 and is renormalised (at least one bin keeps mass). The emptied bins are, with equal probability, a uniformly random subset (family_* = <sampler>+empty_random), the bins farthest from 1-4 random Gaussian bumps (+empty_blobs), or the bins nearest to them (+empty_holes); see torot.data.generate.empty_bins. Every other draw of an instance (support, marginals before emptying, cost type) is the same as without empty bins.