• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!



Page history last edited by peter.harrington 13 years, 9 months ago

I've uploaded the files I used for HW2 problem 3 D & E here:



There are seven files in the archive: smo_test, smo_train, svm_test, and svm_train were explained in the HW question.  j_rand_not_i and clip_alpha are just helper functions from the SMO code to make it cleaner.  Beware: svm_test, and svm_train are slightly modified from the class version (see the first few lines) and I will discuss that below. 


If you run smo_verify and get a plot like the one below, then your SMO code works, and you just need to characterize it's performance. 

Once you have smo_verify correct you can try out svm_test, first you need to run svm_train to get w & b. 

There a two parameters to play with to see how the algo performs on different data sets; max_passes and tol.  Some of the iterations can take up to 10min, so it's worth while to automate the testing.  I did a crude version of this in the attached file: char_svm.  In order for char_svm to call the train and test scripts I had to make them into functions.  This was a very small change and only the first line was altered. 


With max_passes set to 100 and training on the 1400 samples I was able to achieve a test accuracy of 0.005 or 0.5%.  That is amazing performance! 


The simplified smo algo has a random component so you won't get the same results every time, so it's a good idea to take multiple samples, and average out the results. Below is one example where I took three samples. 



If you have any questions, feel free to contact me.



Comments (0)

You don't have permission to comment on this page.