Main Content

回归树预测

使用回归树模型预测响应

  • 图书馆:
  • Statistics and Machine Learning Toolbox / Regression

Description

回归树预测block predicts responses using a regression tree object (RegressionTree或者CompactregressionTree)。

Import a trained regression object into the block by specifying the name of a workspace variable that contains the object. The input portXreceives an observation (predictor data), and the output port是的returns a predicted response for the observation.

Ports

Input

expand all

预测数据,指定为一个观察值的行或列向量。

Dependencies

变量中Xmust have the same order as the predictor variables that trained the model specified bySelect trained machine learning model

Data Types:single|double|一半|int8|int16|int32|int64|uint8|uint16|uint32|uint64|Boolean|固定点

输出

expand all

预测响应,返回为标量。

Data Types:single|double|一半|int8|int16|int32|int64|uint8|uint16|uint32|uint64|Boolean|固定点

参数

expand all

Main

指定包含一个工作空间变量的名称RegressionTree对象或CompactregressionTree目的。

当您使用训练模型时fitrtree,,,,the following restrictions apply:

  • 预测变量数据不能包括分类预测因子(逻辑,,,,categorical,,,,char,,,,string,,,,或者细胞)。如果您在表中提供培训数据,则预测变量必须是数字(double或者single)。Also, you cannot use theCategoricalPredictorsname-value argument. To include categorical predictors in a model, preprocess the categorical predictors by usingDummyvar拟合模型之前。

  • 价值“ ResponseTransForm”名称值参数必须为'没有任何'(default).

  • You cannot use surrogate splits, that is, the value of the'Surrogate'名称值参数必须为'off'(default).

程序化使用

块参数:训练有素
类型:工作区变量
值:RegressionTree目的|CompactregressionTree目的
默认:'treeMdl'

Data Types

定点操作参数

指定定点作战的舍入模式ns. For more information, see四舍五入(Fixed-Point Designer)

块参数始终为最近的代表值。要控制块参数的圆形,请使用MATLAB输入表达式®舍入功能。

程序化使用

块参数:rndmeth
类型:character vector
值:“天花板” |“收敛” |“地板” |'最近'|“圆” |“最简单” |'零'
默认:'地面'

指定溢出饱和还是包裹。

Action 理由 Impact on Overflows 例子

选择此复选框()。

您的模型可能会溢出,并且您需要在生成的代码中明确的饱和保护保护。

溢出到数据类型可以代表的最小值或最大值。

这maximum value that theint8(已签名的8位整数)数据类型可以表示为127。任何块操作结果大于此最大值,导致8位整数的溢出。With the check box selected, the block output saturates at 127. Similarly, the block output saturates at a minimum output value of –128.

清除此复选框(离开)。

您想优化生成的代码的效率。

You want to avoid overspecifying how a block handles out-of-range signals. For more information, see故障排除信号范围错误(金宝appSimulink)

Overflows wrap to the appropriate value that the data type can represent.

这maximum value that theint8(已签名的8位整数)数据类型可以表示为127。任何块操作结果大于此最大值,导致8位整数的溢出。通过清除复选框,该软件解释了导致溢出的值int8,,,,which can produce an unintended result. For example, a block result of 130 (binary 1000 0010) expressed asint8是–126。

程序化使用

块参数:SaturateOnIntegerOverflow
类型:character vector
值:'off' | 'on'
默认:'off'

Select this parameter to prevent the fixed-point tools from overriding the data type you specify for the block. For more information, see使用锁定输出数据类型设置(Fixed-Point Designer)

程序化使用

块参数:锁定
类型:character vector
值:'off' | 'on'
默认:'off'
Data Type

Specify the data type of the是的输出。可以继承,直接指定或表示为数据类型对象,例如Simulink.NumericType

当您选择时继承:自动,该块使用继承数据类型的规则。

For more information about data types, see控制数据类型的信号(金宝appSimulink)

Click theShow data type assistantbuttonto display theData Type Assistant,这可以帮助您设置数据类型属性。有关更多信息,请参阅Specify Data Types Using Data Type Assistant(金宝appSimulink)

程序化使用

Block ParameterOutDataTypeStr
Type:character vector
“继承:自动”|'双倍的'|'single'|'half'|'int8'|'uint8'|'int16'|'uint16'|'int32'|'uint32'|'int64'|'uint64'|'boolean'|'fixdt(1,16)'|'fixdt(1,16,0)'|'fixdt(1,16,2^0,0)'|'<数据类型表达>'
默认“继承:自动”

Specify the lower value of the是的输出范围Simulink金宝app®检查。

金宝appSimulink使用最小值来执行:

笔记

输出minimumparameter does not saturate or clip the actual是的信号。使用Saturation(金宝appSimulink)block instead.

程序化使用

Block ParameterOutmin
Type:character vector
'[]'|scalar
默认'[]'

指定的上值是的输出范围Simulink金宝app检查。

金宝appSimulink使用最大值来执行:

笔记

输出maximumparameter does not saturate or clip the actual是的信号。使用Saturation(金宝appSimulink)block instead.

程序化使用

Block ParameterOutMax
Type:character vector
'[]'|scalar
默认'[]'

Block Characteristics

Data Types

Boolean|double|固定点|一半|整数|single

直接进料

yes

Multidimensional Signals

Variable-Size Signals

零交叉检测

替代功能

You can use a MATLAB Function block with the预测目的function of a regression tree object (RegressionTree或者CompactregressionTree)。例如,请参阅Predict Class Labels Using MATLAB Function Block

When deciding whether to use the回归树预测统计信息和机器学习工具箱™库或MATLAB功能块中的块预测function, consider the following:

  • If you use the Statistics and Machine Learning Toolbox library block, you can use the定点工具(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预测功能。

  • 如果使用MATLAB功能块,则可以在同一MATLAB功能块中使用MATLAB函数进行预处理或后处理。

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

定点转换
设计和模拟定点系统使用的固执d-Point Designer™.

版本历史记录

在R2021a中引入