Unable to run the predict function

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 Comments

Hi,
I tried the following but I am still getting 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. I dont know what is meant by predictorNames. I have attached the results of training.
Zulfi.
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.
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.

Sign in to comment.

Answers (0)

Categories

Asked:

on 1 Dec 2018

Commented:

on 1 Dec 2018

Community Treasure Hunt

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

Start Hunting!