Main Content

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 and update functions of the model by using generateCode. 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.

Code generation workflow for the predict and update functions with a coder configurer

  • After training a model, create a coder configurer by using learnerCoderConfigurer, generate code by using generateCode, 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, then validatedUpdateInputs 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.

ModelCoder Configurer Object
Binary decision tree for multiclass classificationClassificationTreeCoderConfigurer
SVM for one-class and binary classificationClassificationSVMCoderConfigurer
Linear model for binary classificationClassificationLinearCoderConfigurer
Multiclass model for SVMs and linear modelsClassificationECOCCoderConfigurer
Binary decision tree for regressionRegressionTreeCoderConfigurer
Support vector machine (SVM) regressionRegressionSVMCoderConfigurer
Linear regressionRegressionLinearCoderConfigurer

For details and examples, see the reference pages for the coder configurer objects.

See Also

| | | |

Related Topics