LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > Homework 7

Reply
 
Thread Tools Display Modes
  #11  
Old 05-20-2012, 04:14 AM
dudefromdayton dudefromdayton is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 140
Default Re: What Quadratic Programming Package?

@jbaker, make sure you're not creating test cases with all points on the same side of the line (see instructions). Maybe then you won't get the positive definite complaint.
Reply With Quote
  #12  
Old 05-20-2012, 07:24 AM
epsilon epsilon is offline
Junior Member
 
Join Date: Apr 2012
Posts: 4
Default Re: What Quadratic Programming Package?

I use a built-in command qp in octave.
http://www.gnu.org/software/octave/d...ogramming.html

It seems to work, but I am not sure it can do well like cvxopt and other packages.
Reply With Quote
  #13  
Old 05-20-2012, 01:13 PM
alfansome alfansome is offline
Member
 
Join Date: Apr 2012
Posts: 35
Default Re: What Quadratic Programming Package?

Quote:
Originally Posted by lucag View Post
Thanks for the input ... I found the CVX library for Matlab and I will (try to) use that.
@Marcello I don't think any of those libraries are system specific, i.e., they can be used on a Mac as well as on Windows, or Linux, or BSD, or ...
I've had problems trying to install cvxopt on mac os x 10.7 (with Apple supplied python), so looking for alternate approaches.
Reply With Quote
  #14  
Old 05-20-2012, 01:16 PM
lucag lucag is offline
Member
 
Join Date: Apr 2012
Posts: 44
Default Re: What Quadratic Programming Package?

Quote:
Originally Posted by alfansome View Post
I've had problems trying to install cvxopt on mac os x 10.7 (with Apple supplied python), so looking for alternate approaches.
what kind of problems? I have a Mac running Lion and installed cvxopt without a glitch...
Reply With Quote
  #15  
Old 05-20-2012, 03:13 PM
jbaker jbaker is offline
Member
 
Join Date: Apr 2012
Posts: 11
Default Re: What Quadratic Programming Package?

Yes, I caught the not-all-on-one-side requirement.

Now I've tried both in R and also using the CGAL library with C++, but the latter is also complaining that Q is not positive semidefinite!

Which makes me think that I'm just being silly and constructing Q wrong. If you have points x_(d,i) where d = {1,2} is the dimension and i = {1..N}, with response y_(i) in {-1, 1}, then the matrix elements are

Q_(ij) = y_(i) * y_(j) * sum_d [ x_(d,i) * x_(d,j) ]

Right?
Reply With Quote
  #16  
Old 05-20-2012, 03:30 PM
alfansome alfansome is offline
Member
 
Join Date: Apr 2012
Posts: 35
Default Re: What Quadratic Programming Package?

Quote:
Originally Posted by lucag View Post
what kind of problems? I have a Mac running Lion and installed cvxopt without a glitch...
I downloaded the tar.gz file cvxopt-1.1.5.tar.gz, unpacked it, and then ran the python setup program to build it; generated hundreds of errors and no usable cvxopt module for python. I also tried using easy_install and it too failed. Again, I am just using the python that comes bundled with mac os x (its python 2.7.1).

How did you install it?
Reply With Quote
  #17  
Old 05-20-2012, 03:31 PM
dudefromdayton dudefromdayton is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 140
Default Re: What Quadratic Programming Package?

@jbaker, I didn't have to go that far into the weeds, as I used an SVM package as opposed to a QP package. If you ignore the warnings, are you getting a sensible number of support vectors out? If you aren't, there definitely is a problem.

I don't see a problem with your formulation for Q, but again I didn't go that route. Someone else might see a problem that I missed.

Last edited by dudefromdayton; 05-20-2012 at 03:45 PM. Reason: UPDATED
Reply With Quote
  #18  
Old 05-20-2012, 03:35 PM
dudefromdayton dudefromdayton is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 140
Default Re: What Quadratic Programming Package?

@alfansome, are you okay on the second paragraph from the cvxopt installation instructions? I haven't done this myself, but I looked it up.

"The package requires version 2.7 or 3.x of Python, and is built from source, so the header files and libraries for Python must be installed, as well as the core binaries.

"The installation requires either ATLAS or BLAS + LAPACK. Using architecture optimized ATLAS libraries is recommended and gives a large performance improvement over standard BLAS & LAPACK libraries. Both header files and libraries must be installed."
Reply With Quote
  #19  
Old 05-20-2012, 03:46 PM
lucag lucag is offline
Member
 
Join Date: Apr 2012
Posts: 44
Default Re: What Quadratic Programming Package?

Quote:
Originally Posted by alfansome View Post
I downloaded the tar.gz file cvxopt-1.1.5.tar.gz, unpacked it, and then ran the python setup program to build it; generated hundreds of errors and no usable cvxopt module for python. I also tried using easy_install and it too failed. Again, I am just using the python that comes bundled with mac os x (its python 2.7.1).

How did you install it?
mmm that's weird: I do get tons of warnings but at the end it works just fine (tried with one of the examples provided). The version installed is 2.7.1
Did you install it globally or only for a specific user? I don't know if it changes anything, but I installed it as root -- sudo python setup.py install -- on my machine.
Reply With Quote
  #20  
Old 05-20-2012, 05:42 PM
jbaker jbaker is offline
Member
 
Join Date: Apr 2012
Posts: 11
Default Re: What Quadratic Programming Package?

After way too much sanity checking, I convinced myself that one should indeed plow ahead despite the positive-definiteness alarms. However in order to get CGAL not to abort, you have to #define CGAL_QP_NO_ASSERTIONS before including the headers! Not sure how one would get the same behavior in R.

CGAL seems pretty slick, btw.
Reply With Quote
Reply

Tags
hw7, package, quadratic programming

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 02:32 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.