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 (Since R2021a)
CompactRegressionGAMCompact generalized additive model (GAM) for regression (Since R2021a)
RegressionPartitionedGAMCross-validated generalized additive model (GAM) for regression (Since R2021a)


expand all

fitrgamFit generalized additive model (GAM) for regression (Since R2021a)
compactReduce size of machine learning model
crossvalCross-validate machine learning model
templateGAMGeneralized additive model (GAM) learner template (Since R2023b)
addInteractionsAdd interaction terms to univariate generalized additive model (GAM) (Since R2021a)
resumeResume training of generalized additive model (GAM) (Since R2021a)
limeLocal interpretable model-agnostic explanations (LIME) (Since R2020b)
partialDependenceCompute partial dependence (Since R2020b)
permutationImportancePredictor importance by permutation (Since R2024a)
plotLocalEffectsPlot local effects of terms in generalized additive model (GAM) (Since R2021a)
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
shapleyShapley values (Since R2021a)
predictPredict responses using generalized additive model (GAM) (Since R2021a)
lossRegression loss for generalized additive model (GAM) (Since R2021a)
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