Archive for January, 2014

Multiclass classification in LabVIEW using SVM and one-vs-all method

Saturday, January 11th, 2014

As I mentioned in the last post, I am now studying machine learning in my new position. Today I came across a problem to use SVM to do multiclass classification. The toolkit (link) downloaded from NI did not provide the ability to do multiclass classification with SVM but only for two classes (it’s quite a useful tool still). So I took use of the SVM VIs and made a multiclass version using one-vs-all method.

There is a good tutorial on one-vs-all or one-vs-rest classification by Andrew Ng (link). So basically we pick one class each iteration as Class A and make the rest classes as Class B. Only the test data that locate in Class A are allocated to the known class. Here is the code:

SVM one-vs-all

The original trained labelled data are classified as Class 0, 1, 2, … N. In the i-th iteration, only the data from Class i are re-classified to Class 1 and the rest data are re-classified to Class 0. When the test data locate in class 1 area, they are classified as Class i. Any unsorted data are left in Class -1. When I test the performance of this one-vs-all classifier, the result seems fine 🙂

one-vs-all front panel

The code is not optimized and the execution may cost a while.

New year, new job

Thursday, January 2nd, 2014

Hi all, hope you had a wonderful Christmas and a happy new year. It’s been 4 months since last post and something changed in my life. I started a new job in a LabVIEW consultancy company based in London. I always love London, in which there are so many places to explore.

So have to say goodbye to the lab and neuroscience. I am doing signal processing with LabVIEW now. It sounds fun and can be a good opportunity for me to learn more about machine learning and advanced LabVIEW programming. I will keep updating the blog and am thinking if I should change the blog title to some more general one 😉 (Let machine learn? Let lab wow?).

All the best.