incline.L1TrendFilter¶
- class incline.L1TrendFilter(lambda_param=1.0, lambda_fraction=None, difference_order=2, max_iter=100, tol=0.0001)[source]¶
L1 trend filtering: piecewise-polynomial fit with sparse kinks.
Solved by ADMM. The soft-thresholding step is nonlinear in the data – that is the whole point, since it is what produces changepoints – so uncertainty is bootstrapped.
Note that the penalty’s difference order and the derivative being reported are separate things; the previous implementation used one parameter for both.
- Variables:
lambda_param (float) – Absolute penalty on the differences. Larger means fewer kinks. Ignored when
lambda_fractionis set.lambda_fraction (float | None) – Penalty as a fraction of the value above which the fit collapses to a plain polynomial. Being relative to the data is what makes it comparable across series; an absolute penalty is not.
difference_order (int) – Order of the penalized difference. Two gives a piecewise-linear trend, the usual choice.
max_iter (int) – ADMM iteration cap.
tol (float) – Convergence tolerance on the primal variable.
- Parameters:
- __init__(lambda_param=1.0, lambda_fraction=None, difference_order=2, max_iter=100, tol=0.0001)¶
Methods
__init__([lambda_param, lambda_fraction, ...])analytic_operators(axis, order)State the smoothing and derivative operators directly, if known.
evaluate(axis, y, order)Solve the L1 trend filtering problem, then difference the fit.
fit(axis, y[, order, se, noise, ...])Estimate the trend and, optionally, its uncertainty.
native_posterior(axis, y, order, ...)Uncertainty from the smoother's own probability model.
operators(axis, order)The smoothing and derivative operators for this configuration.
params()Report the penalty and difference order.
scale_of(axis)The relative penalty is already a scale.
with_scale(scale, axis)Set the penalty as a fraction of its saturating value.
Attributes
has_native_posterioris_linearWhether the derivative is a fixed linear map of the data.
linearrequires_regular_gridsupported_orders