elbow_helper.segmented module

Phase 6 — slope contrast and broken-line model confirmation.

Confirms a candidate knee three ways: a robust (Theil-Sen) slope change across it, a continuous broken-line fit that beats a single line on blocked cross-validation, and a decisive BIC improvement. All NumPy; the broken-line term c * max(0, x - k) guarantees continuity at the knee.

Author

Warith Harchaoui, <warith.harchaoui@deraison.ai>

elbow_helper.segmented.confirm_segmented_model(prepared, knee_x_norm, config)[source]

Test whether a broken line at knee_x_norm is genuinely better.

Parameters:
Returns:

Slope contrast, both slopes, BIC and CV improvements, and a pass flag (with a reason code when it fails).

Return type:

SegmentEvidence