how to predict test data from trained model
7 views (last 30 days)
Show older comments
i'm making a project in which i have to classify hand gestures. i have a feature file(made in excel). i have trained a model using classification learner app. now prediction is supposed to be done by getting a new image of hand gesture and calculating all those features in an array. now i want that array as testing data. i am unable to predict that testing data from already trained model.i have changed array to matrix as well as table but failed. please help me out.
2 Comments
Sammit Jain
on 10 Jul 2018
Hi, I think it'd help a lot if you could share some information about the dimensions of your dataset. Given that, the usual way to go about it would be to feed your features into the predict function in the same way as you put your training data.
Answers (1)
Rahul Madan Raju
on 9 Jan 2019
predictors = inputTable(:, predictorNames{:})
You can try this code at the place of 'predictors = inputTable(:, predictorNames)'
2 Comments
ferkous ahmed
on 17 Jan 2019
Try to make sure that all the data contains a comma instead of a dot
Thanks
Warid Islam
on 20 Jun 2020
Hi guys,
I am having a smimilar problem where I want to test the model on a test image. I used the following line of code.
signalTemp2 = trainedModel.predictFcn(statsArray1);
But I get the following error.
Unable to use a value of type 'cell' as an index.
Error in mlearnapp.internal.model.DatasetSpecification>@(t)t(:,predictorNames) (line 156)
extractPredictorsFromTableFcn = @(t) t(:,predictorNames);
Error in mlearnapp.internal.model.DatasetSpecification>@(x)extractPredictorsFromTableFcn(x) (line 161)
predictorExtractionFcn = @(x) extractPredictorsFromTableFcn(x);
Error in mlearnapp.internal.model.DatasetSpecification>@(x)exportableModel.predictFcn(predictorExtractionFcn(x)) (line 165)
newExportableModel.predictFcn = @(x) exportableModel.predictFcn(predictorExtractionFcn(x));
See Also
Categories
Find more on Classification Learner App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!