RegressionGP Predict - Predict responses using Gaussian process (GP) regression model - Simulink (original) (raw)
Predict responses using Gaussian process (GP) regression model
Since R2022a
Libraries:
Statistics and Machine Learning Toolbox / Regression
Description
The RegressionGP Predict block predicts responses using a Gaussian process (GP) regression object (RegressionGP or CompactRegressionGP).
Import a trained regression object into the block by specifying the name of a workspace variable that contains the object. The input port x receives an observation (predictor data), and the output port yfit returns a predicted response for the observation. The optional outputs ysd andyint return the standard deviation and prediction intervals of the response, respectively.
Examples
Ports
Input
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Output
Predicted response, returned as a scalar.
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Standard deviation of the predicted response from the predictor data, returned as a scalar.
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Prediction intervals of the predicted response, returned as a 1-by-2 vector.yint contains the 100(1 – Alpha)%
prediction interval of the predicted response yfit for the predictor datax. The Alpha
value is the probability that the prediction interval does not contain the true response value forx. The first column of yint contains the lower limits of the prediction intervals, and the second column contains the upper limits.
Data Types: single
| double
| half
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
Parameters
Main
Select the check box to include the optional output port ysd in the RegressionGP Predict block.
Programmatic Use
Block Parameter: ShowOutputSD |
---|
Type: character vector |
Values: 'off' | 'on' |
Default: 'off' |
Select the check box to include the optional output port yint in the RegressionGP Predict block.
Programmatic Use
Block Parameter: ShowOutputIntervals |
---|
Type: character vector |
Values: 'off' | 'on' |
Default: 'off' |
Specify the significance level for the confidence level of the prediction intervals yint. The confidence level of yint is equal to 100(1 – Alpha)%
. For example, specifyAlpha as 0.01 to return 99% prediction intervals.
Programmatic Use
Block Parameter:Alpha |
---|
Type: character vector |
Values: scalar in [0 1] |
Default: 0.05 |
Data Types
Fixed-Point Operational Parameters
Data Type
Specify the data type of the ysd output. The type can be inherited, specified directly, or expressed as a data type object such asSimulink.NumericType
.
When you select Inherit: auto
, the block uses a rule that inherits a data type.
For more information about data types, see Control Data Types of Signals (Simulink).
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant (Simulink).
Programmatic Use
Block Parameter:SDDataTypeStr | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type: character vector | ||||||||||||||
Values: 'Inherit: auto' | 'double' | 'single' | 'half' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | '' |
Default: 'Inherit: auto' |
Specify the lower value of the ysd output range that Simulink checks.
Simulink uses the minimum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as software-in-the-loop (SIL) mode or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Output standard deviation data type Minimum parameter does not saturate or clip the actual ysd signal. To do so, use the Saturation (Simulink) block instead.
Programmatic Use
Block Parameter:SDOutMin |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the upper value of the ysd output range that Simulink checks.
Simulink uses the maximum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Output standard deviation data type Maximum parameter does not saturate or clip the actual ysd signal. To do so, use the Saturation (Simulink) block instead.
Programmatic Use
Block Parameter:SDOutMax |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the data type of the yint output. The type can be inherited, specified directly, or expressed as a data type object such asSimulink.NumericType
.
When you select Inherit: auto
, the block uses a rule that inherits a data type.
For more information about data types, see Control Data Types of Signals (Simulink).
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant (Simulink).
Programmatic Use
Block Parameter:IntervalsDataTypeStr | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type: character vector | ||||||||||||||
Values: 'Inherit: auto' | 'double' | 'single' | 'half' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | '' |
Default: 'Inherit: auto' |
Specify the lower value of the yint output range that Simulink checks.
Simulink uses the minimum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as software-in-the-loop (SIL) mode or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Output prediction intervals data type Minimum parameter does not saturate or clip the actual yint signal. To do so, use the Saturation (Simulink) block instead.
Programmatic Use
Block Parameter:IntervalsOutMin |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the upper value of the yint output range that Simulink checks.
Simulink uses the maximum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Output prediction intervals data type Maximum parameter does not saturate or clip the actual yint signal. To do so, use the Saturation (Simulink) block instead.
Programmatic Use
Block Parameter:IntervalsOutMax |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the data type of the kernel function. The type can be inherited, specified directly, or expressed as a data type object such asSimulink.NumericType
.
When you select Inherit: auto
, the block uses a rule that inherits a data type.
For more information about data types, see Control Data Types of Signals (Simulink).
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant (Simulink).
Tips
The Kernel data type parameter specifies the data type of the kernel function in the RegressionGP
model. When you use thefitrgp function to train the model, you can set the KernelFunction name-value argument to one of the values in this table.
KernelFunction Value | Kernel Function Description |
---|---|
"exponential" | Exponential kernel |
"squaredexponential" | Squared exponential kernel |
"matern32" | Matern kernel with parameter 3/2 |
"matern52" | Matern kernel with parameter 5/2 |
"rationalquadratic" | Rational quadratic kernel |
"ardexponential" | Exponential kernel with a separate length scale per predictor |
"ardsquaredexponential" | Squared exponential kernel with a separate length scale per predictor |
"ardmatern32" | Matern kernel with parameter 3/2 and a separate length scale per predictor |
"ardmatern52" | Matern kernel with parameter 5/2 and a separate length scale per predictor |
"ardrationalquadratic" | Rational quadratic kernel with a separate length scale per predictor |
Programmatic Use
Block Parameter:KernelDataTypeStr | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type: character vector | ||||||||||||||
Values: 'Inherit: auto' | 'double' | 'single' | 'half' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | '' |
Default: 'Inherit: auto' |
Specify the lower value of the kernel function's internal variable range checked by Simulink.
Simulink uses the minimum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as software-in-the-loop (SIL) mode or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Kernel data type Minimum parameter does not saturate or clip the actual kernel function signal.
Programmatic Use
Block Parameter:KernelOutMin |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the upper value of the kernel output's internal variable range checked by Simulink.
Simulink uses the maximum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Kernel data type Maximum parameter does not saturate or clip the actual kernel function signal.
Programmatic Use
Block Parameter:KernelOutMax |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the data type of the method for computing kernel distance. The type can be inherited, specified directly, or expressed as a data type object such asSimulink.NumericType
.
When you select Inherit: Inherit via internal rule
, the block uses an internal rule to determine the output data type. The internal rule chooses a data type that optimizes numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. The software cannot always optimize efficiency and numerical accuracy at the same time.
For more information about data types, see Control Data Types of Signals (Simulink).
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant (Simulink).
Tips
The Distance data type parameter specifies the data type of the method for computing inter-point distances to evaluate built-in kernel functions. For more information, see the DistanceMethod name-value argument of the fitrgp function. The block always uses the value"accurate"
for DistanceMethod
, which does not compromise the calculation speed compared to the value"fast"
.
Programmatic Use
Block Parameter:DistanceDataTypeStr | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type: character vector | ||||||||||||||
Values: 'Inherit: Inherit via internal rule' | 'double' | 'single' | 'half' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | '' |
Default: 'Inherit: Inherit via internal rule' |
Specify the lower value of the kernel distance's internal variable range checked by Simulink.
Simulink uses the minimum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as software-in-the-loop (SIL) mode or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Distance data type Minimum parameter does not saturate or clip the actual kernel distance signal.
Programmatic Use
Block Parameter:DistanceOutMin |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the upper value of the kernel distance's internal variable range checked by Simulink.
Simulink uses the maximum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Distance data type Maximum parameter does not saturate or clip the actual kernel distance signal.
Programmatic Use
Block Parameter:DistanceOutMax |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the data type of the basis function. The type can be inherited, specified directly, or expressed as a data type object such asSimulink.NumericType
.
When you select Inherit: auto
, the block uses a rule that inherits a data type.
For more information about data types, see Control Data Types of Signals (Simulink).
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant (Simulink).
Tips
The Basis data type parameter specifies the data type of the explicit basis in the RegressionGP
model. You can set theBasisFunction name-value argument when you use the fitrgp function to train the model.
Programmatic Use
Block Parameter:BasisDataTypeStr | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Type: character vector | ||||||||||||||
Values: 'Inherit: auto' | 'double' | 'single' | 'half' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | '' |
Default: 'Inherit: auto' |
Specify the lower value of the basis function's internal variable range checked by Simulink.
Simulink uses the minimum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as software-in-the-loop (SIL) mode or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Basis data type Minimum parameter does not saturate or clip the actual basis function signal.
Programmatic Use
Block Parameter:BasisOutMin |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Specify the upper value of the basis function's internal variable range checked by Simulink.
Simulink uses the maximum value to perform:
- Parameter range checking for some blocks (see Specify Minimum and Maximum Values for Block Parameters (Simulink)).
- Simulation range checking (see Specify Signal Ranges (Simulink) and Enable Simulation Range Checking (Simulink)).
- Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes, such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values (Embedded Coder).
Note
The Basis data type Maximum parameter does not saturate or clip the actual basis function signal.
Programmatic Use
Block Parameter:BasisOutMax |
---|
Type: character vector |
Values: '[]' | scalar |
Default: '[]' |
Block Characteristics
Data Types | Boolean | double | fixed point | half | integer | single |
---|---|---|---|---|---|
Direct Feedthrough | yes | ||||
Multidimensional Signals | no | ||||
Variable-Size Signals | no | ||||
Zero-Crossing Detection | no |
More About
The data types of internal model parameters are synchronized to the data type of the output port, yfit
.
Alternative Functionality
You can use a MATLAB Function block with the predict object function of a Gaussian process regression object (RegressionGP or CompactRegressionGP). For an example, see Predict Class Labels Using MATLAB Function Block.
When deciding whether to use the RegressionGP Predict block in the Statistics and Machine Learning Toolbox™ library or a MATLAB Function block with the predict
function, consider the following:
- If you use the Statistics and Machine Learning Toolbox library block, you can use the Fixed-Point Tool (Fixed-Point Designer) to convert a floating-point model to fixed point.
- Support for variable-size arrays must be enabled for a MATLAB Function block with the
predict
function. - If you use a MATLAB Function block, you can use MATLAB functions for preprocessing or post-processing before or after predictions in the same MATLAB Function block.
Extended Capabilities
Version History
Introduced in R2022a
See Also
Blocks
- RegressionSVM Predict | RegressionTree Predict | RegressionEnsemble Predict | RegressionNeuralNetwork Predict