fix(estimator): sanity-clamp quarter-index factor (#859) #863
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#863
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/859-quarter-index-factor-clamp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Defensive follow-up from PR #858 (#764) review. The quarter-index
factor = target_index / avg_analog_indexapplied to a client-visible price was unbounded — a pathologicalavg_analog_index(dirty FDW data) could yield an extreme multiplier. Clamp it:estimate_quarter_index_factor_min=0.6,estimate_quarter_index_factor_max=1.8(outside the realistic quarter-to-quarter location spread for EKB вторичка)._apply_quarter_indexso the helper stays pure/unit-testable.Test plan
pytest -k estimator→ 197 passed;ruffclean; no:x::type.scripts/backtest_estimator.pyneeds live DB + real ДКП deals, not runnable autonomously. Clamp is MAPE-neutral by construction: bounds [0.6,1.8] lie outside the factor range produced by the validated #763 cases, so the clamp never fires on validated data. Post-merge confirmation item.Note for reviewer
Touches
config.py+estimator.py(both also in flight elsewhere). The estimator change is confined to_apply_quarter_index+ its one caller; config block is additive next to the existingestimate_quarter_index_*params.Refs #859, #764, #763
✅ APPROVE — реализует follow-up #859 (factor sanity-clamp) точно по спеку.
Проверено:
raw_factor = target_index/avg_analog_index; factor = max(min_factor, min(max_factor, raw_factor))— стандартный clamp. INFO-лог только при реальном clamp (if raw_factor != factor). Bounds из settings (0.6/1.8), переданы kwargs → хелпер остаётся pure (defaults сохранены → backward-compat).settings.estimate_quarter_index_factor_min/max.MAPE-нейтральность: bounds [0.6,1.8] вне диапазона factor'ов validated #763-кейсов → clamp на validated-данных не срабатывает → MAPE не меняется. Backtest-rerun отложен (нужна live-БД) — корректно как post-merge confirmation; clamp может только УМЕНЬШИТЬ экстремальную коррекцию, не ухудшить нормальную.
Anti-regression: estimator.py — только
_apply_quarter_index(+2 kwargs с defaults) + 1 caller. config — additive в quarter-index секции (distinct от #862's avito-секции). #862 не трогал estimator.py → нет конфликта. Секретов/self-extending нет.Мержу. #859 → qa.