From: Jérôme Benoit Date: Thu, 17 Sep 2026 17:20:36 +0000 (+0200) Subject: fix(quickadapter): preserve zero power mean exponent in label selection X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b9dbdbd23a35c36a2faa1ff0df08285252969d87;p=freqai-strategies.git fix(quickadapter): preserve zero power mean exponent in label selection _validate_power_mean_p returns 0.0 for p=0 (a finite float accepted by README), and the falsy fallback silently rewrote it to 1.0, turning the documented generalized-mean p=0 (geometric) into arithmetic. Use an explicit None check for the fallback; map-based metrics are unchanged. Verified in the QA image (Freqtrade 2026.8): p=0 now matches geometric_mean selection (winner 1, identical distances), while p=None keeps the arithmetic default. --- diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index a53374c..c22143b 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -3642,10 +3642,11 @@ class QuickAdapterRegressorV3(BaseRegressionModel): mode: ValidationMode = "none", p_ctx: str = "p", ) -> NDArray[np.floating]: + validated_p = QuickAdapterRegressorV3._validate_power_mean_p(p, ctx=p_ctx, mode=mode) power = ( QuickAdapterRegressorV3._POWER_MEAN_MAP[distance_metric] if distance_metric in QuickAdapterRegressorV3._POWER_MEAN_METRICS_SET - else (QuickAdapterRegressorV3._validate_power_mean_p(p, ctx=p_ctx, mode=mode) or 1.0) + else (1.0 if validated_p is None else validated_p) ) if weights is None: weights = np.ones(matrix.shape[1])