From: Jérôme Benoit Date: Mon, 25 May 2026 01:39:28 +0000 (+0200) Subject: fix(weights): pivot-only sample weights when label_weighting is active X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=952ab0fc525711b4f83cebd37c6e6c0a5860679c;p=freqai-strategies.git 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. --- diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index 2c93905..873b389 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -1176,7 +1176,7 @@ def compute_label_weights( n_values=n_values, indices=indices, weights=weights, - default_weight=float(np.nanmedian(weights)), + default_weight=0.0, )