Piecewise Linear Fit with ability to automatically find the optimal number of line segments. In addition outliers can be detected and avoided during the fitting process.
Full Documentation can be found here: Documentation
Installation available through pip: https://pypi.org/project/autopwlf/
pip install autopwlf
The piecewise fitting uses the pwlf module with full credit to all contributors to this package.
The currently available Piecewise Linear Fit models in Python do not have a method to determine the optimal number of break points to use. To do so this package performs the following steps:
- Smooth the data using a rolling median function
- Fit a linear interpolation function on the smoothened data
- Use scipy find_peaks function to find the number of extrema points
- Filter by primenence to return an estimate on the number of break points