bastilam
bastilam

Reputation: 13

How do I classify data in C++ using a trained classifier from Matlab?

I guess there are two possible ways:

  1. Export the trained classifier to C++ in a way, such that a machine learning package in C++ is able to make predictions based on the trained classifier
  2. Make predictions based on the parameters in the trained classifier using my own algorithm.

Unfortunately, I am not familiar enough with any of the algorithms used by the classification learner in Matlab to write my own algorithm without a little help.

So if there is no possibility for option 1. it would be great if you could help me with 2. Maybe someone has done this before? Any of the learning algorithms from the Matlab toolbox would be fine.

Upvotes: 0

Views: 1062

Answers (1)

Ash
Ash

Reputation: 3550

If your classifier is linear as in logistic regression / SVM, you can just export the trained parameters which is a matrix of size n_features x n_labels and import it in C++. Given a new input you can extract the features and multiply the vector and this matrix.

If not, you can call MATLAB from C++.

Upvotes: 1

Related Questions