fix(sf-21b): _INLINE_VELOCITY_SQL weighted AVG (P0 follow-up) #291

Merged
lekss361 merged 1 commit from fix/sf-21b-inline-velocity-weighted into main 2026-05-17 14:02:44 +00:00

1 commit

Author SHA1 Message Date
lekss361
2104ed879b fix(sf-21b): weighted AVG in _INLINE_VELOCITY_SQL (best_layouts.py)
Replace unweighted AVG(deals_total_avg_area_m2) and AVG(deals_total_avg_price_thousand_rub_per_m2)
with SUM(x * count) / NULLIF(SUM(count), 0) pattern in _INLINE_VELOCITY_SQL.
Months with zero deals no longer dilute the weighted mean 2-4x.
P0 follow-up to PR #290 (mv fix, issue #21).
2026-05-17 16:56:22 +03:00