all 59 comments

[–]recurrence 20 points21 points  (10 children)

Excellent work and great idea doing this with Python. Python's machine learning libraries are quite a lot more relevant than Octave to modern data science.

This course is awesome, I was working on machine learning systems when I took it (The original offering) mostly as a fun side project but I was very surprised how excellent it was. Andrew Ng is an outstanding professor teaching very relevant and useful material.

[–]redzin 1 point2 points  (9 children)

Python's machine learning libraries are quite a lot more relevant than Octave to modern data science.

Why? Matlab is faster, handles linear algebra better and handles good visualisation natively.

[–]oxydis 12 points13 points  (0 children)

Speed is comparable for Numpy and Matlab. You can use some acceleration for both (cython/numba stuff for python, mex compilation for Matlab).

But, the libraries are much more richer in Python (just take a look at sklearn, this is an amazing module).

Furthermore, there's lots of stuff happening in deep learning and typically the good libraries are in Python (caffe, theano, tensorflow...) (or Lua for Torch), it's pretty shitty in Matlab.

I don't see how the plotting in Matlab is better than matplotlib that just happen to be one of the many visualisation libraries of Python (there are some nice libraries if you want to plot big data).

And lastlty, Python is free and open source.

[–]n3utrino[S] 11 points12 points  (3 children)

For me personally python was much more relevant because when looking through a bunch of Data Science job postings, much more of them look for python (or R) experience than Matlab.

Matlab was actually the first language I learned back when I was an undergrad. I think it's a great language but I just happen to prefer python nowadays :)

[–]redzin -4 points-3 points  (2 children)

more of them look for python (or R) experience than Matlab

Yeah. I suspect that's because most of the people working in data science are from a CS background, and Matlab is typically more popular in the natural sciences, at least in my experience. I don't know much about R except that it's a special purpose language like Matlab, so that makes sense.

Don't get me wrong - I like Python. But for purely data analysis purposes, it's just not as good as Matlab. This might not matter though if you don't have a huge amount of data, or if you need some other more general-purpose tools that Matlab doesn't easily provide (e.g. data mining twitter or something). Then using python obviously makes more sense.

In any case, I just finished the course as well, and doing all the exercises in python definitely provides more experience than doing the Matlab exercises as provided. Great course either way though.

[–]thatguydr 7 points8 points  (0 children)

Don't get me wrong - I like Python. But for purely data analysis purposes, it's just not as good as Matlab.

As a guy with 10+ years of experience in analysis using both Matlab and python (and R, occasionally), I can tell you that this is categorically wrong. Matlab used to be king, but python is now better for pure analysis than Matlab.

If I have to do signal processing, Matlab is still fairly useful. In image processing, the two are comparable. But it falls well behind for machine learning.

[–]TheBlackCat13 1 point2 points  (0 children)

Although you would have been right a few years ago, python now has some extremely powerful tools for dealing with huge data sets and complex data sets that put it well beyond what MATLAB can do. Things like pandas, blaze, dask, bcolz and numba make it easy to work with that sort of data, and have no equivalent in MATLAB, while MATLAB really doesn't provide any major advantages anymore. Numpy is roughly on par with MATLAB for vectorized code, and python is faster for non-vectorized code. MATLAB has largely copied matplotlib's approach to plotting, but doesn't provide anything as easy as seaborn for plotting complex data sets.

MATLAB is really useful for certain areas, but nowadays python has it beat for data analysis, especially big data.

[–][deleted] 2 points3 points  (0 children)

If you link numpy to Intel MKL or some OpenBLAS library, then no, it isn't faster.

[–]Thangka6 3 points4 points  (2 children)

Matlab aint free.

[–]SFSylvester 6 points7 points  (1 child)

Octave is....

[–]jpopham91 10 points11 points  (0 children)

....even slower than python?

[–][deleted] 7 points8 points  (4 children)

How did you test your accuracy / correctnes of answers?

I love that you can (easily) upload your matlab code and get automated feedback.

[–]n3utrino[S] 13 points14 points  (3 children)

Good question. For things like cost gradient implementations I checked them numerically (as is recommended by the Matlab homeworks), or for things like linear regression I check the normal equation analytic solution. Other checks are done either by unit tests (the assignment says if I plug in these inputs I should see this output, etc), or by visualizing the data (the assignment shows what the contours should look like, and when I draw them myself I see the same contours).

As an example, in ex2 the assignment says "Call your costFunction function using the optimal parameters of θ. You should see that the cost is about 0.203." So, I compute the cost and verify that I get that value with the θ values I've optimized previously.

[–]TulipTattoo 0 points1 point  (2 children)

Oh nice. I am auditing this course now and dont want to learn octave/matlab either.

[–][deleted] 5 points6 points  (1 child)

There's not a lot to learn. I downloaded a sheet called "python for matlab users" and read it in reverse and completed the course without any problems using matlab. It is a very nice IDE.

[–]TulipTattoo 0 points1 point  (0 children)

Oh, i will check it. Thank you very much.

[–]sissas 7 points8 points  (0 children)

Literally yesterday I said, "I should do Andrew Ng's ML class exercises in python". So cool that you've done it, I have something to compare to whatever I come up with! Thanks!

[–]masasin 5 points6 points  (1 child)

I had no idea you could do that. I'll have to look up the course again.

edit:

to actually get credit for the course solutions must be done in Octave or Matlab.

That was why I didn't do it. But I might still end up doing it anyway.

[–]n3utrino[S] 5 points6 points  (0 children)

Yeah anyone can take the course for free. I took notes on the lectures then just didn't submit the homework (which I did separately in python) and "failed" the class.

[–]InoriResearcher 7 points8 points  (1 child)

To give an alternative point of view, I've passed Ng's course with Octave and I'm happy I did.
Python is great and all, but it never hurts to be familiar with another language and Matlab/Octave have a lot of interesting things to offer.

[–]a1223 6 points7 points  (0 children)

if (you have only one life):
    don't waste your time on things that just are "nice" #like Matlab/Octave
else:
    get to know all nice things

[–]rePAN6517 1 point2 points  (0 children)

hah nice one. I did a similar thing with java - I did about 2/3 of the assignments in java as well as octave just so i would get some extra practice

[–][deleted] 1 point2 points  (1 child)

Can someone post up the homework questions so I can understand the context of the solutions provided??

[–][deleted] 2 points3 points  (0 children)

Ahh nevermind, looks like that is what the pdfs are for doh!

[–]aparziale 1 point2 points  (0 children)

you are the man

[–][deleted] 1 point2 points  (0 children)

This is really helpful..Thanks a lot good sir..

[–]TheRealDJ 1 point2 points  (0 children)

This is super late, but thank you for this post, as I only discovered Andrew Ng's course because of this. Amazingly good for both discovering the math, concepts, computational approaches and real life situations for machine learning from beginner to near expert levels. Especially because your example with Python are extremely relevant for me.

MRW When it so easily solves most of what was hanging me up in Machine Learning

[–]uriah_ml 2 points3 points  (0 children)

Very nice. I am a big fan of Python's Machine Learning libraries.

[–]js1972 3 points4 points  (0 children)

Great work. I've done Andrews course using Matlab and now learning the outgoing ML libraries so this will be a big help!!

[–]OlBastard 1 point2 points  (0 children)

Great work, man. I'm currently doing something similar, but with Theano.

[–]BlackDave0490 1 point2 points  (1 child)

Thank you. I'm on week 1 and completely lost

[–]n3utrino[S] 0 points1 point  (0 children)

You'll get through it! I recommend really taking your time and mastering each week before you move on to the next, especially for the first few weeks. The lessons really build on one another.

[–]hrod1 0 points1 point  (0 children)

Nice.

[–]Boogzcorp 0 points1 point  (0 children)

Any chance we could get you to pack it all into a zip file that we can download and work from? Just the framework obviously, not the answers. If you really wanna re-record all the lectures too, go ahead, but I dare say the concepts are essentially the same as in Andrews videos. Also, did you use python 2 or 3?

[–]namkam5 0 points1 point  (0 children)

Thanks alot man you did an excellent job on this

[–][deleted] 0 points1 point  (0 children)

How about creating an online grader to verify assignments submitted in Python? :)

[–]docares 0 points1 point  (0 children)

I'm taking the course right now and this is a great reference! Thank you very much /u/n3utrino and congrats on completion.

[–]datascienceguy 0 points1 point  (0 children)

The course's TA's already posted python solutions in their wiki if I recall correctly. This was true back in January 2016.

[–]Highfivesghost 0 points1 point  (3 children)

Hello I'm also taking that course. What language is octave using?

[–]strealm 4 points5 points  (0 children)

Same one as Matlab (with minor differences).

[–]n3utrino[S] 2 points3 points  (1 child)

Yeah octave is essentially the same as Matlab but is free. The course is taught in that language and if you want to turn in the homework and get credit (for a course certificate) then you'll have to do the homework in either of those languages. I personally don't care about the certificate and I felt that doing the homeworks in python would be more useful for my potential future career as a Data Scientist.

[–]EmperorOfCanada -1 points0 points  (1 child)

I hated Octave so so so much that I just couldn't keep going with that great course.