polyfit
Scikit learn compatible constrained and robust polynomial regression in Python
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.6%) to scientific vocabulary
Keywords
Repository
Scikit learn compatible constrained and robust polynomial regression in Python
Basic Info
- Host: GitHub
- Owner: dschmitz89
- Language: Python
- Default Branch: master
- Homepage: https://polyfit.readthedocs.io/en/latest/
- Size: 361 KB
Statistics
- Stars: 10
- Watchers: 2
- Forks: 6
- Open Issues: 2
- Releases: 0
Topics
Metadata Files
README.md
Polyfit
![]()
Scikit learn compatible constrained and robust polynomial regression in Python.
Mostly developed for educational purposes, polyfit enables fitting scikit learn compatible polynomial regression models under shape constraints. Under the hood polynomial coefficients are optimized via cvxpy's excellent convex optimizers.
Installation:
bash
pip install polyfit
Documentation
Check the online documentation for an example and API reference.
Why?
Often human intuition or prior knowledge gives us an idea that relationships between variables should be monotonic or follow certain asymptotic behaviour. In this example the monotonic fit is visually much more convincing than an unconstrained fit.

Example
Simple example to fit a polynomial of degree 3 which is monotonically increasing for the first feature:
python
from polyfit import PolynomRegressor, Constraints
polyestimator = PolynomRegressor(deg=3, regularization = None, lam = 0)
monotone_constraint = Constraints(monotonicity='inc')
polyestimator.fit(X, y, loss = 'l2', constraints={0: monotone_constraint})
Method
The constraints are enforced by imposing inequality constraints upon the polynomial coefficients. For example, if the resulting one dimensional polynomial is required to be monotonically increasing, its first derivative must be greater than 0. Enforcing this for an interval is not possible but enforcing it for a reasonable number of points within an interval (default: 20) is usually enough to guarantee the monotonicity for this interval. Given the predictor vector x, target vector y and the Vandermonde matrix V the polynomial coefficients p are then estimated by the following optimization problem:
Warning: by default, the polynomial is only monotonic or convex/concave for the interval of the input data!
Owner
- Name: Daniel Schmitz
- Login: dschmitz89
- Kind: user
- Company: AllocNow
- Repositories: 6
- Profile: https://github.com/dschmitz89
Recovering scientist using github as playground in his spare time
GitHub Events
Total
- Issues event: 1
- Watch event: 3
- Issue comment event: 2
- Push event: 1
- Pull request event: 2
- Fork event: 2
Last Year
- Issues event: 1
- Watch event: 3
- Issue comment event: 2
- Push event: 1
- Pull request event: 2
- Fork event: 2
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| dschmitz89 | 4****9 | 22 |
| dschmitz89 | d****n@g****m | 15 |
| Schmitz, Daniel | d****z@f****e | 11 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 4
- Total pull requests: 6
- Average time to close issues: 29 days
- Average time to close pull requests: about 3 hours
- Total issue authors: 4
- Total pull request authors: 2
- Average comments per issue: 1.0
- Average comments per pull request: 0.17
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 15 hours
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 1.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- pmrv (1)
- Fasil-OK (1)
- HansLeonardVanBrueggemann (1)
- mmor92 (1)
Pull Request Authors
- dschmitz89 (5)
- pmrv (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 6,131 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 2
- Total maintainers: 1
pypi.org: polyfit
Constrained polynomial regression
- Homepage: https://github.com/dschmitz89/polyfit/
- Documentation: https://polyfit.readthedocs.io/
- License: MIT
-
Latest release: 1.0
published over 4 years ago
Rankings
Maintainers (1)
Dependencies
- cvxpy *
- ipykernel *
- ipython *
- matplotlib *
- nbsphinx *
- numpy *
- scikit-learn *
- cvxpy *
- numpy *
- scikit-learn *