Repository navigation
Open
Description
Why
#1682 pins quantile-forest==1.4.2 exactly, because _InPlaceLeafQRF in packages/microcosm-fit/src/microcosm/fit/qrf.py overrides a private 1.4.2 method. That pin keeps two 1.4.2 bugs that quantile-forest 1.5.0 (released 2026-11-07) fixes:
- Rows kept in a capped leaf can depend on the CPU (zillow/quantile-forest#181). 1.4.2's
group_indices_by_value(_utils.pyx) groups each tree's bootstrap draws by leaf withnp.argsort's default sort. That sort does not keep tied values in their original order, and NumPy's SIMD sorts order ties differently on different CPU instruction sets. When a leaf holds more rows thanmax_samples_leaf, its rows are shuffled with a seeded generator and truncated, so the same data and seed can keep different rows on different machines. microcosm setsmax_samples_leafto 4,096 for targets with 2 to 32 distinct values (_DISCRETE_Y_LEAF_BOUND), and_fill_tree_leavescalls the samegroup_indices_by_value. - Weighted-quantile search (zillow/quantile-forest#171).
calc_weighted_quantile, whichpredictuses by default whenmax_samples_leafis not 1, started its search at zero-weight inputs and rounded positions across exact ranks. microcosm predicts with the default weighted quantiles and linear interpolation over_QUANTILE_GRID, which runs from just above 0 to just below 1. The upstream PR says linear results with fractional weights are unchanged for quantiles strictly between 0 and 1. Whether the fix changes any microcosm draw has not been checked.
Not checked either: whether the first bug explains any of the cross-platform QRF differences recorded in docs/graph-qrf-cross-platform.md.
What moving to 1.5.0 involves
- scikit-learn 1.9. 1.5.0 requires scikit-learn 1.9 or later, and
uv.lockhas 1.8.0. - Predictions change. The default
interpolationbecomes"averaged_inverted_cdf", and leaf samples are weighted by their sample weights._fit_forestpasses nosample_weight, so only the interpolation default and the two fixes above would reach microcosm's draws. Passinginterpolation="linear"would keep the current quantile definition; that is a choice to make in this issue. _InPlaceLeafQRFis retired. 1.5.0 stores each leaf's training samples without padding (zillow/quantile-forest#201), which removes the memory problem the subclass works around. Its version check and the byte comparisons against 1.4.2 intest_qrf_leaf_array.pygo with it, andtools/measure_qrf_leaf_memory.pywould need to compare against 1.4.2 differently or be removed.- Recorded outputs move. Draws change, so the per-platform digests in
test_us_qrf_target_release.py, thefit.qrfparity fixture'sdirect.csv, and the hash pins that coverqrf.pyanduv.lockall need re-recording. The US build memory work required byte-identical outputs, so this step needs its own approval. - Pickles. Models pickled by 1.5.0 cannot be loaded by earlier versions. 1.5.0 loads models pickled by earlier versions, but
_Forestrefuses a model that is not_InPlaceLeafQRF, so that refusal changes with the class.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels
Activity