API#
This page contains API documentation for the classes.
Terms#
Terms are used in GAMs to model the features.
For instance, we can use Spline
and Categorical
as follows:
terms = Spline("age") + Categorical("sex")
This constructs a TermList
, which can be passed to a GAM
.
model = GAM(terms)
Here are all the available terms:
An intercept term. |
|
|
A linear term. |
|
A Categorial term. |
|
A Spline term. |
|
A Tensor term. |
TermList#
A TermList
is a subclass of list
, designed to hold terms.
|
Links#
Link functions relate linear predictions \(\eta_i = X_i \beta\) to the expected values \(\mu_i\) of an exponential family distribution.
For instance, if you believe the features multiply together to create \(\mu_i\), you can model this with the Log
link as
This implies that \(\mu_i = \exp(X_i \beta) = \exp(X_{ij} \beta_j)\)
|
Identity link: \(g(\mu) = \mu\) |
|
Log link: \(g(\mu) = \log(\mu)\) |
|
Logit link: \(g(\mu) = \log(\mu / (1 - \mu))\) |
|
Softplus link: \(g(\mu) = \log(\exp(a \mu) - 1)/a\) |
Distributions#
|
Normal Distribution |
|
Poisson Distribution |
|
Binomial Distribution |
|
Gamma Distribution |
|
Inverse Gaussian Distribution |
|
Exponential Distribution |
|
Bernoulli Distribution |
Models#
|
Initialize a Generalized Additive Model (GAM). |
|
Initialize an ExpectileGAM. |