RegressionTree Predict - Predict responses using regression tree model - Simulink (original) (raw)

Predict responses using regression tree model

Since R2021a

Libraries:
Statistics and Machine Learning Toolbox / Regression

Description

The RegressionTree Predict block predicts responses using a regression tree object (RegressionTree or CompactRegressionTree).

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.

Examples

Ports

Input

expand all

Predictor data, specified as a row or column vector of one observation.

The variables in x must have the same order as the predictor variables that trained the model specified by Select trained machine learning model.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point

Output

expand all

Predicted response, returned as a scalar.

Data Types: single | double | half | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point

Parameters

expand all

Main

Specify the name of a workspace variable that contains a RegressionTree object orCompactRegressionTree object.

When you train the model by using fitrtree, the following restrictions apply:

Programmatic Use

Block Parameter: TrainedLearner
Type: workspace variable
Values: RegressionTree object |CompactRegressionTree object
Default: 'treeMdl'

Data Types

Fixed-Point Operational Parameters

Specify the rounding mode for fixed-point operations. For more information, see Rounding Modes (Fixed-Point Designer).

Block parameters always round to the nearest representable value. To control the rounding of a block parameter, enter an expression into the mask field using a MATLAB® rounding function.

Programmatic Use

Block Parameter: RndMeth
Type: character vector
Values: "Ceiling" | "Convergent" "Floor" "Nearest" "Round" "Simplest" "Zero"
Default: "Floor"

Specify whether overflows saturate or wrap.

Action Rationale Impact on Overflows Example
Select this check box (on). Your model has possible overflow, and you want explicit saturation protection in the generated code. Overflows saturate to either the minimum or maximum value that the data type can represent. The maximum value that the int8 (signed 8-bit integer) data type can represent is 127. Any block operation result greater than this maximum value causes overflow of the 8-bit integer. With the check box selected, the block output saturates at 127. Similarly, the block output saturates at a minimum output value of –128.
Clear this check box (off). You want to optimize the efficiency of your generated code.You want to avoid overspecifying how a block handles out-of-range signals. For more information, see Troubleshoot Signal Range Errors (Simulink). Overflows wrap to the appropriate value that the data type can represent. The maximum value that the int8 (signed 8-bit integer) data type can represent is 127. Any block operation result greater than this maximum value causes overflow of the 8-bit integer. With the check box cleared, the software interprets the value causing the overflow asint8, which can produce an unintended result. For example, a block result of 130 (binary 1000 0010) expressed as int8 is –126.

Programmatic Use

Block Parameter: SaturateOnIntegerOverflow
Type: character vector
Values: "off" | "on"
Default: "off"

Select this parameter to prevent the fixed-point tools from overriding the data type you specify for the block. For more information, see Use Lock Output Data Type Setting (Fixed-Point Designer).

Programmatic Use

Block Parameter: LockScale
Type: character vector
Values: "off" | "on"
Default: "off"

Data Type

Specify the data type for the yfit 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: OutDataTypeStr
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 yfit output range that Simulink® checks.

Simulink uses the minimum value to perform:

Note

The Output data type Minimum parameter does not saturate or clip the actual yfit signal. To do so, use the Saturation (Simulink) block instead.

Programmatic Use

Block Parameter:OutMin
Type: character vector
Values: '[]' | scalar
Default: '[]'

Specify the upper value of the yfit output range that Simulink checks.

Simulink uses the maximum value to perform:

Note

The Output data type Maximum parameter does not saturate or clip the actual yfit signal. To do so, use the Saturation (Simulink) block instead.

Programmatic Use

Block Parameter:OutMax
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

expand all

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 regression tree object (RegressionTree or CompactRegressionTree). For an example, seePredict Class Labels Using MATLAB Function Block.

When deciding whether to use the RegressionTree Predict block in the Statistics and Machine Learning Toolbox™ library or a MATLAB Function block with the predict function, consider the following:

Extended Capabilities

expand all

C/C++ Code Generation

Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion

Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced in R2021a

See Also

Blocks

Objects

Functions

Topics