Neerav-Gupta commited on
Commit
4261c19
·
verified ·
1 Parent(s): 1acfbbf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -35
README.md CHANGED
@@ -22,51 +22,104 @@ size_categories:
22
  **Author:** Neerav Gupta
23
  **Code:** [github.com/Neerav-Gupta/tokamark-robustness](https://github.com/Neerav-Gupta/tokamark-robustness)
24
 
 
 
25
  ## Dataset Description
26
 
27
- This dataset contains pre-processed numpy arrays and trained model checkpoints from the first systematic robustness benchmark of plasma diagnostic ML models under realistic sensor failure, using the [TokaMark benchmark](https://arxiv.org/abs/2602.10132) on MAST tokamak data.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
- The raw data originates from the [FAIR-MAST dataset](https://github.com/UKAEA-IBM-STFC-Fusion-FMs/tokamark) provided by UKAEA, IBM Research, and STFC. This dataset contains derived arrays prepared for robustness benchmarking experiments and is not a redistribution of the raw FAIR-MAST data.
 
 
30
 
31
  ## Dataset Structure
32
 
33
  ```
34
  tokamark-robustness-data/
35
- ├── train_X_feat.npy
36
- ├── train_X_ts.npy
37
- ├── train_y.npy
38
- ├── val_X_feat.npy
39
- ├── val_X_ts.npy
40
- ├── val_y.npy
41
- ├── test_X_feat.npy
42
- ├── test_X_ts.npy
43
- ├── test_y.npy
44
- ├── test_raw_samples.pkl
45
- ├── feature_names.json
46
- └── checkpoints/
47
- ├── xgboost_clean.pkl
48
- ├── lstm_clean.pt
49
- ── transformer_clean.pt
 
 
 
 
 
 
 
 
 
 
50
  ```
51
 
 
 
52
  ## File Descriptions
53
 
 
 
54
  | File | Description | Shape |
55
  |---|---|---|
56
  | `train_X_feat.npy` | Training feature vectors for XGBoost | (9950, 142) |
57
- | `train_X_ts.npy` | Training time series for LSTM/Transformer | (9950, 600, 18) |
58
- | `train_y.npy` | Training targets | (9950,) |
59
  | `val_X_feat.npy` | Validation feature vectors | (2500, 142) |
60
  | `val_X_ts.npy` | Validation time series | (2500, 600, 18) |
61
  | `val_y.npy` | Validation targets | (2500,) |
62
  | `test_X_feat.npy` | Test feature vectors | (2420, 142) |
63
  | `test_X_ts.npy` | Test time series | (2420, 600, 18) |
64
  | `test_y.npy` | Test targets | (2420,) |
65
- | `test_raw_samples.pkl` | Raw test samples for corruption experiments | 2420 samples |
66
- | `feature_names.json` | Feature names for X_feat columns | 142 names |
67
- | `checkpoints/xgboost_clean.pkl` | Trained XGBoost model | — |
68
- | `checkpoints/lstm_clean.pt` | Trained LSTM model | — |
69
- | `checkpoints/transformer_clean.pt` | Trained Transformer model | — |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  ## Data Details
72
 
@@ -76,7 +129,11 @@ tokamark-robustness-data/
76
  | Val | 50 | 2,500 |
77
  | Test | 50 | 2,420 |
78
 
79
- **Task:** Task 4-4 from TokaMark — plasma current quench prediction. Given 150ms of diagnostic history across 14 input signals and 4 actuator signals, predict plasma current 100ms into the future.
 
 
 
 
80
 
81
  ## Signal Order in X_ts (18 channels)
82
 
@@ -101,6 +158,8 @@ tokamark-robustness-data/
101
  | 16 | pulse_schedule-n_e_line | Actuator |
102
  | 17 | summary-power_nbi | Actuator |
103
 
 
 
104
  ## Loading the Data
105
 
106
  ```python
@@ -116,18 +175,22 @@ snapshot_download(
116
  )
117
 
118
  # Load arrays
119
- X_train_ts = np.load("./tokamark_robustness_data/train_X_ts.npy")
120
- y_train = np.load("./tokamark_robustness_data/train_y.npy")
121
- X_test_ts = np.load("./tokamark_robustness_data/test_X_ts.npy")
122
- y_test = np.load("./tokamark_robustness_data/test_y.npy")
123
-
124
- # Load raw test samples for corruption experiments
125
- with open("./tokamark_robustness_data/test_raw_samples.pkl", "rb") as f:
126
- test_samples = pickle.load(f)
127
 
128
  print(f"Train: {X_train_ts.shape}") # (9950, 600, 18)
129
  print(f"Test: {X_test_ts.shape}") # (2420, 600, 18)
130
 
 
 
 
 
 
 
 
 
131
  # Load trained LSTM checkpoint
132
  import torch
133
  ckpt = torch.load(
@@ -135,8 +198,19 @@ ckpt = torch.load(
135
  map_location="cpu"
136
  )
137
  print(f"LSTM n_features: {ckpt['n_features']}")
 
 
 
 
 
 
 
 
 
138
  ```
139
 
 
 
140
  ## Reproducing Results
141
 
142
  ```bash
@@ -154,13 +228,21 @@ snapshot_download(
154
  )
155
  "
156
 
157
- # Run experiments
158
  python scripts/train_xgboost.py
159
  python scripts/train_lstm.py
160
  python scripts/train_transformer.py
 
 
 
 
 
 
161
  python scripts/analyze_results.py
162
  ```
163
 
 
 
164
  ## Citation
165
 
166
  If you use this dataset please cite:
@@ -184,7 +266,7 @@ Please also cite the original TokaMark benchmark:
184
  Plasma Models},
185
  author = {Rousseau, C{\'e}cile and Jackson, Samuel and
186
  Ordonez-Hurtado, Rodrigo H. and Amorisco, Nicola C. and
187
- Boschi, Tobia and Holt, George K and Loreti, Andrea and
188
  Sz{\'e}kely, Eszter and Whittle, Alexander and
189
  Agnello, Adriano and Pamela, Stanislas and
190
  Pascale, Alessandra and Akers, Robert and
@@ -195,10 +277,14 @@ Please also cite the original TokaMark benchmark:
195
  }
196
  ```
197
 
 
 
198
  ## License
199
 
200
  [MIT License](https://opensource.org/licenses/MIT)
201
 
 
 
202
  ## Acknowledgements
203
 
204
  Raw plasma data sourced from the FAIR-MAST dataset provided by UKAEA, IBM Research, and STFC. This benchmark dataset was prepared independently using the TokaMark data loading infrastructure.
 
22
  **Author:** Neerav Gupta
23
  **Code:** [github.com/Neerav-Gupta/tokamark-robustness](https://github.com/Neerav-Gupta/tokamark-robustness)
24
 
25
+ ---
26
+
27
  ## Dataset Description
28
 
29
+ This dataset contains pre-processed numpy arrays, trained model checkpoints, and experiment results from the first systematic robustness benchmark of plasma diagnostic ML models under realistic sensor failure, using the [TokaMark benchmark](https://arxiv.org/abs/2602.10132) on MAST tokamak data.
30
+
31
+ We evaluate four architectures (XGBoost, LSTM, Transformer, and the TokaMark CNN baseline) across six physically-motivated failure scenarios and three imputation strategies, and compute shot-level alarm metrics using ground-truth disruption timestamps from FAIR-MAST.
32
+
33
+ The raw data originates from the [FAIR-MAST dataset](https://github.com/UKAEA-IBM-STFC-Fusion-FMs/tokamark) provided by UKAEA, IBM Research, and STFC. This dataset contains derived arrays prepared for robustness benchmarking and is not a redistribution of the raw FAIR-MAST data.
34
+
35
+ ---
36
+
37
+ ## Key Results
38
+
39
+ | Model | Clean NRMSE | Robustness Score (RS) | Clean TPR | TPR (proximate 25%, zero-fill) |
40
+ |---|---|---|---|---|
41
+ | XGBoost | 0.494 | 0.841 | 0.40 | — |
42
+ | LSTM | 0.496 | 0.808 | 0.52 | 0.00 |
43
+ | Transformer | 0.470 | 0.765 | 0.48 | 0.08 |
44
+ | CNN (TokaMark baseline) | 0.528 | 0.764 | 0.60 | 0.46 |
45
 
46
+ **Key finding:** Under disruption-proximate sensor failure, LSTM alarm detection collapses to TPR = 0.00 with zero-fill imputation, but recovers to TPR = 1.00 with mean-fill the opposite of its effect on NRMSE.
47
+
48
+ ---
49
 
50
  ## Dataset Structure
51
 
52
  ```
53
  tokamark-robustness-data/
54
+ ├── data/
55
+ ├── train_X_feat.npy # XGBoost feature vectors, train
56
+ ├── train_X_ts.npy # Time series tensors, train
57
+ ├── train_y.npy # Target labels, train
58
+ ├── val_X_feat.npy # XGBoost feature vectors, val
59
+ ├── val_X_ts.npy # Time series tensors, val
60
+ ├── val_y.npy # Target labels, val
61
+ ├── test_X_feat.npy # XGBoost feature vectors, test
62
+ ├── test_X_ts.npy # Time series tensors, test
63
+ ├── test_y.npy # Target labels, test
64
+ ├── test_raw_samples.pkl # Raw test samples with t_cut timestamps
65
+ └── feature_names.json # Feature names for X_feat columns
66
+ ├── checkpoints/
67
+ ├── xgboost_clean.pkl # Trained XGBoost model
68
+ │ ├── lstm_clean.pt # Trained LSTM model
69
+ │ ├── transformer_clean.pt # Trained Transformer model
70
+ │ └── cnn_clean.pt # Trained CNN baseline model
71
+ └── results/
72
+ ├── xgboost_results.json
73
+ ├── lstm_results.json
74
+ ├── transformer_results.json
75
+ ├── cnn_results.json
76
+ ├── shot_level_metrics.json
77
+ ├── alarm_under_corruption.json
78
+ └── alarm_mitigation_proximate.json
79
  ```
80
 
81
+ ---
82
+
83
  ## File Descriptions
84
 
85
+ ### Data Arrays
86
+
87
  | File | Description | Shape |
88
  |---|---|---|
89
  | `train_X_feat.npy` | Training feature vectors for XGBoost | (9950, 142) |
90
+ | `train_X_ts.npy` | Training time series for LSTM/Transformer/CNN | (9950, 600, 18) |
91
+ | `train_y.npy` | Training targets (normalized plasma current) | (9950,) |
92
  | `val_X_feat.npy` | Validation feature vectors | (2500, 142) |
93
  | `val_X_ts.npy` | Validation time series | (2500, 600, 18) |
94
  | `val_y.npy` | Validation targets | (2500,) |
95
  | `test_X_feat.npy` | Test feature vectors | (2420, 142) |
96
  | `test_X_ts.npy` | Test time series | (2420, 600, 18) |
97
  | `test_y.npy` | Test targets | (2420,) |
98
+ | `test_raw_samples.pkl` | Raw test samples including `t_cut` disruption timestamps and signal time arrays | 2420 samples |
99
+ | `feature_names.json` | Feature names for the 142 X_feat columns | 142 names |
100
+
101
+ ### Checkpoints
102
+
103
+ | File | Description |
104
+ |---|---|
105
+ | `checkpoints/xgboost_clean.pkl` | Trained XGBoost model (clean data) |
106
+ | `checkpoints/lstm_clean.pt` | Trained LSTM model (clean data) |
107
+ | `checkpoints/transformer_clean.pt` | Trained Transformer model (clean data) |
108
+ | `checkpoints/cnn_clean.pt` | Trained TokaMark CNN baseline (clean data) |
109
+
110
+ ### Results
111
+
112
+ | File | Description |
113
+ |---|---|
114
+ | `results/xgboost_results.json` | Full robustness results for XGBoost |
115
+ | `results/lstm_results.json` | Full robustness results for LSTM |
116
+ | `results/transformer_results.json` | Full robustness results for Transformer |
117
+ | `results/cnn_results.json` | Full robustness results for CNN baseline |
118
+ | `results/shot_level_metrics.json` | Clean-data shot-level TPR and MWT |
119
+ | `results/alarm_under_corruption.json` | Shot-level alarm metrics under sensor failure |
120
+ | `results/alarm_mitigation_proximate.json` | Alarm metrics under proximate failure with each imputation strategy |
121
+
122
+ ---
123
 
124
  ## Data Details
125
 
 
129
  | Val | 50 | 2,500 |
130
  | Test | 50 | 2,420 |
131
 
132
+ **Task:** Task 4-4 from TokaMark — plasma current quench prediction. Given 150ms of diagnostic history across 14 input signals and 4 actuator signals (18 total channels), predict plasma current 100ms into the future.
133
+
134
+ **All 50 test shots disrupted** (finite `t_cut` in `test_raw_samples.pkl`), enabling real shot-level alarm metric computation.
135
+
136
+ ---
137
 
138
  ## Signal Order in X_ts (18 channels)
139
 
 
158
  | 16 | pulse_schedule-n_e_line | Actuator |
159
  | 17 | summary-power_nbi | Actuator |
160
 
161
+ ---
162
+
163
  ## Loading the Data
164
 
165
  ```python
 
175
  )
176
 
177
  # Load arrays
178
+ X_train_ts = np.load("./tokamark_robustness_data/data/train_X_ts.npy")
179
+ y_train = np.load("./tokamark_robustness_data/data/train_y.npy")
180
+ X_test_ts = np.load("./tokamark_robustness_data/data/test_X_ts.npy")
181
+ y_test = np.load("./tokamark_robustness_data/data/test_y.npy")
 
 
 
 
182
 
183
  print(f"Train: {X_train_ts.shape}") # (9950, 600, 18)
184
  print(f"Test: {X_test_ts.shape}") # (2420, 600, 18)
185
 
186
+ # Load raw test samples (includes t_cut disruption timestamps)
187
+ with open("./tokamark_robustness_data/data/test_raw_samples.pkl", "rb") as f:
188
+ test_samples = pickle.load(f)
189
+
190
+ # Each sample has: shot_id, window_index, input, actuator, output, t_cut
191
+ print(f"Sample keys: {list(test_samples[0].keys())}")
192
+ print(f"t_cut (disruption time): {test_samples[0]['t_cut']:.4f}s")
193
+
194
  # Load trained LSTM checkpoint
195
  import torch
196
  ckpt = torch.load(
 
198
  map_location="cpu"
199
  )
200
  print(f"LSTM n_features: {ckpt['n_features']}")
201
+
202
+ # Load trained CNN checkpoint
203
+ ckpt_cnn = torch.load(
204
+ "./tokamark_robustness_data/checkpoints/cnn_clean.pt",
205
+ map_location="cpu"
206
+ )
207
+ print(f"CNN n_channels: {ckpt_cnn['n_channels']}, "
208
+ f"input_len: {ckpt_cnn['input_len']}, "
209
+ f"backbone_hidden: {ckpt_cnn['backbone_hidden']}")
210
  ```
211
 
212
+ ---
213
+
214
  ## Reproducing Results
215
 
216
  ```bash
 
228
  )
229
  "
230
 
231
+ # Train all four models and run robustness evaluation
232
  python scripts/train_xgboost.py
233
  python scripts/train_lstm.py
234
  python scripts/train_transformer.py
235
+ python scripts/train_cnn_baseline.py
236
+
237
+ # Compute shot-level alarm metrics
238
+ python scripts/compute_alarm_metrics.py
239
+
240
+ # Generate all 9 figures
241
  python scripts/analyze_results.py
242
  ```
243
 
244
+ ---
245
+
246
  ## Citation
247
 
248
  If you use this dataset please cite:
 
266
  Plasma Models},
267
  author = {Rousseau, C{\'e}cile and Jackson, Samuel and
268
  Ordonez-Hurtado, Rodrigo H. and Amorisco, Nicola C. and
269
+ Boschi, Tobia and Holt, George K. and Loreti, Andrea and
270
  Sz{\'e}kely, Eszter and Whittle, Alexander and
271
  Agnello, Adriano and Pamela, Stanislas and
272
  Pascale, Alessandra and Akers, Robert and
 
277
  }
278
  ```
279
 
280
+ ---
281
+
282
  ## License
283
 
284
  [MIT License](https://opensource.org/licenses/MIT)
285
 
286
+ ---
287
+
288
  ## Acknowledgements
289
 
290
  Raw plasma data sourced from the FAIR-MAST dataset provided by UKAEA, IBM Research, and STFC. This benchmark dataset was prepared independently using the TokaMark data loading infrastructure.