NeuralNetw​orkClassif​ication object not supported for code generation

3 views (last 30 days)
I trained a model using fitcnet() as follows:
mdl = fitcnet(trainTable,"Labels","Standardize",true,"Verbose",1)
I would like to see what the C/C++ code looks like so I tried
saveLearnerForCoder(mdl,'fitcnetCode')
but got the following error message:
First argument must be a classification, regression, or nearest neighbor searcher model supported for code generation.
Looking at https://www.mathworks.com/help/stats/savelearnerforcoder.html#bvclu99-Mdl models generated by fitcnet should work as they are ClassificationNeuralNetwork objects. Seems like a straightforward implementation. Why do I get that error?

Answers (1)

Ji Lee
Ji Lee on 6 Apr 2022
MATLAB Coder code generation support for neural networks became available recently in R2022a:
That particular documentation link points to the documentation for the latest release (R2022a). If you are using R2021b, you'll want to examine the archived R2021b version of that documentation:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!