训练多输出数据时报错“数据类型无效。响应必须为双精度或单精度向量。”
train_x_n为36×2double,train_y_n为36×9double,但model=TreeBagger(tree(i,j), train_x_n, train_y_n, ……一行报错“数据类型无效。响应必须为双精度或单精度向量。”(Invalid data type. Response must be a double or single vector.)
当把train_y_n改成36×1时便不报错,请问如何使它能训练多输出数据?
train_x_n=ones(36,2);
train_y_n=ones(36,9);
[tree,leaf] = meshgrid(80:10:200,1:1:10);
bestRMSE_RF = 1;
% 网格搜索
for i=1:size(leaf,1)
for j=1:size(tree,2)
model=TreeBagger(tree(i,j), train_x_n, train_y_n, OOBPredictorImportance=’on’,Method=’regression’, OOBPrediction=’on’,MinLeafSize=leaf(i,j));
[~,~,RMSE,~]=Test(model,train_x_n,train_y,PSo);
if RMSE<bestRMSE_RF
bestRMSE_RF=RMSE;
besttree=tree(i,j);
bestleaf=leaf(i,j);
model_RF=model;
end
end
endtrain_x_n为36×2double,train_y_n为36×9double,但model=TreeBagger(tree(i,j), train_x_n, train_y_n, ……一行报错“数据类型无效。响应必须为双精度或单精度向量。”(Invalid data type. Response must be a double or single vector.)
当把train_y_n改成36×1时便不报错,请问如何使它能训练多输出数据?
train_x_n=ones(36,2);
train_y_n=ones(36,9);
[tree,leaf] = meshgrid(80:10:200,1:1:10);
bestRMSE_RF = 1;
% 网格搜索
for i=1:size(leaf,1)
for j=1:size(tree,2)
model=TreeBagger(tree(i,j), train_x_n, train_y_n, OOBPredictorImportance=’on’,Method=’regression’, OOBPrediction=’on’,MinLeafSize=leaf(i,j));
[~,~,RMSE,~]=Test(model,train_x_n,train_y,PSo);
if RMSE<bestRMSE_RF
bestRMSE_RF=RMSE;
besttree=tree(i,j);
bestleaf=leaf(i,j);
model_RF=model;
end
end
end train_x_n为36×2double,train_y_n为36×9double,但model=TreeBagger(tree(i,j), train_x_n, train_y_n, ……一行报错“数据类型无效。响应必须为双精度或单精度向量。”(Invalid data type. Response must be a double or single vector.)
当把train_y_n改成36×1时便不报错,请问如何使它能训练多输出数据?
train_x_n=ones(36,2);
train_y_n=ones(36,9);
[tree,leaf] = meshgrid(80:10:200,1:1:10);
bestRMSE_RF = 1;
% 网格搜索
for i=1:size(leaf,1)
for j=1:size(tree,2)
model=TreeBagger(tree(i,j), train_x_n, train_y_n, OOBPredictorImportance=’on’,Method=’regression’, OOBPrediction=’on’,MinLeafSize=leaf(i,j));
[~,~,RMSE,~]=Test(model,train_x_n,train_y,PSo);
if RMSE<bestRMSE_RF
bestRMSE_RF=RMSE;
besttree=tree(i,j);
bestleaf=leaf(i,j);
model_RF=model;
end
end
end machine learning, 机器学习, 多输出, multi-output MATLAB Answers — New Questions