Problem with the TreeBagger Command

7 ビュー (過去 30 日間)
Jubeyer Rahman
Jubeyer Rahman 2019 年 10 月 23 日
回答済み: Greg Heath 2020 年 1 月 1 日
Hi,
I am using the TreeBagger command to produce the random forest regression model. My syntax is like the following:
Mdl=TreeBagger(1000,Training_Input,Training_Output,'Method','regression')
My Training_Input data is a matrix of 6768X400 and my Training_Output is a matrix of 6768X998
But while trying to execute I am getting the following error:
Error using classreg.learning.regr.FullRegressionModel.prepareData (line 245)
Invalid data type. Response must be a double or single vector.
Error in TreeBagger/init (line 1346)
classreg.learning.regr.FullRegressionModel.prepareData(...
Error in TreeBagger (line 616)
bagger = init(bagger,X,Y,makeArgs{:});
Error in Neural_network_OPF (line 71)
Mdl=TreeBagger(1000,Training_Input,double(Training_Output),'Method','regression');
I have checked the line inside the FullRegressionModel.m where the error is stemming from, it resulted from a check whether my response variable is vector or float.
I am really confused why this error is popping up. Can anyone help me fix it?
Regards,
Jubeyer

回答 (2 件)

Ridwan Alam
Ridwan Alam 2019 年 11 月 20 日
The Training_Output variable has to be a vector of size 6768X1 instead of a matrix.

Greg Heath
Greg Heath 2020 年 1 月 1 日
The sizes of the input function and output target must be
[ I N ] = size(input)
[ O N ] = size (target)
Hope this helps,
Greg

カテゴリ

Help Center および File ExchangeClassification Ensembles についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by