{"categories":[{"label":"Mathematics","url":"https://skillfed.io/packages/category/scientific-engineering-mathematics/2"}],"enrichment":{"capability":"Fits continuous piecewise linear functions to data by specifying the number of line segments and providing x-y data, with support for weighted fits and multiple optimization strategies.","skillfed_tags":["curve-fitting","optimization","regression"],"use_cases":["Detect and model regime changes in time-series data where behavior shifts between distinct linear trends","Approximate nonlinear curves with continuous piecewise linear segments for interpretability and computational efficiency","Fit material stress-strain curves or other physical phenomena exhibiting multiple linear regions with known transition points","Perform change-point analysis in experimental or observational data to identify where relationships between variables shift","Build reduced-order models of complex systems by segmenting the input domain and fitting linear approximations per segment"],"what_it_does":"pwlf is a Python library for fitting continuous piecewise linear functions to data using least squares optimization. You specify how many line segments you want, provide your x-y data, and the library finds the optimal breakpoint locations and segment slopes that minimize residuals. It uses scipy's differential evolution algorithm by default for global optimization, but also offers a faster multi-start gradient-based approach and supports custom optimization routines.\n\nThe library handles several fitting scenarios: automatic breakpoint discovery for a specified number of segments, fitting with known breakpoint locations, and weighted regression. It depends on numpy and scipy for numerical computation and linear algebra. The underlying mathematics are based on least squares formulation with global optimization to locate breakpoints, making it suitable for data that exhibits piecewise-linear behavior across different regions.","worth_installing":"Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive MIT License. It solves a specific numerical problem\u2014fitting piecewise linear functions\u2014with a clean API and multiple optimization strategies. Install it if you need to model data with distinct linear regimes or approximate nonlinear relationships with continuous piecewise linear segments."},"id":"pwlf","links":{"html":"https://skillfed.io/packages/pwlf","md":"https://skillfed.io/packages/pwlf.md","pypi":"https://pypi.org/project/pwlf/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-07-17","license_spdx":null,"license_treatment":"permissive","name":"pwlf","python_support":"supports_current","summary":"fit piecewise linear functions to data"},"popularity":{"monthly_downloads":265750,"position":8315,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"2.6.0"}
