Main Content

Generalized Additive Model

Interpretable model composed of univariate and bivariate shape functions for binary classification

Use fitcgam to fit a generalized additive model for binary classification.

A generalized additive model (GAM) is an interpretable model that explains class scores (the logit of class probabilities) using a sum of univariate and bivariate shape functions of predictors. fitcgam 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 (classification score) are well separated, the model is easy to interpret.


ClassificationGAMGeneralized additive model (GAM) for binary classification
CompactClassificationGAMCompact generalized additive model (GAM) for binary classification
ClassificationPartitionedGAMCross-validated generalized additive model (GAM) for classification


expand all

fitcgamFit generalized additive model (GAM) for binary classification
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
predictClassify observations using generalized additive model (GAM)
lossClassification loss for generalized additive model (GAM)
marginClassification margins for generalized additive model (GAM)
edgeClassification edge for generalized additive model (GAM)
resubPredictClassify training data using trained classifier
resubLossResubstitution classification loss
resubMarginResubstitution classification margin
resubEdgeResubstitution classification edge
kfoldPredictClassify observations in cross-validated classification model
kfoldLossClassification loss for cross-validated classification model
kfoldMarginClassification margins for cross-validated classification model
kfoldEdgeClassification edge for cross-validated classification model
kfoldfunCross-validate function for classification
compareHoldoutCompare accuracies of two classification models using new data
testckfoldCompare accuracies of two classification models by repeated cross-validation