prteek commited on
Commit
aedcd44
·
verified ·
1 Parent(s): e24a243

Refer to the alphaXiv paper throughout

Browse files
Files changed (3) hide show
  1. README.md +6 -7
  2. example.py +1 -1
  3. model.py +2 -1
README.md CHANGED
@@ -17,9 +17,8 @@ datasets:
17
 
18
  A small PyTorch network that estimates a smooth **prevailing level** for every location and day of a panel,
19
  for two related quantities at once, when the observations are noisy daily means with long gaps and some series
20
- missing entirely. It was developed for the post
21
- [PM2.5, PM10 ~ station + time](https://prteek.github.io/regression_room/posts/beijing_air_quality/) (paper on
22
- [alphaXiv](https://www.alphaxiv.org/abs/2610.pm25-pm10-joint-smoothing)) and powers the
23
  [sparse panel demo Space](https://huggingface.co/spaces/prteek/sparse-panel-demo).
24
 
25
  **This repo holds the code and the training recipe, not trained weights.** The network learns an embedding for
@@ -62,7 +61,7 @@ only: a missing target is **masked**, not dropped. Added to it:
62
  ## Training recipe
63
 
64
  Full-batch Adam with a cosine learning-rate schedule. The settings below were chosen by look-ahead
65
- cross-validation in the post:
66
 
67
  | Setting | Value |
68
  |---|---|
@@ -106,15 +105,15 @@ level = predict(model, enc, enc.grid()) # every location x day, observed or no
106
  - **Not transferable.** Location embeddings and the time basis are specific to one panel and date range. Refit
107
  for new locations or dates.
108
  - **Smoothness is a choice.** Cross-validation that scores against noisy readings rewards following short
109
- episodes, so it tends to under-smooth; the post discusses this. Treat `rough` and `spacing` as decisions about
110
  how smooth the level should be.
111
  - **Log-scale bias.** The model is fitted to logs of means over few readings, so its level sits slightly below a
112
  moving average of full data (Jensen's inequality).
113
- - **A GAM is a strong alternative.** In the post, a mixed-effects GAM with hand-set smoothness does as well or
114
  better.
115
  - **Memory.** Training is full batch and the penalty covers every location × day, so memory grows with panel size.
116
 
117
- ## Data used in the post
118
 
119
  Beijing Multi-Site Air Quality, Song Chen (2017), UCI Machine Learning Repository,
120
  [doi:10.24432/C5RK5G](https://doi.org/10.24432/C5RK5G), CC BY 4.0. The demo's sparse readings and predictions
 
17
 
18
  A small PyTorch network that estimates a smooth **prevailing level** for every location and day of a panel,
19
  for two related quantities at once, when the observations are noisy daily means with long gaps and some series
20
+ missing entirely. It was developed for the paper
21
+ [PM2.5, PM10 ~ Station + Time, Analysis](https://www.alphaxiv.org/abs/2610.pm25-pm10-joint-smoothing) on alphaXiv and powers the
 
22
  [sparse panel demo Space](https://huggingface.co/spaces/prteek/sparse-panel-demo).
23
 
24
  **This repo holds the code and the training recipe, not trained weights.** The network learns an embedding for
 
61
  ## Training recipe
62
 
63
  Full-batch Adam with a cosine learning-rate schedule. The settings below were chosen by look-ahead
64
+ cross-validation in the paper:
65
 
66
  | Setting | Value |
67
  |---|---|
 
105
  - **Not transferable.** Location embeddings and the time basis are specific to one panel and date range. Refit
106
  for new locations or dates.
107
  - **Smoothness is a choice.** Cross-validation that scores against noisy readings rewards following short
108
+ episodes, so it tends to under-smooth; the paper discusses this. Treat `rough` and `spacing` as decisions about
109
  how smooth the level should be.
110
  - **Log-scale bias.** The model is fitted to logs of means over few readings, so its level sits slightly below a
111
  moving average of full data (Jensen's inequality).
112
+ - **A GAM is a strong alternative.** In the paper, a mixed-effects GAM with hand-set smoothness does as well or
113
  better.
114
  - **Memory.** Training is full batch and the penalty covers every location × day, so memory grows with panel size.
115
 
116
+ ## Data used in the paper
117
 
118
  Beijing Multi-Site Air Quality, Song Chen (2017), UCI Machine Learning Repository,
119
  [doi:10.24432/C5RK5G](https://doi.org/10.24432/C5RK5G), CC BY 4.0. The demo's sparse readings and predictions
example.py CHANGED
@@ -9,7 +9,7 @@ import pandas as pd
9
 
10
  from model import TARGETS, Encoding, fit, predict
11
 
12
- # Settings chosen by look-ahead cross-validation in the post
13
  CFG = dict(rough=1e5, spacing=30, lr=5e-3, hidden=64, weight_decay=1e-4, station_l2=1e-3, schedule=1000, seed=0)
14
  STEPS = 100
15
 
 
9
 
10
  from model import TARGETS, Encoding, fit, predict
11
 
12
+ # Settings chosen by look-ahead cross-validation in the paper
13
  CFG = dict(rough=1e5, spacing=30, lr=5e-3, hidden=64, weight_decay=1e-4, station_l2=1e-3, schedule=1000, seed=0)
14
  STEPS = 100
15
 
model.py CHANGED
@@ -1,6 +1,7 @@
1
  """Joint two-target network for a smooth 'prevailing' pollution level per station and day.
2
 
3
- Copied from the regression_room post (posts/beijing_air_quality/model.py):
 
4
  - one row per station x day with up to two targets (log PM2.5, log PM10); a missing target is masked, not dropped;
5
  - location = area embedding + small station offset (station falls back to its area when data is thin);
6
  - time enters only through fixed Gaussian bumps, so the level is a smooth function of time;
 
1
  """Joint two-target network for a smooth 'prevailing' pollution level per station and day.
2
 
3
+ Copied from the code behind the paper "PM2.5, PM10 ~ Station + Time, Analysis"
4
+ (www.alphaxiv.org/abs/2610.pm25-pm10-joint-smoothing):
5
  - one row per station x day with up to two targets (log PM2.5, log PM10); a missing target is masked, not dropped;
6
  - location = area embedding + small station offset (station falls back to its area when data is thin);
7
  - time enters only through fixed Gaussian bumps, so the level is a smooth function of time;