Table of Contents

Load the libraries

Load the data

Train Test Split

Modelling: pyGAM

Ref: https://pygam.readthedocs.io/en/latest/notebooks/tour_of_pygam.html

Method            link        distribution
----------------------------------------------------------
LinearGAM         identity    normal distribution
LogisticGAM logit link        binomial distribution
PoissonGAM        log         Poisson distribution
GammaGAM          log         gamma distribution
InvGauss          log         inv_gauss distribution

LinearGAM $\mathbb{E}[y \mid X]=\beta_{0}+f_{1}\left(X_{1}\right)+f_{2}\left(X_{2}, X 3\right)+\cdots+f_{M}\left(X_{N}\right)$

Parameters

Terms
l() linear terms
s() spline terms
f() factor terms
te() tensor products
intercept

Callbacks
Callbacks are performed during each optimization iteration. It’s also easy to write your own.

deviance - model deviance
diffs - differences of coefficient norm
accuracy - model accuracy for LogisticGAM
coef - coefficient logging

Model evaluation