Escaping Octave: Andrew Ng’s ML course in Python
Ports Andrew Ng’s classic Coursera ML assignments from Octave to Python so you can learn the fundamentals without the Matlab hangover.

What it does
This repo holds the eight programming exercises from Andrew Ng’s introductory Machine Learning Coursera course, rewritten in Python. You work through linear regression, neural networks, SVMs, and recommender systems using numpy and matplotlib instead of Octave or Matlab, checking your output visually at each step just like the original assignments.
The interesting bit
The author deliberately flattens Octave’s column vectors into one-dimensional ndarrays and bans numpy.matrix entirely. It is a quietly opinionated choice that keeps the code feeling like Python rather than a literal syntax translation.
Key highlights
- Covers the full course arc: linear and logistic regression, neural networks, bias/variance, SVMs, K-means, PCA, anomaly detection, and recommender systems.
- Mirrors the original assignment structure so you can verify your work step-by-step.
- Uses plain
numpy.ndarrayinstead ofnumpy.matrix, avoiding a common Matlab-to-Python impedance mismatch. - Points to a separate solutions repo where the author vectorized the implementations.
- Targets Python 3.6 and depends on the usual scientific Python suspects (
numpy,scipy,matplotlib, plusscikit-learn,scikit-image, andnltkfor specific exercises).
Caveats
- The README specifies Python 3.6 but does not mention compatibility with newer Python releases.
- This is strictly coursework; do not expect a maintained library or API.
Verdict A solid companion if you are taking (or re-taking) Andrew Ng’s course and would rather write Python than Octave. Look elsewhere if you need a modern, production-ready machine learning framework.
Frequently asked
- What is nsoojin/coursera-ml-py?
- Ports Andrew Ng’s classic Coursera ML assignments from Octave to Python so you can learn the fundamentals without the Matlab hangover.
- Is coursera-ml-py open source?
- Yes — nsoojin/coursera-ml-py is open source, released under the MIT license.
- What language is coursera-ml-py written in?
- nsoojin/coursera-ml-py is primarily written in Python.
- How popular is coursera-ml-py?
- nsoojin/coursera-ml-py has 1.4k stars on GitHub.
- Where can I find coursera-ml-py?
- nsoojin/coursera-ml-py is on GitHub at https://github.com/nsoojin/coursera-ml-py.