![]() |
#11
|
|||
|
|||
![]()
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).
|
#12
|
|||
|
|||
![]()
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 |
#13
|
|||
|
|||
![]()
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.
|
#14
|
|||
|
|||
![]() Quote:
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? |
#15
|
|||
|
|||
![]()
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. |
#16
|
|||
|
|||
![]()
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.
|
![]() |
Tags |
hw2-5 |
Thread Tools | |
Display Modes | |
|
|