RegressionTree cannot use "predict" method?

4 ビュー (過去 30 日間)
Young
Young 2014 年 3 月 30 日
コメント済み: reem aldaihani 2018 年 2 月 17 日
Hello there,
I'm using Matlab R2013a and was able to train a regression tree using RegressionTree.fit(). However, when I used "predict(rtree, test_data)," I got the following error message:
Error using predict (line 85) Systems of classreg.learning.partition.RegressionPartitionedModel class cannot be used with the "predict" command. Convert the system to an identified model first, such as by using the "idss" command.
I believe using "predict" method confused a dynamic model estimation. Can you please tell me what was wrong?
Young

回答 (2 件)

Young
Young 2014 年 6 月 9 日
編集済み: Walter Roberson 2016 年 4 月 12 日
As long as you're not using 'crossval' option, like
rtree = RegressionTree( x, y, 'crossval', 'on' );
The following should work:
[yfit, node] = predict( rtree, test_data );
So, just train a regression tree using "rtree = RegressionTree( train_data, train_label ); and then use it like, [yfit, node] = predict( rtree, test_data )
Young
  1 件のコメント
reem aldaihani
reem aldaihani 2018 年 2 月 17 日
What if we will use cross-validation? This is part of my code: cvmodel=fitcknn(training_Best,class1, 'Distance',@mindistnew, 'NumNeighbors',1, 'KFold',10); cvclass=predict(cvmodel, testing_Best);
and I received this error:
Systems of classreg.learning.partition.ClassificationPartitionedModel class cannot be used with the "predict" command. Convert the system to an identified model first, such as by using the "idss" command.
Could you please help me to fix this ASAP.

サインインしてコメントする。


Sincloe Brans
Sincloe Brans 2014 年 6 月 9 日
編集済み: Walter Roberson 2016 年 4 月 11 日
Just do
Yfit = tree([Xnew]);
where tree is your regression or classreg tree and Xnew the new X's to be predicted.

カテゴリ

Help Center および File ExchangeGaussian Process Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by