]> Piment Noir Git Repositories - freqai-strategies.git/commit
refactor(quickadapter): deduplicate regressor (min,max) finite fallback (#176)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 30 Jul 2026 17:22:55 +0000 (19:22 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Jul 2026 17:22:55 +0000 (19:22 +0200)
commit6f28a959738289480babf457f7779c59f7859d57
treed9f588c25970c5fc908deb0088b6415dcb579459
parentb28d13b3d080b9f50e10f956c7f9887aeda0e433
refactor(quickadapter): deduplicate regressor (min,max) finite fallback (#176)

* refactor(quickadapter): deduplicate regressor (min,max) finite fallback

Extract `_resolve_min_max` applying the finite fallback once and reuse it
from `soft_extremum_min_max`, `median_min_max`, and `skimage_min_max`.
Fold the `safe_min_pred`/`safe_max_pred` twins into a `_safe_pred` core
with two thin wrappers passing the load-bearing +/-2.0 sentinels explicitly.

The finite branch returns the candidate unchanged (no float() coercion),
preserving dtype; only the non-finite branch routes through the unchanged
safe_*_pred fallback. Outputs are bit-for-bit unchanged (verified in
quickadapter-freqtrade:latest across 38 finite/non-finite edge cases).

* docs(quickadapter): document dtype-preserving fallback invariant

Add a comment on `_resolve_min_max` capturing the load-bearing invariant
surfaced during review: finite candidates are returned without float()
coercion to preserve their dtype, and the ±2.0 sentinels are the
out-of-domain bounds of normalized labels. Behavior unchanged; bit-for-bit
equivalence re-verified in quickadapter-freqtrade:latest (38 edge cases,
0 divergence).

* docs(quickadapter): scope fallback sentinel comment to default label range

Refine the `_resolve_min_max` comment surfaced in re-review: the ±2.0
sentinels sit outside the default [-1, 1] normalized label range (not
universally, since normalization="none" and custom minmax_range are
unbounded), and the no-float()-coercion note is tied to preserving the
pre-refactor bit-for-bit behavior rather than an incidental dtype.
Comment-only; behavior re-verified bit-for-bit in the container.

* docs(quickadapter): harmonize fallback comment code formatting

Wrap `float()` in RST double backticks in the `_resolve_min_max` comment
to match the class's explanatory-comment convention for code identifiers.
Comment-only; behavior re-verified bit-for-bit in the container.

* docs(quickadapter): relocate regressor fallback sentinel comment

Drop the historical (pre-refactor) finite-passthrough comment in
_resolve_min_max, whose behavior is self-evident from the code, and
document the surviving non-evident invariant (±2.0 fallbacks are
out-of-[-1, 1] normalized-range sentinels) at the safe_min_pred/
safe_max_pred definition site.
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py