Why do I get “cannot load an object of class ‘compactcl?assificati?on
Why do I get “cannot load an object of class ‘compactcl?assificati?onECOC’” after compiling a standalone application of a machine learning model?
I have a trained machine learning model saved as a MAT file that is loaded in my App Designer application.
When I compile the app into a standalone application with MATLAB Compiler, I get the following error when running it:
cannot load an object of class 'compactclassificationECOC'
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
During the compilation process, a dependency analysis is run to pick up files that the code relies on. In this case, the dependent functions are specified as a value in the trained model struct loaded through a MAT file. This causes the analysis to miss the necessary files.
To work around this, we can add a “function pragma” to the function to make the dependency explicit:
% App designer method
function myAppCallback(app, event)
%#function classreg.learning.classif.CompactClassificationECOC
[ additional code ]
The “function pragma” was added based on the “ClassificationSVM” values in the trained model struct:
SEE COMPLETE ANSWER CLICK THE LINK