Fit natural cubic polynomial splines, local regression and weighted smoothing splines to fit generalized additive models
Project description
##pysmoother allows you to -
-
Fit Univariate Natural Cubic Polynomial Splines. Allowing you to smooth a predictor and measure its effect on a target variable. Refer - Page 151, Equation 5.9 ,The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Second Edition February 2009. Trevor Hastie, Robert Tibshirani, Jerome Friedman
-
Fit Generalized Additive Models for p predictors with one target variable y. Refer - Page 298, Algorithm 9.1- The Backfitting Algorithm For Additive Model ,The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Second Edition February 2009. Trevor Hastie, Robert Tibshirani, Jerome Friedman
-
Fit the Local Scoring Algorithm for the Additive Logistic Regression Model. Refer - Page 300, Algorithm 9.2, The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Second Edition February 2009. Trevor Hastie, Robert Tibshirani, Jerome Friedman
-
Fit Local Regression Models to with p predictors. Allowing one to perform smoothing. Refer - Page 200, Local Regression in Rp, The Elements of Statistical Learning: Data Mining, Inference, and Prediction. Second Edition February 2009. Trevor Hastie, Robert Tibshirani, Jerome Friedman
Code Demo -
- Fit Univariate Natural Cubic Polynomial Splines
ss = SMOOTHING_SPLINES(X[:,i],Y,penalty = 10) ss.make_expanded_basis() ss.make_integral_matrix() ss.generate_coefficients(plot=True)
- Fit Generalized Additive Models for p predictors with one target variable y.
smoothing_type = {0:'s',1:'1',2:'s'} ## l = Loess, s = Smoothing Splines gam = GAM(X,Y,penalty=4,smoothing_type=smoothing_type) print(gam.fit_additive_models(iterations=15)) print(gam.fitted_func) print(gam.alpha) print(gam.resid)
##Your Final Fitted Curve will be gam.alpha + gam.fitted_func plt.plot(Y) plt.plot(np.sum(gam.fitted_func,axis=1)) plt.show()
3a) Fit a Weighted Smoothing Spline wss = WEIGHTED_SMOOTHING_SPLINE(X[:,i],Y,penalty=10,weight=np.ones(len(X))) wss.make_expanded_basis() wss.make_integral_matrix() wss.generate_coefficients(plot=True)
3b) Fit the Local Scoring Algorithm for the Additive Logistic Regression Model. LGAM = ADDITIVE_LOGISTIC_REGRESSION_MODEL(X,Y,penalty=10) LGAM.model_fit(iterations=10)
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysmoother-0.0.7.tar.gz.
File metadata
- Download URL: pysmoother-0.0.7.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f551f9bef197b9c1c3e07151aa7626bdce9149da2fe7df0c8e44974dc38757fe
|
|
| MD5 |
3be401daaa1e10c8ef396ed8af418271
|
|
| BLAKE2b-256 |
588ffff7c4a42b3dc556b1154ce76484221868a7e9dbe6f4feb0697f75b09d0c
|
File details
Details for the file pysmoother-0.0.7-py3-none-any.whl.
File metadata
- Download URL: pysmoother-0.0.7-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc20b7653d9e44e5808fc6bcc68b0b3584754c0227c547c12f23c9638368fcc8
|
|
| MD5 |
c0a590bfeae3060b5dde3bb673203d5d
|
|
| BLAKE2b-256 |
3f758e830da4aaa32d6447d7821e71dc0604ba92e127565493d789ea8e4f6ed9
|