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

  • Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View
 

cs229_hw2_3de

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

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

hw2_svm_3de.zip

 

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.