LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > The Final

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2013, 10:13 AM
Steph Steph is offline
Junior Member
 
Join Date: Apr 2013
Posts: 2
Default Q13 bizarre results

Hi,

Just wondering if anyone has encountered what I'm seeing, or if (more likely) I'm doing something stupid...

I'm using the svm command in the e1071 package in R to implement hard margin SVM. Working on Q14, Ein is often not 0, but most of the time when Ein > 0, I actually get Ein = 100. That is, the data set is linearly separable in the Z space, but for some reason the response values are exactly flipped.

This seems bizarre to me, yet I can't figure out why it might be happening. I'm wondering if I'm not correctly implementing the constant "b". I simply added a column of ones to my x matrix and moved forward with svm.

Any thoughts would be much appreciated.

Thanks,
Steph
Reply With Quote
  #2  
Old 06-10-2013, 02:32 PM
jforbes jforbes is offline
Member
 
Join Date: Apr 2013
Posts: 12
Default Re: Q14 bizarre results

Quote:
Originally Posted by Steph View Post
Hi,

Just wondering if anyone has encountered what I'm seeing, or if (more likely) I'm doing something stupid...

I'm using the svm command in the e1071 package in R to implement hard margin SVM. Working on Q14, Ein is often not 0, but most of the time when Ein > 0, I actually get Ein = 100. That is, the data set is linearly separable in the Z space, but for some reason the response values are exactly flipped.

This seems bizarre to me, yet I can't figure out why it might be happening. I'm wondering if I'm not correctly implementing the constant "b". I simply added a column of ones to my x matrix and moved forward with svm.

Any thoughts would be much appreciated.

Thanks,
Steph
I believe the bias is already accounted for in the SVM formalism without adding a column of 1's, i.e. the x's you give to SVM should really be just two-dimensional. To compute b, you can go back after you've received the alpha's from QP and calculate

b = y_m - Sum over support vectors (alpha_n * y_n * K(x_n,x_m))

where the dummy variable in the sum is n, and m is the index of any support vector. b should be the same no matter which SV you use.
Reply With Quote
  #3  
Old 06-10-2013, 03:01 PM
bargava bargava is offline
Junior Member
 
Join Date: Apr 2013
Posts: 8
Default Re: Q14 bizarre results

Check this documentation:
http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#f804

b is already added by the package.

Try an extremely large value for C (I used 1e+10)
Reply With Quote
  #4  
Old 06-10-2013, 09:44 PM
Steph Steph is offline
Junior Member
 
Join Date: Apr 2013
Posts: 2
Default Re: Q14 bizarre results

Thanks for the suggestions!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:55 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.