]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(quickadapter): harden numerical guard paths (#79)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 21 Jun 2026 19:26:38 +0000 (21:26 +0200)
committerGitHub <noreply@github.com>
Sun, 21 Jun 2026 19:26:38 +0000 (21:26 +0200)
commitcdb92ceb60ecd7ecf1a0aa0cf6d4da0f0b7bd166
treeabccf36d44beec3df67e77e25b4eccfb0e02ee7f
parent6348f837f3e819dd6fe2505da9580e72545c20bb
fix(quickadapter): harden numerical guard paths (#79)

Shared finite-sample, guarded distribution-fit, safe divide/log-ratio,
and sigmoid-domain helpers. Log/division feature paths route through
the helpers; distribution fits guard empty, non-finite, and constant
samples.

- `Utils.py` helpers: `FiniteSample` dataclass with `finite_sample`;
  `safe_distribution_fit` (documented fallback-length contract);
  `safe_divide`; `safe_log_ratio`.
- `nan_average` finite/zero-weight guards; documented divergence from
  `np.nanmean` (strips +/-inf as well as NaN; bounded for current
  callers).
- `_clip_sigmoid_domain` in `LabelTransformer.py` guards
  `sp.special.logit` against values outside the open `(-1, 1)` domain
  during `sigmoid` inverse normalization.
- `feature_engineering_expand_basic` and Utils log/divide sites
  (`top_log_return`, `bottom_log_return`, `price_retracement_percent`,
  `ewo` normalize, `zigzag` log prices, KC/BB/VWAP widths) route
  through the safe helpers.
- DI Weibull and label `norm` fits in `fit_live_predictions` use
  `safe_distribution_fit`; DI cutoff fallback at
  `_DI_CUTOFF_DEFAULT: Final[float] = 2.0`.
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/LabelTransformer.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py