File size: 3,052 Bytes
1136c7a 78e16c1 1136c7a 264e2bd 1162c62 6ca5fad 1162c62 264e2bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | ---
license: apache-2.0
dataset_info:
features:
- name: data
list:
list: float32
splits:
- name: chaos
num_bytes: 6831025708
num_examples: 69469
- name: signals
num_bytes: 7161305200
num_examples: 39725
- name: series
num_bytes: 1337735736
num_examples: 20406
download_size: 15333788784
dataset_size: 15330066644
configs:
- config_name: default
data_files:
- split: chaos
path: data/chaos-*
- split: signals
path: data/signals-*
- split: series
path: data/series-*
---
# Example Code for Using the Dataset
```python
import numpy as np
from torch.utils.data import Dataset
from datasets import load_dataset
class PretrainDataset(Dataset):
def __init__(self, window_size=4096, nvar=11):
self.window_size = window_size
self.nvar = nvar
# init dataset
self.ds = load_dataset("mosaic-laboratory/dynamic_systems_pretrain")
def __len__(self):
return sum([len(self.ds[k]) for k in self.ds.keys()])
def __getitem__(self, idx):
# sample from the correct systen set ['chaos', 'signals', 'series'] based on idx
if idx < self.ds['chaos']:
ds_k = 'chaos'
ds_idx = idx
elif idx < self.ds['chaos'] + self.ds['signals']:
ds_k = 'signals'
ds_idx = idx - self.ds['chaos']
else:
ds_k = 'series'
ds_idx = idx - self.ds['chaos'] - self.ds['signals']
traj = np.array(self.ds[ds_k][ds_idx]['data']) # nvar, L
# append dummy
if traj.shape[0] < self.nvar: # if less, duplicate
dummy_traj = np.random.choice(np.arange(traj.shape[0]), self.nvar-traj.shape[0], replace=True)
traj = np.concatenate((traj, traj[dummy_traj]), axis=0)
elif traj.shape[0] > self.nvar: # if more, random sample
traj = traj[np.random.choice(np.arange(traj.shape[0]), self.nvar, replace=False)]
# shuffle channels
var_idx = np.random.permutation(traj.shape[0])
traj = np.take(traj, var_idx, axis=0)
# in-sample normalization
traj = np.nan_to_num(traj, nan=0.0, posinf=0.0, neginf=0.0)
traj_std = traj.std(axis=1, keepdims=True)
traj_std[traj_std == 0] = 1.0
traj = (traj - traj.mean(axis=1, keepdims=True)) / (traj_std + 1e-8)
# clip
if traj.shape[1] > self.window_size:
start_idx = np.random.choice(np.arange(traj.shape[1]-self.window_size))
traj = traj[:, start_idx:start_idx+self.window_size]
# packing
curr_pack = {
'sample': torch.from_numpy(traj).float() # nvar, L
}
# packing
return curr_pack
```
## Reference:
1) Lai, Jeffrey, Anthony Bao, and William Gilpin. "Panda: A pretrained forecast model for chaotic dynamics.", ICLR, preprint arXiv:2505.13755 (2026).
2) Luo, Yunfei, et al. "Toward World Modeling of Physiological Signals with Chaos-Theoretic Balancing and Latent Dynamics." preprint arXiv:2605.15465 (2026). |