incline.l1_trend_filter

incline.l1_trend_filter(df, value_column='value', time_column=None, *, penalty=None, penalty_fraction=None, difference_order=2, max_iter=1000, tolerance=1e-08, **kwargs)[source]

Estimate a piecewise-polynomial trend with sparse changes in slope.

Parameters:
  • df (pd.DataFrame) – Time series data.

  • value_column (str) – Column holding the values.

  • time_column (str | None) – Numeric time column.

  • penalty (float | None) – Absolute penalty on the differences; larger means fewer kinks. Exactly one of this and penalty_fraction is required.

  • penalty_fraction (float | None) – Fraction of the smallest penalty that reduces the fit to a polynomial of degree difference_order - 1. Exactly one of this and penalty is required.

  • difference_order (int) – Order of the penalized difference. Two gives a piecewise-linear trend.

  • max_iter (int) – Bounded least-squares iteration cap.

  • tolerance (float) – Optimizer convergence tolerance.

  • **kwargs (Any) – Uncertainty options; see estimate().

Returns:

The input frame plus the estimate columns.

Return type:

pd.DataFrame