elbow_helper.smoothing module

Phase 2 — the smoothing scale-space.

Generates a grid of odd smoothing windows (always including 1 = no smoothing) and applies a centered Gaussian smoother with reflected boundaries, implemented in pure NumPy (no scipy.ndimage).

Author

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

elbow_helper.smoothing.smooth_curve(y, window, method='gaussian')[source]

Smooth y with a centered kernel and reflected boundaries.

Parameters:
  • y (numpy.ndarray) – The signal to smooth.

  • window (int) – Approximate support width; window <= 1 returns y unchanged.

  • method (str, optional) – "gaussian" (default) or "moving_average" (a baseline).

Returns:

The smoothed signal, same length as y.

Return type:

numpy.ndarray

elbow_helper.smoothing.smoothing_grid(n, config)[source]

Odd smoothing windows for n samples, sorted ascending, deduplicated.

Parameters:
  • n (int) – Number of samples in the curve.

  • config (RobustKneeConfig) – smoothing_fractions are multiplied by n to size the windows.

Returns:

Distinct odd window widths, always starting with 1.

Return type:

list of int