Code Generation for Prediction and Update Using Coder Configurer
A coder configurer offers convenient features to configure code generation options, generate C/C++ code, and update model parameters in the generated code.
Configure code generation options and specify the coder attributes of model parameters using object properties.
Generate C/C++ code for the
predict
andupdate
functions of the model by usinggenerateCode
. This requires MATLAB® Coder™.Update model parameters in the generated C/C++ code without having to regenerate the code. This feature reduces the effort required to regenerate, redeploy, and reverify C/C++ code when you retrain the model with new data or settings. Before updating model parameters, use
validatedUpdateInputs
to validate and extract the model parameters to update.
This flow chart shows the code generation workflow for the predict
and update
functions
using a coder configurer.
After training a model, create a coder configurer by using
learnerCoderConfigurer
, generate code by usinggenerateCode
, and then verify the generated code.After you retrain the model with new data or settings, use
validatedUpdateInputs
to validate and extract the model parameters. If the retrained model is not eligible for an update, thenvalidatedUpdateInputs
returns an error, and you can then create a coder configurer. Otherwise, you can update model parameters in the generated C/C++ code without having to regenerate the code.
This table shows coder configurer objects corresponding to the supported machine learning models.
Model | Coder Configurer Object |
---|---|
Binary decision tree for multiclass classification | ClassificationTreeCoderConfigurer |
SVM for one-class and binary classification | ClassificationSVMCoderConfigurer |
Linear model for binary classification | ClassificationLinearCoderConfigurer |
Multiclass model for SVMs and linear models | ClassificationECOCCoderConfigurer |
Binary decision tree for regression | RegressionTreeCoderConfigurer |
Support vector machine (SVM) regression | RegressionSVMCoderConfigurer |
Linear regression | RegressionLinearCoderConfigurer |
For details and examples, see the reference pages for the coder configurer objects.
See Also
learnerCoderConfigurer
| generateCode
| generateFiles
| validatedUpdateInputs
| update