Unable to run the predict function

2 visualizaciones (últimos 30 días)
Zulfiqar Khan
Zulfiqar Khan el 1 de Dic. de 2018
Comentada: Zulfiqar Khan el 1 de Dic. de 2018
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 comentarios
Walter Roberson
Walter Roberson el 1 de Dic. de 2018
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 el 1 de Dic. de 2018
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Get Started with Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by