how to test the data after trained in classification learner

2 visualizaciones (últimos 30 días)
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 comentario
shamsah alotibe
shamsah alotibe el 14 de Mayo de 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
mlearnapp.internal.model.DatasetSpecification>@(x)extractPredictorsFromTableFcn(splitMatricesInTableFcn(x))
(line 164)
predictorExtractionFcn = @(x)
extractPredictorsFromTableFcn(splitMatricesInTableFcn(x));
Error in
mlearnapp.internal.model.DatasetSpecification>@(x)exportableModel.predictFcn(predictorExtractionFcn(x))
(line 167)
newExportableModel.predictFcn = @(x)
exportableModel.predictFcn(predictorExtractionFcn(x));

Iniciar sesión para comentar.

Respuesta aceptada

Shivam Sardana
Shivam Sardana el 22 de Mayo de 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: https://www.mathworks.com/matlabcentral/answers/264459-failed-to-call-classification-learner-s-testing-function
  5 comentarios
anita jasmine
anita jasmine el 28 de Oct. de 2020
To test the model,MD Predictedlabels=predict(MD,testfeaturesmatrix) Accuracy=mean (Predictedlabels==testlabels)
Hussein Hasan Mohsen
Hussein Hasan Mohsen el 5 de Dic. de 2020
It's not working Can you provide us with any link

Iniciar sesión para comentar.

Más respuestas (2)

Fatma HM
Fatma HM el 18 de Dic. de 2020
Hi @Shivam Sardana I need to estimate the test data I have trained, with (ANN,NARX and Ridge regression). Do you have any idea?

Arnab Banerjee
Arnab Banerjee el 14 de En. de 2021
Editada: Arnab Banerjee el 11 de Mzo. de 2021
@shamsah alotibe kindly check one weather your TestData heading are same as TrainingData or not.. if same then hopefully you will not get this error message, because i have just now resolved this issue, by keeping the coloum name same.

Community Treasure Hunt

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

Start Hunting!

Translated by