Unable to run the predict function

2 次查看(过去 30 天)
Hi,
I have created a Model by training. Now I want to use the model for predicting. Property sheet shows me three menus: ModelName, ModelName.predictFcn and ModelName.HowtoPredict. ModelName.HowtoPredict showed me a line of text like:
yfit = C.predictFcn(T)
and some more text. I replaced the line to the following:
yfit = ModelName.predic(testdata);
but I am getting following errors:
run(GTM3_Acc62p8.HowToPredict);
Error using run (line 66)
yfit = GTM3_Acc62p8.predictFcn(testdata); not found.
Somebody please gide me.
Zulfi.
  3 个评论
Walter Roberson
Walter Roberson 2018-12-1
GTM3_Acc62p8 appears to be a struct and GTM3_Acc62p8.HowToPredict appears to contain a character vector that appears to be in the form of a function call with an assignment to yfit. And you appear to be attempting to run(GTM3_Acc62p8.HowToPredict) and so appear to be attempting to run() a character vector that is a MATLAB statement.
run() is not used to execute MATLAB statements that are in character vectors or character arrays. run() must be provided with a file name (possibly qualified) and it causes the content of the file to be evaluated.
If you have a character vector that you want to execute, the MATLAB function is eval().
However, most of the time you should avoid eval() and instead create functions, possibly together with function handles.
Zulfiqar Khan
Zulfiqar Khan 2018-12-1
Hi,
I am doing it first time. I got this command when I export the model. I got information from the following link:
I have done the training using Matlab. Now I want to do prediction using Matlab. But for prediction I have a different file. I have loaded columns of file in two files: colsofData.jpg and colsofData_contd.jpg.
I also checked the link:
Please guide me how to fix the following error:
yfit = predict(GTM3_Acc62p8, testdata{:,GTM3_Acc62p8.PredictorNames})
Reference to non-existent field 'PredictorNames'.
>> yfit = predict(GTM3_Acc62p8, testdata{:,GTM3_Acc62p8.smile});
Reference to non-existent field 'smile'.
Some body please guide me.
Zulfi.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by