How do you test a classification model in real time with certain set of variables?

7 views (last 30 days)
So I've created a classification model that uses about 70 features. I have exported my model to the workspace and have also saved it as a file. I've also exported the code to train new data. I have a radar and I want to use the classification model to predict the outcome of the data. Would I have to structure the incoming data to match the original test data that I used in the classification learner; and if so, how would I do this? I've been stuck on it awhile and tried to assign the variables to incoming data, but it created a table for me instead of predicting the incoming data in real time. Thanks in advance for all your help!

Answers (1)

Bernhard Suhm
Bernhard Suhm on 9 Apr 2018
Yes, you have to process the incoming data so its columns are named the same (and in the same order) as how you structured the dataset you read into the Classification Learner. Of course you don't have the response (last column). Then you can use the predict method with that new data table and the model object you exported from the classification learner. This runs in batch mode. - To do this in real time, you'd have to program a server of some kind that either runs your prediction code in its compiled form, or (fancier) you convert the prediction into C-code using MATLAB coder and run that on your system in realtime.
  2 Comments
Lynn Marciano
Lynn Marciano on 9 Apr 2018
Could I use bagOfFeatures function to extract the features to run through the classification learner?
Daniel Leal
Daniel Leal on 1 Mar 2020
Hey Lynn, did you ever find a solution to this? I am currently in the same predicament. Thanks!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!