Main Content

FunctionApproximation.TransformFunction Class

Namespace: FunctionApproximation

Object defining transform function to approximate

Since R2023a


Use the FunctionApproximation.TransformFunction object to define a score transformation function of a trained classifier to approximate with an optimized lookup table to use for fixed-point code generation. After defining the FunctionApproximation.TransformFunction object, use the approximate method to solve for the lookup table approximation.



approxObj = FunctionApproximation.TransformFunction(filename,X,T)

Input Arguments

expand all

Name of MAT-file that contains structure array representing a model object, specified as a character vector or string scalar.

After training a machine learning model, use the saveLearnerForCoder (Statistics and Machine Learning Toolbox) function to create filename. The extension of filename must be .mat.

Example: saveLearnerForCoder(model,'filename');

Data Types: char | string

Predictor data for the predict function of the model stored in filename, specified as an n-by-p numeric matrix, where n is the number of observations and p is the number of predictor variables.

The data set X used in FunctionApproximation.TransformFunction must be the same data that was passed to the generateLearnerDataTypeFcn function.

Data Types: single | double

Data types for fixed-point code generation, specified as a structure.

Use the generateLearnerDataTypeFcn (Statistics and Machine Learning Toolbox) function to generate the myMdl_datatype function. Then, use the myMdl_datatype function to create a structure that defines the fixed-point data types.

Example: generateLearnerDataTypeFcn('myMdl',[X; XTest]); T = myMdl_datatype('Fixed');


expand all

Score transformation function to approximate with a lookup table, specified as a FunctionApproximation.ClassregProblem class. The software defines the Problem property when you create a FunctionApproximation.TransformFunction object.


  • If you use a nondefault score transformation function such as doublelogit, logit, or symmetriclogit for the trained classifier, you can use FunctionApproximation.TransformFunction and approximate to update the fixed-point data type structure to include a lookup table that approximates the score transformation function.

Version History

Introduced in R2023a