LFD Book Forum

LFD Book Forum (http://book.caltech.edu/bookforum/index.php)
-   Homework 8 (http://book.caltech.edu/bookforum/forumdisplay.php?f=137)
-   -   can't get LIBSVM on Ubuntu, how to scale SV? (http://book.caltech.edu/bookforum/showthread.php?t=4037)

IlanTal 02-27-2013 03:14 AM

can't get LIBSVM on Ubuntu, how to scale SV?
 
I tried to install the LIBSVM on my Linux box for Octave and failed. I fixed the path names but it fails to find mex.h, which I can't find either.
Yesterday I tried to run on the full training set and after 3/4 hour Octave crashed running out of memory. Today I tried running on the first 400 points and that takes 4 minutes. 500 points takes 8.5 minutes
Question 1: how long does a run take on the full training set using LIBSVM?
Question 2: how to scale the number of support vectors?
I compared 400 to 500 points and got 1.33 more vectors with 1.25 more points. If I have to guess I will guess 7291/400 -> 18 times more SV

It is a pity I can't get the LIBSVM to run but since the main point of the homework is to learn, at least I will use what I can (400 points) to do the exercises.
Thanks,
Ilan

SeanV 02-27-2013 06:24 AM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
how much memory do you have? unless you say that people can't tell whether it is a problem with your implementation or a true memory problem???

there are also iterative methods i believe

and I've heard good things about Shogun


But I haven't done the homework yet!

IlanTal 02-27-2013 10:04 AM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
Thanks for the reply. I have 3GB of memory, still under the 4GB limit where a 64 bit OS is required, but more than enough for most purposes.
After 3/4 hour of grinding away with no answer it is most reasonable that memory would be used up. I looked at the memory allocation and even the swap memory, which up until now has always been zero had half of it in use.
I'm convinced the error message was correct. Normal memory managed to clear most of itself after octave came out of its crash. Still to get things back to normal I had to do a reset - a log out wasn't enough.

Sendai 02-27-2013 02:44 PM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
I can't help with Octave, but Ubuntu has a libsvm-tools package that contains command-line tools for working with libsvm. You might be able to do most/all of the homework using that.

I'm using libsvm with Python, and my code uses less than 40Mb of memory to solve question #2.

(BTW, 32-bit Ubuntu doesn't have a 4Gb memory limit...my system is able to see all 8Gb of memory I have.)

ivankeller 02-28-2013 10:36 AM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
I recommend the nice Python module scikit-learn which implement SVM with libsvm. Pretty easy to use.

IlanTal 02-28-2013 12:07 PM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
I tried to install shogun which had the advantage of being in the Ubuntu repository. Catch-22, the octave-shogun interface has been dropped due to the fact that it was limited to 4GB. So it looks like I'll do the homework based upon 400 points. My extrapolation may be inaccurate but I'll use a factor of 18 times the number of vectors I get and hope it is reasonably close.

SeanV 02-28-2013 01:38 PM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
I would also recommend scikit-learn... [because it is very easy and has plenty of documentation]

svm scikit learn

you should be able to adust examples


I have installed it on a 3gb windows 7 32-bit machine no problem [ and its in ubuntu repository]

To echo sendai ... I didn't see any memory spikes at all when I ran it on on my 3gb machine questions 2,3 took about a couple of minutes.... so I suspect you are doing something seriously wrong

IlanTal 03-01-2013 12:31 AM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
I contacted Chih-Jen Lin and he suspects I'm missing some module but can't guess which it might be. The compiler crashes looking for mex.h and I can't find it either.
The scikit looks interesting but it doesn't seem to have an interface to octave, only python. I've never used python, only Java. Java has solved all my problems so there was no reason to try python.
The problem is that I am running out of time. I can't afford a new can of worms and I must stay with octave. There is also the debugging effort making sure that all the numbers make sense.
If I were doing a real problem there is no question of biting the bullet and learning python, but for a homework with a deadline one has to round the corners.

butterscotch 03-01-2013 01:42 AM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
http://www.csie.ntu.edu.tw/~cjlin/libsvm/#download
It seems like the package includes Java as well. Have you tried using it?

IlanTal 03-01-2013 05:27 AM

Re: can't get LIBSVM on Ubuntu, how to scale SV?
 
Thanks for the replies. They keep me from banging my head against the wall.

The situation is worse than I thought as I couldn't get answers which made sense. Did I have a typo in my code? Did I have a basic misunderstanding? Was the quadratic programming actually working?

The only way to solve it was to try something new. I tried the unconstrained case. Here the results made sense. I looked at y and not sign(y). On the margin y was + or - 1 which made sense. Off the margin the y was either more negative than -1 or more positive than 1. That also made sense. So apparently at least I didn't have any typos.

The maximum alpha was 24, so I tried to set the limit to 100 and got the same results. Again it makes sense. I cranked it down to 30 and again it was good. Then I tried 20. Now the point on the +1 boarder was no longer on the boarder and it was less than 1.

Now I cranked it down to 10. Now the point originally at +1 turned negative. This is bad. The negative points were still negative and the off margin points were still less than -1, but they were getting closer and closer to -1.

At C=0.01 all my positive points had long since gone negative and the negative points were all close to -1.

In short it seems like the native algorithm inside octave has a serious bug. If I want to do the homework at all, I'll have to leave octave and look for a quadratic program which works correctly. I am most at home in Java, so I'll try it.

Thanks again for all the suggestions,
Ilan


All times are GMT -7. The time now is 03:11 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2021, 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.