6 ms·
Andrew Ng said in the Coursera Machine learning class that according to his experience, students implement the course homework faster in Octave/Matlab than in P
by sampo 11y ago
Andrew Ng said in the Coursera Machine learning class that according to his experience, students implement the course homework faster in Octave/Matlab than in Python.
But yes, the point of that course is to implement and play around with small numerical algorithms, whereas the linked blog is about someone who mainly calls existing machine learning libraries from Python.
Ref. https://news.ycombinator.com/item?id=4485877 https://news.ycombinator.com/item?id=4485877
- rasbt 11y agoInteresting! It's hard for a single person to tell, because you can only start one way digging into machine learning. However, from a teacher's perspective, this is a useful observation. I also started with Matlab since it was the language that was used in my classes. However, I think this is also a little bit context dependent: For someone who has never programmed before, Matlab may be more intuitive. I think in an ideal world, you should let your students choose what language they want to use to solve the problem :).
- jordigh 11y agoFor someone who has never programmed before, Matlab may be more intuitive. Yes, this is Matlab's target audience: programmers who will not call themselves "programmers". In recent versions, they have tried even harder to hide the code away from the user, by trying to make everything work by clicking on buttons. I have heard from many Matlab users call themselves "not a programmer". They don't feel like writing software is what they're doing when they're using Matlab.
- noobermin 11y agoOn balance, I've met people who claim they are intermediate programmers and use matlab only, and are freaked to shit when they see higher order functions in other languages, or even the idea of passing a "function", like, say, a pointer to a function, into another function, even though function pointers have existed since C.
- jordigh 11y agoThey exist in Matlab too. They're called function handles. Matlab has functionalish functions like `arrayfun`, `cellfun` (akin to `map`) or `accumarray` (akin to `fold`), but the Matlab documentation prefers to teach loops, presumably because they're easier to understand, and usually faster in Matlab thanks to their JIT compiler. I'm surprised that people are so surprised that you can pass function handles around, since there are some Matlab functions for solving ODEs or root-finding that are very commonly taught in intro courses that require function handles. I guess not everyone's first exposure to Matlab involves solving ODEs or root-finding.
- sampo 11y ago> function pointers have existed since C Also at least in ALGOL 68, COBOL, and FORTRAN 77. Maybe earlier, too.
- frozenport 11y agoMatlab has a better interface, Octave doesnt.
- jordigh 11y agoHave you found the Octave GUI to be unusable?
- frozenport 11y agoPersonally, yes, but I tried about 5 years ago.
- jordigh 11y agoIt didn't exist 5 years ago, so you must have tried one of the 3rd party crappy attempts at making a GUI. Sadly, it's difficult for Octave to shake off its reputation. Try the GUI again. Here is a web version of it that is almost identical to running it on your own desktop: https://www.rollapp.com/app/octave https://www.rollapp.com/app/octave This web version is based on Octave 3.8.1, though. Octave 4.0 has a much better version of the GUI: https://en.wikipedia.org/wiki/GNU_Octave#/media/File:Octave-4.0.0-rc1-Qt5.4-Linux.png https://en.wikipedia.org/wiki/GNU_Octave#/media/File:Octave-... If you have Windows, try our installer: https://ftp.gnu.org/gnu/octave/windows/ https://ftp.gnu.org/gnu/octave/windows/
- jacobolus 11y agoInteresting. In my own experience trying to implement the same image processing algorithms in Matlab vs. numpy, the work took about the same amount of effort any time arrays were limited to 1-2 dimensions, all the code was simple numerical stuff, and it wasn’t necessary to break the code up into multiple functions. The Matlab one-file-per-function thing, the lack of namespaces, and general lack of code structuring primitives makes it much less pleasant than Python for programs bigger than about 100 LOC though. Dealing with higher-dimensional arrays, more sophisticated plotting, data munging, string processing, interfaces with external systems, etc. all left me banging my head in Matlab though, whereas Python makes it all a breeze. Numpy’s broadcasting feature is also super nice, compared to wrapping everything in bsxfun calls in Matlab. I wonder how much the @ operator in Python 3.5 will help students. Hopefully numpy can deprecate and phase out their "Matrix" object, and end the confusion about the meaning of basic operators.
- rasbt 11y agoJust want to leave a comment about the "Matrix" object. I remember the first day I got started with NumPy. Coming from MATLAB, I really felt tempted to use it. However, I also saw an recommendation (can't remember if I read this in the NumPy documentation or in an online forum) that ndarrays are more widely supported. I never really bothered about `Matrix` then, and honestly, I have never ever seen anyone using it. Maybe you will find some examples on GitHub if you really search for it, but it is practically non-existend.
- sampo 11y agoI would imagine, for a beginner, in Python the difference between a list and a numpy array can be confusing. And in numpy, column vectors and row vectors are a different thing. Whereas in Octave/Matlab "everything just works" in the do-what-I-mean sense. > The Matlab one-file-per-function thing By the way, Octave does not have that limitation.
- TheBlackCat13 11y ago> And in numpy, column vectors and row vectors are a different thing. Whereas in Octave/Matlab "everything just works" in the do-what-I-mean sense. I think this is actually one of MATLAB's biggest flaws. Without a true 1D array like numpy has, there is no way in MATLAB to tell the difference between a 1D sequence of values, and a 2D sequence of values with only one value along one of the dimensions. This has led function developers to try to guess. But they guess inconsistently. Some functions treat row and column vectors differently, some treat them the same. Of those that treat them the same, some return them with the same orientation, while other force a particular orientation. Some operations ignore dimensions (length), others don't (for loops). Some maintain dimensions (size), some don't ([:]). So everything may seem to work, until your code that has been working fine for years suddenly breaks, and you realize it is choking up because one of your experiments has only one trial, or one of your experiments has multiple trials each with one result, and some of the functions you are using start reacting differently to this. Then you have to go through each function and figure out on a case-by-case basis how it handles row and column vectors. Or worse yet, it seems to run fine, but is silently doing the wrong thing. Which you probably would never know, because most MATLAB code isn't unit-tested.
- daniel-levin 11y agoThis could also be because students are already familiar with doing numerical computations in MATLAB from courses they'd done before. It is conceivable that students that take a machine learning course have already done some numerical analysis or scientific programming, likely using MATLAB.