主要内容

预测

使用支持向量机回归模型预测响应金宝app

描述

example

yfit=预测(MDL,X)returns a vector of predicted responses for the predictor data in the table or matrixX,基于完整或紧凑的训练有素的支持向量机(SVM)回归模型金宝appMDL

输入参数

展开全部

SVM回归模型, specified as a回归vmmodel or aCompacTregressionsVM模型,由FITRSVM或者袖珍的, respectively.

用于生成响应的预测数据, specified as a numeric matrix or table.

每一行X对应于一个观测值,每列对应于一个变量。

  • For a numeric matrix:

    • The variables making up the columns ofX必须具有与训练的预测变量相同的顺序MDL

    • 如果您训练有素MDLusing a table (for example,TBL), 然后Xcan be a numeric matrix ifTBL包含所有数字预测变量。处理数字预测指标TBL作为培训期间的分类,请使用分类预期名称值对参数FITRSVM。如果TBLcontains heterogeneous predictor variables (for example, numeric and categorical data types) andXis a numeric matrix, then预测throws an error.

  • 对于表格:

    • 预测除了字符矢量的单元金宝app格数组以外,不支持多柱变量或单元阵列。

    • 如果您训练有素MDLusing a table (for example,TBL),然后所有预测变量Xmust have the same variable names and data types as those that trainedMDL(存储在mdl.predictictornames)。但是,Xdoes not need to correspond to the column order ofTBLTBLX可以包含其他变量(响应变量,观察权重等),但是预测ignores them.

    • 如果您训练有素MDL使用数字矩阵,然后在mdl.predictictornames和corresponding predictor variable names inXmust be the same. To specify predictor names during training, see the预测器名称值对参数FITRSVM。所有预测变量X必须是数字向量。X可以包含其他变量(响应变量,观察权重等),但是预测ignores them.

如果您设置“标准化”,trueFITRSVM训练MDL,然后软件标准化了X使用相应的均值mdl.mu和标准偏差MDL。Sigma

Data Types:桌子|双倍的|single

Output Arguments

展开全部

Predicted responses, returned as a vector of lengthn, 在哪里n是培训数据中的观察数。

有关如何预测响应的详细信息,请参阅等式1等式2了解支持向量机回归金宝app

例子

展开全部

加载汽车舞data set. Consider a model that predicts a car's fuel efficiency given its horsepower and weight. Determine the sample size.

load汽车舞tbl = table(Horsepower,Weight,MPG); N = size(tbl,1);

将数据划分为培训和测试集。保留10%的数据进行测试。

RNG(10);%可再现性cvp = cvpartition(N,'Holdout',0.1); idxTrn = training(cvp);% Training set indicesidxTest = test(cvp);% Test set indices

Train a linear SVM regression model. Standardize the data.

Mdl = fitrsvm(资源描述(idxTrn:),'MPG',“标准化”,true);

MDLis a回归vmmodel.

Predict responses for the test set.

yfit = predition(mdl,tbl(idxtest,:));

Create a table containing the observed response values and the predicted response values side by side.

表(tbl.mpg(idxtest),yfit,'VariableNames',。。。{'ObservedValue',“预测值”})
ans =10×2桌ObservedValue PredictedValue _____________ ______________ 14 9.4833 27 28.938 10 7.765 28 27.155 22 21.054 29 31.484 24.5 30.306 18.5 19.12 32 28.225 28 26.632

尖端

替代功能

金宝appSimulink块

To integrate the prediction of an SVM regression model into Simulink®,您可以使用RecressionsVM预测统计和机器学习工具箱™库或MATLAB中的块®功能块与预测功能。有关示例,请参见使用RecressionsVM预测响应预测块使用MATLAB功能块预测类标签

在确定使用哪种方法时,请考虑以下内容:

  • 如果使用统计信息和机器学习工具箱库块,则可以使用Fixed-Point Tool(定点设计师)to convert a floating-point model to fixed point.

  • 金宝app必须为MATLAB功能块启用对可变大小数组的支持预测功能。

  • 如果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

在R2015B中引入