ManmohanSharma commited on
Commit
9ea0b89
·
verified ·
1 Parent(s): 03ec62b

Update NativeSpecZ-FM-76M.ipynb

Browse files
Files changed (1) hide show
  1. NativeSpecZ-FM-76M.ipynb +3 -19
NativeSpecZ-FM-76M.ipynb CHANGED
@@ -138,7 +138,7 @@
138
  "import torch.nn.functional as F\n",
139
  "from tqdm.auto import tqdm\n",
140
  "\n",
141
- "EVAL_MASK_RATIO = 0.30 # matches friend's notebook\n",
142
  "cfg = RawCollatorConfig(\n",
143
  " target_length=args[\"target_length\"],\n",
144
  " eval_mask_ratio=EVAL_MASK_RATIO,\n",
@@ -154,7 +154,6 @@
154
  "\n",
155
  "z_true_all, y_pred_all, zwarn_all = [], [], []\n",
156
  "rec_mse_all = []\n",
157
- "# Save 4 sample reconstructions for plotting\n",
158
  "saved_recon = []\n",
159
  "with torch.no_grad():\n",
160
  " for batch in tqdm(loader, desc=\"infer\"):\n",
@@ -172,7 +171,6 @@
172
  " d = m.sum(axis=1).clip(min=1.0)\n",
173
  " per_mse = (per_pix * m).sum(axis=1) / d\n",
174
  " rec_mse_all.append(per_mse)\n",
175
- " # save 4 reconstructions across z range\n",
176
  " if len(saved_recon) < 4:\n",
177
  " for i in range(batch[\"x\"].shape[0]):\n",
178
  " if len(saved_recon) < 4:\n",
@@ -280,7 +278,6 @@
280
  "for i, (ax, s) in enumerate(zip(axes, saved_recon)):\n",
281
  " target = s[\"target\"]; mask = s[\"mask\"]; recon = s[\"recon\"]\n",
282
  " x = np.arange(len(target))\n",
283
- " # Shade masked regions yellow\n",
284
  " in_mask = False\n",
285
  " start = 0\n",
286
  " for j in range(len(mask)):\n",
@@ -308,20 +305,7 @@
308
  "cell_type": "markdown",
309
  "metadata": {},
310
  "source": [
311
- "## Comparison summary\n",
312
- "\n",
313
- "On DESI in-distribution test:\n",
314
- "\n",
315
- "| Metric | NativeSpecZ-FM-76M (ours) | AION-base | Friend's notebook |\n",
316
- "|---|---:|---:|---:|\n",
317
- "| MAE | **0.052** | 0.074 | 0.115 |\n",
318
- "| RMSE | 0.189 | - | 0.255 |\n",
319
- "| Pearson r | **0.936** | - | 0.889 |\n",
320
- "| Cat\\|dz\\|/(1+z)>0.15 (%) | **6.8** | - | 10.9 |\n",
321
- "| Accuracy \\|dz\\|<0.10 (%) | **90.6** | - | 75.5 |\n",
322
- "| Masked recon MSE | **0.037** | - | 1.61 |\n",
323
- "\n",
324
- "Plus cross-instrument generalization that the friend's notebook doesn't test:\n",
325
  "\n",
326
  "| Dataset | NativeSpecZ-FM-76M | AION-base |\n",
327
  "|---|---:|---:|\n",
@@ -329,7 +313,7 @@
329
  "| SDSS (real non-DESI) | 0.382 | **0.127** |\n",
330
  "| **VIPERS (real non-DESI)** | **0.172** | 0.274 |\n",
331
  "\n",
332
- "We beat AION-base on DESI and VIPERS; SDSS still favors AION because their wavelength-aware tokenizer was trained on more data."
333
  ]
334
  }
335
  ],
 
138
  "import torch.nn.functional as F\n",
139
  "from tqdm.auto import tqdm\n",
140
  "\n",
141
+ "EVAL_MASK_RATIO = 0.30\n",
142
  "cfg = RawCollatorConfig(\n",
143
  " target_length=args[\"target_length\"],\n",
144
  " eval_mask_ratio=EVAL_MASK_RATIO,\n",
 
154
  "\n",
155
  "z_true_all, y_pred_all, zwarn_all = [], [], []\n",
156
  "rec_mse_all = []\n",
 
157
  "saved_recon = []\n",
158
  "with torch.no_grad():\n",
159
  " for batch in tqdm(loader, desc=\"infer\"):\n",
 
171
  " d = m.sum(axis=1).clip(min=1.0)\n",
172
  " per_mse = (per_pix * m).sum(axis=1) / d\n",
173
  " rec_mse_all.append(per_mse)\n",
 
174
  " if len(saved_recon) < 4:\n",
175
  " for i in range(batch[\"x\"].shape[0]):\n",
176
  " if len(saved_recon) < 4:\n",
 
278
  "for i, (ax, s) in enumerate(zip(axes, saved_recon)):\n",
279
  " target = s[\"target\"]; mask = s[\"mask\"]; recon = s[\"recon\"]\n",
280
  " x = np.arange(len(target))\n",
 
281
  " in_mask = False\n",
282
  " start = 0\n",
283
  " for j in range(len(mask)):\n",
 
305
  "cell_type": "markdown",
306
  "metadata": {},
307
  "source": [
308
+ "## Comparison vs AION-base across instruments\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  "\n",
310
  "| Dataset | NativeSpecZ-FM-76M | AION-base |\n",
311
  "|---|---:|---:|\n",
 
313
  "| SDSS (real non-DESI) | 0.382 | **0.127** |\n",
314
  "| **VIPERS (real non-DESI)** | **0.172** | 0.274 |\n",
315
  "\n",
316
+ "We beat AION-base on DESI (in-distribution) and VIPERS (cross-instrument)."
317
  ]
318
  }
319
  ],