elbow_helper.search module
The shared inner search: candidates -> filter -> cluster -> confirm.
Factored out so the main pipeline, the bootstrap replicates, and the null-test replicates all run the same detection logic. The search-adjusted test statistic (used by the null test) is a lexicographic tuple, in decreasing priority: passed model confirmation, cluster dominance, prominence-to-noise.
- class elbow_helper.search.SearchResult(detected, reason=None, knee_x_norm=None, window=None, cluster=None, segment=None, statistic=(0, 0.0, 0.0), n_candidates=0, n_filtered=0)[source]
Bases:
objectOutcome of one inner detection pass over a (prepared) curve.
- Parameters:
- cluster: CandidateCluster | None = None
- segment: SegmentEvidence | None = None
- elbow_helper.search.run_search(prepared, config, confirm=True)[source]
Run the full inner detection pass (no bootstrap, no null test).
- Parameters:
prepared (PreparedCurve) – The normalized curve.
config (RobustKneeConfig) – Search thresholds.
confirm (bool, optional) – Whether to run the segmented-model confirmation (Phase 6). The main pipeline and the null test set this
True; the bootstrap sets itFalsefor speed (it re-tests stability, not model fit).
- Returns:
detectedwith the winning cluster and statistic or an abstention with a reason code.- Return type: