]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(weights): pivot-only sample weights when label_weighting is active
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 25 May 2026 01:39:28 +0000 (03:39 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 25 May 2026 01:39:28 +0000 (03:39 +0200)
commit952ab0fc525711b4f83cebd37c6e6c0a5860679c
treeaebd996a8486c2454d9b54cff8a44eaad9dc1116
parentb4950444cd9484a5191713e09160a8c238bb5d0e
fix(weights): pivot-only sample weights when label_weighting is active

Replace the full-series median fill with 0.0 in compute_label_weights so
non-pivot rows carry no sample weight when a label_weighting strategy is
configured. The median fill predates PR #72: when weights multiplied the
label, the fill was inert (label=0 × median=0). Once weights became the
sample_weight kwarg of model.fit, the fill silently leaked the median
into the training loss for every non-pivot row, diluting the pivot
detection signal the model is being trained for.

Concretely, training now concentrates on pivots and their smoothed
neighborhoods (via label_smoothing), and the raw/smoothed weight plots
both render clean profiles starting from zero.

strategy='none' (the default) is unaffected: compute_label_weights still
returns a uniform 1.0 vector and every row contributes equally.
quickadapter/user_data/strategies/Utils.py