]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(quickadapter): validate Optuna numeric configuration (#190)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 30 Jul 2026 21:41:32 +0000 (23:41 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Jul 2026 21:41:32 +0000 (23:41 +0200)
commit963b79e5239998b4481fd636604bb2fba1cc748e
tree4333658cf40fdc1765e809ee05a6960c4db12c8f
parent7d1a937b9f4ca9913eb19d32e6b1c27583a37712
fix(quickadapter): validate Optuna numeric configuration (#190)

* fix(quickadapter): validate Optuna numeric configuration

* refactor(quickadapter): reuse shared numeric validator for Optuna config

Route the Optuna numeric configuration validation through a new public
Utils.require_numeric() helper that wraps the canonical _NumericValidator,
instead of reimplementing bool/int/range checks inline. This removes the
duplicated validation logic, harmonizes error messages with the rest of
the module, and drops the unreachable math.isfinite() branch on
space_fraction (non-finite values already fail the range check).

Also align the README seed range notation (int [0, 4294967295]) with the
existing int [2, 10000] style and the emitted error message.

Behavior-preserving: raise/pass outcomes are identical to the previous
implementation across the full option matrix, except unbounded integer
options with values >= 2**64 (n_trials, timeout, n_startup_trials) are now
rejected via the shared finiteness contract (values <= 2**63 unchanged).

* fix(quickadapter): preserve numeric validation contracts

Keep exact built-in type semantics when using the shared helper and treat arbitrary-precision Python integers as finite.

* refactor(quickadapter): reuse shared boolean validator for Optuna config

Route the Optuna boolean option validation through a new public
Utils.require_bool() helper that wraps the canonical _BoolValidator,
mirroring require_numeric(). This removes the last inline validation in
_optuna_config so both boolean and numeric checks now share the framework
validators, closing the residual duplication.

Behavior-preserving: raise/pass outcomes are identical to the previous
inline check across all boolean options (True/False accepted, every other
type rejected).

* docs(quickadapter): justify the int short-circuit in _is_finite_value

The comment stated a Python language truism (integers are arbitrary-precision
and finite) instead of explaining why the branch exists. Reword it to document
the load-bearing rationale: np.isfinite raises TypeError/OverflowError on Python
ints >= 2**64, so routing them through it would misclassify finite values as
non-finite. Comment-only change; no behavior change.
README.md
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/Utils.py