MATLAB Answers

how to test the data after trained in classification learner

118 views (last 30 days)
i have data in xlsx. file with 35 raws and 6 columns.. i already trained the data in classification learner and export the model to work space but i do not know how to test it with new data
any one can guiding me please ?

  1 Comment

shamsah alotibe
shamsah alotibe on 14 May 2019
i wrot this command in command window :
yfit = C.predictFcn(T)
where T a new data and C the model name but there are some errors that said :
Unable to use a value of type 'cell' as an index.
Error in mlearnapp.internal.model.DatasetSpecification>@(t)t(:,predictorNames) (line 163)
extractPredictorsFromTableFcn = @(t) t(:,predictorNames);
Error in
(line 164)
predictorExtractionFcn = @(x)
Error in
(line 167)
newExportableModel.predictFcn = @(x)

Sign in to comment.

Accepted Answer

Shivam Sardana
Shivam Sardana on 22 May 2019
The error message in your comment indicates that something is trying to be indexed using a cell array as a subscript, which is a valid indexing method for tables but not an indexing method for a double array.
I may not know about your test dataset. There is a similar question which may be of relevance to you:


shamsah alotibe
shamsah alotibe on 28 May 2019
Thanks Shivam, it is work.
but how i can get the accuracy percentage ?
the output of this function is a matrix of the result of each columns.
Shivam Sardana
Shivam Sardana on 4 Jun 2019
You have got the predicted values. For test dataset, you have actual values(ground truth). You can calculate RMSE to get acuracy.
shamsah alotibe
shamsah alotibe on 8 Jun 2019
sorry, I did not understand, I am new in matlab
can you clarify or post some useful linkes please ?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by