_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.
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])