Main Content

Generalized Additive Model

Interpretable model composed of univariate and bivariate shape functions for regression

Use fitrgam to fit a generalized additive model for regression.

A generalized additive model (GAM) is an interpretable model that explains a response variable using a sum of univariate and bivariate shape functions of predictors. fitrgam uses a boosted tree as a shape function for each predictor and, optionally, each pair of predictors; therefore, the function can capture a nonlinear relation between a predictor and the response variable. Because contributions of individual shape functions to the prediction (response value) are well separated, the model is easy to interpret.


RegressionGAMGeneralized additive model (GAM) for regression
CompactRegressionGAMCompact generalized additive model (GAM) for regression
RegressionPartitionedGAMCross-validated generalized additive model (GAM) for regression


expand all

fitrgamFit generalized additive model (GAM) for regression
compactReduce size of machine learning model
crossvalCross-validate machine learning model
addInteractionsAdd interaction terms to univariate generalized additive model (GAM)
resumeResume training of generalized additive model (GAM)
limeLocal interpretable model-agnostic explanations (LIME)
partialDependenceCompute partial dependence
plotLocalEffectsPlot local effects of terms in generalized additive model (GAM)
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
shapleyShapley values
predictPredict responses using generalized additive model (GAM)
lossRegression loss for generalized additive model (GAM)
resubPredictPredict responses for training data using trained regression model
resubLossResubstitution regression loss
kfoldPredictPredict responses for observations in cross-validated regression model
kfoldLossLoss for cross-validated partitioned regression model
kfoldfunCross-validate function for regression


Train Generalized Additive Model for Regression

Train a generalized additive model (GAM) with optimal parameters, assess predictive performance, and interpret the trained model.