elbow_helper.pipeline module
Phase 9 — the public robust_knee orchestration.
Chains preprocessing -> inner search -> segmented confirmation -> bootstrap ->
null test, short-circuiting to an explicit NoClearKnee at the first
gate that fails and accumulating diagnostics at every stage. Only a candidate
that survives all gates is returned as a ClearKnee.
- elbow_helper.pipeline.robust_elbow(x, y=None, config=None)[source]
Convenience wrapper for the classic convex-decreasing elbow.
Equivalent to
robust_knee()withcurve="convex"anddirection="decreasing", the k-means inertia / scree-plot case.ymay be omitted, as inrobust_knee().- Parameters:
config (RobustKneeConfig | None)
- Return type:
- elbow_helper.pipeline.robust_knee(x, y=None, curve=None, direction=None, config=None)[source]
Detect a knee conservatively or abstain with a reason.
- Parameters:
x (array-like) – The curve:
x[i]maps toy[i].xneed not be sorted or unique; preprocessing handles cleaning, sorting, deduplication and normalization.ymay be omitted, in which casexis taken to be the sequence of y-values alone and the implicit x-axis0, 1, ..., n-1is used.y (array-like) – The curve:
x[i]maps toy[i].xneed not be sorted or unique; preprocessing handles cleaning, sorting, deduplication and normalization.ymay be omitted, in which casexis taken to be the sequence of y-values alone and the implicit x-axis0, 1, ..., n-1is used.curve (str, optional) –
"concave"(knees) or"convex"(elbows). If omitted, inferred from the data: a curve lying above the chord connecting its endpoints is concave, below is convex.direction (str, optional) –
"increasing"or"decreasing". If omitted, inferred from the sign of the trend betweenxandy.config (RobustKneeConfig, optional) – Thresholds and replicate counts. Defaults to
RobustKneeConfig.
- Returns:
A
ClearKnee(with location, 90% interval and diagnostics) or aNoClearKnee(with a reason code and diagnostics).- Return type: