prteek commited on
Commit
5bd97d2
·
verified ·
1 Parent(s): cad1287

Deploy dc29391 from GitHub

Browse files
Files changed (3) hide show
  1. README.md +6 -6
  2. example.py +1 -1
  3. model.py +1 -1
README.md CHANGED
@@ -17,8 +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 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,7 +61,7 @@ only: a missing target is **masked**, not dropped. Added to it:
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,15 +105,15 @@ level = predict(model, enc, enc.grid()) # every location x day, observed or no
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
 
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 blog post
21
+ [Smooth Levels from Sparse, Gappy Panels](https://huggingface.co/blog/prteek/sparse-panel-modelling) 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 blog post:
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 blog post 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 blog post, 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 blog post
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 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
 
 
9
 
10
  from model import TARGETS, Encoding, fit, predict
11
 
12
+ # Settings chosen by look-ahead cross-validation in the blog 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
 
model.py CHANGED
@@ -1,6 +1,6 @@
1
  """Joint two-target network for a smooth 'prevailing' pollution level per station and day.
2
 
3
- The model of the paper "PM2.5, PM10 ~ Station + Time, Analysis" (www.alphaxiv.org/abs/2610.pm25-pm10-joint-smoothing):
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
+ The model of the blog post "Smooth Levels from Sparse, Gappy Panels" (huggingface.co/blog/prteek/sparse-panel-modelling):
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;