how to test the data after trained in classification learner

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 件のコメント

shamsah alotibe
shamsah alotibe 2019 年 5 月 14 日
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));

サインインしてコメントする。

 採用された回答

Shivam Sardana
Shivam Sardana 2019 年 5 月 22 日

0 投票

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 件のコメント

shamsah alotibe
shamsah alotibe 2019 年 5 月 28 日
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 2019 年 6 月 4 日
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 2019 年 6 月 8 日
sorry, I did not understand, I am new in matlab
can you clarify or post some useful linkes please ?
anita jasmine
anita jasmine 2020 年 10 月 28 日
To test the model,MD Predictedlabels=predict(MD,testfeaturesmatrix) Accuracy=mean (Predictedlabels==testlabels)
Hussein Hasan Mohsen
Hussein Hasan Mohsen 2020 年 12 月 5 日
It's not working Can you provide us with any link

サインインしてコメントする。

その他の回答 (2 件)

Fatma HM
Fatma HM 2020 年 12 月 18 日

0 投票

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 2021 年 1 月 14 日
編集済み: Arnab Banerjee 2021 年 3 月 11 日

0 投票

@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