Implementation of the Robust Local Polynomial Regression with Similarity Kernel draft paper
Project description
Robust Local Polynomial Regression with Similarity Kernels
TL;DR
This library is useful to perform robust locally weighted regression (similar to LOESS) in Python when:
- There are no particular assumptions on the underlying function except that it is "reasonably smooth". In particular, you don't know which parametric model to specify or if an appropriate model exists.
- There are no particular assumptions on the type and intensity of noise present.
- There are no particular assumptions on the presence of outliers and their extent.
- You may want to predict in locations not explicitly present in the dataset but also not too far from existing observations or far outside the areas where observations exist.
- The independent inputs are univariate or multivariate.
- The dependent variable is univariate.
- You want a straightforward hassle-free way to tune the model and the smoothness of fit.
- You may want to calculate confidence intervals.
- You may want to filter noise to recover the original underlying process.
- You may want to impute or resample the data.
If the above use cases hold then this library could be useful for you. Have a look at this notebook https://nbviewer.org/github/yaniv-shulman/rsklpr/tree/main/docs/usage.ipynb for an example of how to use this library to perform regression easily.
Installation
Install from PyPI using pip (preferred method):
pip install rsklpr
What's new?
- Version 0.7.0 - Metrics including local R-Squared and more efficient computation of WLS.
- Version 0.6.0 - Bootstrap inference and confidence intervals
Details
Local polynomial regression (LPR) is a powerful and flexible statistical technique that has gained increasing popularity in recent years due to its ability to model complex relationships between variables. Local polynomial regression generalizes the polynomial regression and moving average methods by fitting a low-degree polynomial to a nearest neighbors subset of the data at the location. The polynomial is fitted using weighted ordinary least squares, giving more weight to nearby points and less weight to points further away. Local polynomial regression is however susceptible to outliers and high leverage points which may cause an adverse impact on the estimation accuracy. This library implements a variant of LPR presented in the Robust Local Polynomial Regression with Similarity Kernels draft paper which uses a generalized similarity kernel that assign robust weights to mitigate the adverse effect of outliers in the local neighborhood by estimating and utilizing the density at the local locations.
Experimental results
The experimental results and demonstration of the library for various experimental settings are available as interactive Jupyter notebooks at https://nbviewer.org/github/yaniv-shulman/rsklpr/tree/main/src/experiments/
KDE Implementation
KDE implementation is a copy of the code from statsmodels https://www.statsmodels.org/stable/index.html. The copy is done to remove statsmodels as a dependency of this package since statsmodels is quite heavy and pulls a lot of additional packages.
Contribution and feedback
The paper is work in progress and the library in early stages of development but both are in a useful state. Contributions and feedback are most welcome both to the paper and the code. Please see CONTRIBUTING.md for further details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rsklpr-0.8.1.tar.gz
.
File metadata
- Download URL: rsklpr-0.8.1.tar.gz
- Upload date:
- Size: 32.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.10 Linux/5.15.0-117-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c9f7649ad4b437188ad9fa670feddf4f5c9b2542d8b2efe3ef305d70d85b649 |
|
MD5 | e8e5da72592c5ec9d1c279767f635cda |
|
BLAKE2b-256 | 077e52b9844e4803a0089ab4196e54c5b12b453131b38ea23a68a5f01d4130c5 |
File details
Details for the file rsklpr-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: rsklpr-0.8.1-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.8.10 Linux/5.15.0-117-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 377199230816f92493aefcaafb6b4d23518be6edc68473e3ab5337f94e65ab52 |
|
MD5 | a363c29c792d31fa2b7822bbc5e35b89 |
|
BLAKE2b-256 | 91bfa2e224a67b330e40553c6dd3a12f354ad53e4d4e441b311994a1ae87e528 |