Is there any way in MATLAB to store a compact version of a Generalized Linear Model?
2 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 May 2017
Edited: MathWorks Support Team
on 4 May 2023
We have a problem in which we need to store a large number of model results from fitglm for later use in prediction. The predict function takes the entire model structure as input. Since the model structure contains many tables that we do not need and would prefer not to have to store, I am writing to ask if there is a minimal structure needed for a prediction and can that be stored separately on disk for later use? We have considered storing just the coefficients but that can create problems when there are categorical variables.
Accepted Answer
MathWorks Support Team
on 4 May 2023
Edited: MathWorks Support Team
on 4 May 2023
You can use the function "compact" (released in MATLAB R2016b) in order to compress many of the models and objects used in the Statistics and Machine Learning Toolbox. In the case of generalized linear models, the compact model uses less memory than the full model because it does not include a copy of the data or anything comparable in size to the data. However, the compact model also does not support some properties (such as Residuals) or function (such as addTerms) that require the actual data. Refer to the following page for more information about the "compact" function:
0 Comments
More Answers (0)
See Also
Categories
Find more on Naive Bayes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!