Generalized additive models in Python.
Project description
generalized-additive-models
About
Generalized Additive Models (GAM) are the Predictive Modeling Silver Bullet. A GAM is a statistical model in which the target variable depends on unknown smooth functions of the features, and interest focuses on inference about these smooth functions.
An exponential family distribution is specified for the target Y (.e.g Normal, Binomial or Poisson) along with a link function g (for example the identity or log functions) relating the expected value of Y to the predictor variables.
Installation
Install using pip:
pip install generalized-additive-models
Example
from sklearn.datasets import load_diabetes
from sklearn.model_selection import cross_val_score
from generalized_additive_models import GAM, Spline, Categorical
# Load data
data = load_diabetes(as_frame=True)
df, y = data.data, data.target
# Create model
terms = Spline("bp") + Spline("bmi", constraint="increasing") + Categorical("sex")
gam = GAM(terms)
# Cross validate
scores = cross_val_score(gam, df, y, scoring="r2")
print(scores) # array([0.26, 0.4 , 0.41, 0.35, 0.42])
Contributing
Contributions are very welcome. You can correct spelling mistakes, write documentation, clean up code, implement new features, etc.
Some guidelines:
Code must comply with the standard. See the GitHub action pipeline for more information.
If possible, use existing algorithms from numpy, scipy and scikit-learn.
Write tests, especically regression tests if a bug is fixed.
Take backward compatibility seriously. API changes require good reason.
Citing
TODO
Project details
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 generalized_additive_models-0.0.0.tar.gz
.
File metadata
- Download URL: generalized_additive_models-0.0.0.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa22074314475c76cfc8f9fb7ba5dd516827a37340cfa888d977f94189608ebd |
|
MD5 | c3214d1c985b3ec638fd93786921ad93 |
|
BLAKE2b-256 | b26b7b910f3a33b114033a7aa3dc7e2f115d78838657ac69dc4dc2ac094b0570 |
File details
Details for the file generalized_additive_models-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: generalized_additive_models-0.0.0-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44daeba7c08bda267fa95fdc4e49632c89a7d1302cc1ce444021d15a2f2d2f9f |
|
MD5 | dee1179d7c3818a7b1a0a012e3403e03 |
|
BLAKE2b-256 | 691d0586a45b057e7bc2324e2b56c98309a0f60b7536b1a325d26bf8917faae8 |