I'm trying to develop a simple matlab code to do classification for me, i am aware that i can use svmclassify function in the matlab instead trying to write the code by myself, but i have to do this becuase it is part of my job goal. Here is the problem:
I am training the data set using the svmtrain function from the matlab and then trying to classify the new data by using my own code. From what i understand the svmtrain matlab returning the alpha, support vector and bias value which i can use to satisfy the hyperplane equation sign(w.x + b) for the new data.
So i calculated the w value with this equation w = sum(alpha*class label*support vector), now i have the w value. I also have the new data that i want to classify which i already know what is the class label. I'm doing this because i want to know whether my classifier is working or not. So i plug in the value and do the calculation, but it retun me the wrong class label for the new data. Can anyone check the code and help me if there is something that i miss out or do it wrongly. Attached is the code. Thanks for the help
I just had SVM as part of the Coursera/Stanford Univ. Machine Learning (ML) class. All the code is in Matlab/Octave. PM me if you want it. I can't post it here since it includes answers to homework problems.