LFD Book Forum (http://book.caltech.edu/bookforum/index.php)
-   Homework 8 (http://book.caltech.edu/bookforum/forumdisplay.php?f=137)
-   -   on the right track? (http://book.caltech.edu/bookforum/showthread.php?t=4044)

 Sendai 02-27-2013 06:57 PM

on the right track?

I thought it would be nice to have a way to check if we're on the right track with problems 2-5 without giving away the answers. I ran SVM (with the polynomial kernel) for a couple of cases and pasted the results below. Are others getting the same numbers?

0 vs 7 classifier, C=0.01, Q=2
number of support vectors = 861
= 0.071778
= 0.063241

2 vs 8 classifier, C=0.1, Q=3
number of support vectors = 721
= 0.234878
= 0.291209

 Anjoola 02-28-2013 12:00 AM

Re: on the right track?

Hi, I got ALMOST the same numbers, except I got 860 support vectors for the first one instead of 861, and as a result my E_in is slightly different than yours. How did you choose your support vectors? Did you just check for or or ?

 hemphill 02-28-2013 11:25 AM

Re: on the right track?

I got exactly the same figures as the original poster. I'm using libsvm with the C programming language.

 Sendai 02-28-2013 12:59 PM

Re: on the right track?

Quote:
 Originally Posted by Anjoola (Post 9587) How did you choose your support vectors? Did you just check for or or ?
I'm using libsvm via scikit-learn and Python, and it takes care of all of that for you.

For the previous week's homework, I looked for alpha greater than .

Since we're all getting basically the same numbers, I have more confidence that I'm doing it right.

 ivankeller 02-28-2013 02:02 PM

Re: on the right track?

Thanks Sendai, That was a good idea.
I'm using scikit-learn too, a pretty nice python module.

Your results helped me to figure out that I needed to set the parameters gamma and coef0 in sklearn.svm.SVC(...) to 1. These parameters don't appear in the lecture. Now I've got the same results.

 ilya239 03-01-2013 03:54 PM

Re: on the right track?

Quote:
 Originally Posted by Sendai (Post 9581) I thought it would be nice to have a way to check if we're on the right track with problems 2-5 without giving away the answers. I ran SVM (with the polynomial kernel) for a couple of cases and pasted the results below. Are others getting the same numbers? 0 vs 7 classifier, C=0.01, Q=2 number of support vectors = 861 = 0.071778 = 0.063241 2 vs 8 classifier, C=0.1, Q=3 number of support vectors = 721 = 0.234878 = 0.291209
Got similar numbers with python and cvxopt. As another check, got four margin support vectors for 0 vs 7, six for 2 vs 8.

 Sendai 03-02-2013 04:02 PM

Re: on the right track?

Quote:
 Originally Posted by ilya239 (Post 9630) Got similar numbers with python and cvxopt. As another check, got four margin support vectors for 0 vs 7, six for 2 vs 8.
I get three and five respectively using libsvm via Python and scikit-learn.

 Suhas Patil 03-03-2013 08:27 AM

Re: on the right track?

I'm trying libsvm through C, with following parameters:

param.svm_type = C_SVC;
param.kernel_type = POLY;
param.degree = 2;
param.gamma = 1;
param.coef0 = 1;
param.nu = 0.5;
param.cache_size = 200;
param.C = 0.01;
param.eps = 1e-3;
param.p = 0.1;
param.shrinking = 1;
param.probability = 0;
param.nr_weight = 0;
param.weight_label = NULL;
param.weight = NULL;

but getting Ein as 0.350 with 0 versus 7 classification. Also unable to find good explaination of these parameters anywhere. Any help?

 Suhas Patil 03-03-2013 09:23 AM

Re: on the right track?

I found the issue...thanks for reply from buttterscotch. The problem was with the way I was initializing 'svm_node' structure after reading the training data.

 butterscotch 03-03-2013 09:25 AM

Re: on the right track?

Seems good to me. Are you getting the same number of support vectors with Sendai's post? You might want to verify how you calculate the error. The sv_coefficients are not just "alpha", but "y*alpha"

All times are GMT -7. The time now is 12:31 AM.