How to use a KNN classifier from Matlab in c++

6 次查看(过去 30 天)
Hi,
I have been tinkering with the machine learning toolbox in Matlab for a while. Now that I managed to get a good classifier, I would like to test it out of the lab. I was happy to see that Matlab has a built-in code generation tool, but it seems that KNN classifiers are not included.
How would I go about using the trained KNN from Matlab in a c++ program?
Would I have to write my own KNN implementation and use the parameters from the trained one in Matlab? If so, is there such an implementation already?

回答(1 个)

Bernhard Suhm
Bernhard Suhm 2018-9-20
Little late, but with MATLAB Coder you can convert a prediction function for KNN to C/C++ code, and then use that with your other code for feature extraction (which you could write in MATLAB also, and then convert - for supported functions).

Community Treasure Hunt

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

Start Hunting!

Translated by