]> Piment Noir Git Repositories - freqai-strategies.git/commit
refactor(quickadapter): consolidate causal epsilon-fill idioms (#171) (#177)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 30 Jul 2026 17:23:46 +0000 (19:23 +0200)
committerGitHub <noreply@github.com>
Thu, 30 Jul 2026 17:23:46 +0000 (19:23 +0200)
commit6da29070d951562eaf82f080fceeff23899c7a6c
treeeb4e6d689580867b0c51a70d27340aae8bcb260e
parent529207dac0c85a5baaddf8a6afba209ef4a696d2
refactor(quickadapter): consolidate causal epsilon-fill idioms (#171) (#177)

* refactor(quickadapter): consolidate causal epsilon-fill idioms (#171)

Extract the duplicated "segment-ends" idiom
`np.flatnonzero(np.r_[a[1:] != a[:-1], True])` into a pure helper
`_segment_ends` and call it from its three sites: `_causal_impute_weights`,
`_compute_causal_epsilon_fill`, and `_compute_knn_pivot_sigma_availability`
(where the flipped operand order is equivalent by symmetry of `!=`).

Route the two verbatim-duplicated `fill_epsilon_baseline` `ValueError`
messages in `_compute_epsilon_floor` and `_compute_causal_epsilon_fill`
through the existing `enum_error_message` factory; the produced string is
unchanged and the scalar vs expanding baseline computations are untouched.

Purely internal deduplication; no behavior change. Bit-for-bit equivalence
of the four affected functions verified against the prior revision by
randomized fuzzing in the quickadapter-freqtrade container.

* docs(quickadapter): clarify _segment_ends run contiguity (#171)
quickadapter/user_data/strategies/Utils.py