Compact generalized linear regression model class
CompactGeneralizedLinearModel is a compact version of a full
generalized linear regression model object
GeneralizedLinearModel. Because a compact model does not store the input
data used to fit the model or information related to the fitting process, a
CompactGeneralizedLinearModel object consumes less memory than a
GeneralizedLinearModel object. You can still use a compact model to
predict responses using new input data, but some
object functions do not work with a compact model.
CompactGeneralizedLinearModel model from a full, trained
GeneralizedLinearModel model by using
when you work with tall arrays, and returns
you work with in-memory tables and arrays.
Evaluate Generalized Linear Model
|Confidence intervals of coefficient estimates of generalized linear regression model|
|Linear hypothesis test on generalized linear regression model coefficients|
|Analysis of deviance for generalized linear regression model|
|Compute partial dependence|
Visualize Generalized Linear Model and Summary Statistics
|Create partial dependence plot (PDP) and individual conditional expectation (ICE) plots|
|Plot of slices through fitted generalized linear regression surface|
Gather Properties of Generalized Linear Model
Compact Generalized Linear Regression Model
Fit a generalized linear regression model to data and reduce the size of a full, fitted model by discarding the sample data and some information related to the fitting process.
largedata4reg data set, which contains 15,000 observations and 45 predictor variables.
Fit a generalized linear regression model to the data using the first 15 predictor variables.
mdl = fitglm(X(:,1:15),Y);
Compact the model.
compactMdl = compact(mdl);
The compact model discards the original sample data and some information related to the fitting process, so it uses less memory than the full model.
Compare the size of the full model
mdl and the compact model
vars = whos('compactMdl','mdl'); [vars(1).bytes,vars(2).bytes]
ans = 1×2 15518 4382501
The compact model consumes less memory than the full model.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
When you fit a model by using
stepwiseglm, you cannot specify
Inversefields of the
'Link'name-value pair argument as anonymous functions. That is, you cannot generate code using a generalized linear model that was created using anonymous functions for links. Instead, define functions for link components.
For more information, see Introduction to Code Generation.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
The object functions of the
CompactGeneralizedLinearModelmodel fully support GPU arrays.
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Introduced in R2016b