LFD Book Forum  

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

Reply
 
Thread Tools Display Modes
  #11  
Old 04-15-2012, 09:13 AM
mathprof mathprof is offline
Invited Guest
 
Join Date: Apr 2012
Location: Bakersfield, California
Posts: 36
Default Re: What software are you using for the assignments?

I use Python with numpy (and matplotlib for graphs). One can do all the cool things one can do with Matlab or its free opensource doppleganger Octave. Having programed using Python with numpy, it was very easy to get the hang of Octave (which we had to use for Andrew Ng's ML class).
Reply With Quote
  #12  
Old 04-15-2012, 12:08 PM
jsarrett jsarrett is offline
Member
 
Join Date: Apr 2012
Location: Sunland, CA
Posts: 13
Default Re: HW2.5: does location of split boundaries matter?

I also use python, with lots of numpy. I recommend that for python programming you try ipython, as it has tab completion and will let you generate graphs from the interpreter while the graphing happens in a separate thread (ipython -pylab). The numpy routines use ATLAS ("automatically tuned linear algebra subroutines") underneath and so they are pretty fast, if you use them well. As a bonus, in ipython if you type (or tab-complete) a function (such as numpy.dot) followed by a question mark ('?'), instead of calling it, you get the functions help string.

I usually write my functions once in the interpreter to work through them, and then put them in a .py file (e.g. hw2.py) that you can import. If you change the file, instead of restarting the interpreter, you can reload(hw2.py) and try again. This way I can test the routine before running it 1000 times and waiting a minute for the failed results. It really cuts down on development time.

MATLAB/Octave generally have the same upside and a similar workflow, but it's hard to do non math things in them, since they're not general purpose languages like python. Also the fact that python functions are first class objects is pretty handy in writing reusable code. (you can pass them around willy-nilly, or replace them with improved ones on a whim)

That's my workflow in a nutshell.
-James
Reply With Quote
  #13  
Old 04-16-2012, 11:44 AM
oldalum oldalum is offline
Junior Member
 
Join Date: Apr 2012
Posts: 7
Default Re: HW2.5: does location of split boundaries matter?

Similar to alfansome, I used java to code the experiments and provide visualization to convince myself that the code was doing what I intended. (I'm using this course as an excuse to learn java as well.) I found a useful java library for matrix operations at http://code.google.com/p/efficient-java-matrix-library/. It even provides a ready-made pseudoInverse function.
Reply With Quote
  #14  
Old 04-17-2012, 04:13 AM
GraceLAX GraceLAX is offline
Junior Member
 
Join Date: Apr 2012
Location: LAX
Posts: 4
Default Re: What software are you using for the assignments?

Quote:
Originally Posted by mathprof View Post
I use Python with numpy (and matplotlib for graphs). One can do all the cool things one can do with Matlab or its free opensource doppleganger Octave. Having programed using Python with numpy, it was very easy to get the hang of Octave (which we had to use for Andrew Ng's ML class).
Does anyone use matplotlib on OS X?
I am learning python and numpy as I do the homework. I'm doing it blind because I can't get matplotlib to display on my macbookpro. Has anyone else been successful using the plotting routines on OS X? What display settings did you use?
Reply With Quote
  #15  
Old 04-17-2012, 08:54 PM
dudefromdayton dudefromdayton is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 140
Default Re: HW2.5: does location of split boundaries matter?

I did problem set #1 using C. When a visual was needed, I wrote scalable vector graphics with some quick printfs. Clearly, an update to my approach was needed for problem set #2.

After thinking about it some, I did problem set #2 using C and SVG as before, and linked with the GNU Scientific Library for linear algebra and random number generation. As I hadn't done any matrix arithmetic with GSL before, a lot of my homework time was looking up how to do what. I figure I'm in good shape for the rest of the course!

C would not be the approach for everyone. But its limited features mean one doesn't have to know a whole lot. I do like Python, but its base language documentation seems very lacking and unnavigable next to, say, Kernighan and Ritchie's classic C text.
Reply With Quote
  #16  
Old 04-17-2012, 09:00 PM
dudefromdayton dudefromdayton is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 140
Default Re: HW2.5: does location of split boundaries matter?

Many libraries provide ready-made solvers which bypass the pseudoinverse altogether. My math is a little sketchy, and I opted to solve by LU decomposition, not knowing any better.
Reply With Quote
Reply

Tags
hw2-5

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 08:37 AM.


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