Repository navigation
Description
Optional for submission. To be decided by María and Max. If it does not go in, the paper states the gate's rare-class behaviour as untested (see #8).
Why
The paper says the regime gate preserves a zero-inflated target's mass structure, but no task tests that where it is hard.
- In the CPS components task, interest is positive for 58% of adults and dividends for 15%. Neither class is rare.
- The one rare class the within-survey tables record is exactly-zero net worth in the SCF. Its zero-share error is 0.2 to 0.3 points for every method, so it separates nothing.
Since the paper's runs, Microcosm added an opt-in cross-fitted calibration of the gate: RegimeGatedQRF(gate_calibration="cross_fitted"), PolicyEngine/microcosm#1391. It was added because an in-sample gate is overconfident on a rare class: its probabilities are fitted to the rows it trained on, so on new rows it draws the rare class too rarely.
The paper ran the in-sample gate, which is still the default, so no reported number changes. But a referee who opens the package will ask how the gate behaves on a rare class, and the paper has no evidence either way.
What
Widen the CPS components task from two targets to six to eight, all from the same public ASEC person file (pppub25.csv). Weighted shares of adults 18 and over, ASEC 2025:
| Target | ASEC variable | Positive | Negative |
|---|---|---|---|
| Interest (in the task now) | INT_VAL |
58.3% | none |
| Dividends (in the task now) | DIV_VAL |
15.3% | none |
| Self-employment | SEMP_VAL |
4.6% | 0.19% |
| Rental income | RNT_VAL |
4.5% | 0.24% |
| SSI | SSI_VAL |
2.1% | none |
| Unemployment compensation | UC_VAL |
1.35% | none |
| Farm self-employment | FRSE_VAL |
0.62% | 0.13% |
| Public assistance | PAW_VAL |
0.60% | none |
That spans class shares from 0.13% to 58%, with three sign-mixed targets.
Arms, on the same paired splits and seeds:
- Full estimator, in-sample gate (the default, and what the paper ran).
- Full estimator, cross-fitted gate.
- A gates-off forest in the same implementation, if that arm is added.
- microimpute's QRF as shipped, hot deck, and the weighted marginal draw. The marginal draw reproduces class shares by construction, so it is the floor.
Report, for each target and sign class:
- the weighted class share in the holdout and in each arm's draw, with the signed error in points;
- how many of the ten seeds each contrast holds on;
- one figure: |log(drawn share / true share)| against the class share, one line per arm. That is the dose-response of gate error against rarity.
Things to settle in the design
- The predictor.
employment_incomeis wages plusSEMP_VALtoday. With self-employment as a target, the predictor becomes wages alone for this task. - The row cap. At the task's 20,000-row cap the three negative classes have fewer than 50 expected donor rows each, and the positive classes under 1% have about 100. The cross-fitted gate needs at least five rows of a class (one per fold) and otherwise keeps the in-sample gate for that target. Either run this task on all 108,044 adults or on a larger cap, and report
gate_outcomes()so the table says which gate each target got. - Chain order. State it in
PLAN.md. The registry treats a new task as aPLAN.mdchange.
Needs
- The estimator re-pinned to a Microcosm commit that has Calibrate the QRF sign gates out of fold, for every gated UK imputation microcosm#1391. The paper pins a July commit. Re-pinning moves no existing number: at current
main, with the lockfile's third-party versions, the three estimator arms draw bit-identically to the July pin on every task checked (see IJM submission checklist: fixes required before submitting #8). data/cps.py: the new columns.- A paragraph in section 3.1 on the calibration: five class-stratified folds, one pooled weighted calibration fitted on the out-of-fold log-probabilities, and the fallback for a class too thin for five folds. Cite Platt (1999) and Niculescu-Mizil and Caruana (2005), and say how this differs from scikit-learn's
CalibratedClassifierCV.
Cost
- Code: about half a day (loader, task, the per-class share metric, table and figure).
- Compute: a cell of the current two-target task takes 2 to 3 seconds on one thread. Eight targets on the full adult file will be much slower per cell, so time one seed before launching ten.
- Text: one results paragraph, one table, one figure.
Done when
- The table and figure regenerate from committed runs through
imp tablesandimp figures. - The text says which gate each experiment uses.
- The result is reported whichever way it falls, including if the cross-fitted gate does not beat the in-sample gate on these classes.
Activity
vahid-ahmadi commentedon Nov 13, 2026
Two points on the design from
packages/microcosm-fit/src/microcosm/fit/qrf.py. The first is new since this was written on 10 November.There is now a gate option aimed at rare classes. Hold every rare SPI output's carriers in stage 1's donor frame, and calibrate its gates by level (#1276) microcosm#1584 (merged 12 November, commit 86fc24510) added
gate_calibration="cross_fitted_balanced". Each fold gate is fitted on class-balanced weights, and the calibration stays on the rows' own weights. Its stated aim is that a very rare class still shapes how the gate ranks rows (the docstring's example is "a class that holds a hundredth of a percent of the weight"). The classes here go down to 0.13%, so a balanced arm next to arms 1 and 2 would test the option written for this case. Without it, the table only shows whether the plain cross-fitted gate is enough. The commit message says the in-sample and cross-fitted gates do not move.gate_outcomes()can report five outcomes, and the issue names one fallback.GateOutcomealready had these at 152f7e33:in_sample,cross_fitted,in_sample_thin_class(fewer rows or groups in a class than the 5 folds),in_sample_weightless_fold(a fold's training rows carry no weight for a class) andcross_fitted_class_rates(the rate balance could not be met, so every row gets the weighted class rates). The fallback paragraph for section 3.1 and the table's gate column should allow for all five, not just the thin-class case.A smaller point. "Needs" says re-pinning moves no number because current
maindraws bit-identically to the July pin (from #8). That check ran at 152f7e33 on 10 November. #1584 changedqrf.pyafter that, so if the re-pin goes to a commit that includes it, the bit-identity check on the three estimator arms needs repeating at that commit.🤖 Generated with Claude Code