Matlab: How can I store the output of "fitcecoc" in a database

1.4k views Asked by At

In Matlab help section, there's a very helpful example to solve classification problems under "Digit Classification Using HOG Features". You can easily execute the full script by clikcing on 'Open this example'. However, I'm wondering if there's a way to store the output of "fitcecoc" in a database so you don't have to keep training and classifying each and everytime you run the code. Here is the section of the code that's relevant to my question:

% fitcecoc uses SVM learners and a 'One-vs-One' encoding scheme.
classifier = fitcecoc(trainingFeatures, trainingLabels);

So, all I want to do is store 'classifier' in a database and retrieve it for the following code:

predictedLabels = predict(classifier, testFeatures);
1

There are 1 answers

0
Viliam Rapčan On BEST ANSWER

Look at Database Toolbox in Matlab.

You could just save the classifier variable in a file:

save('classifier.mat','classifier')

And then load it before executing predict:

load('classifier.mat')
predictedLabels = predict(classifier, testFeatures);