← Open Source

Python programming assignments for Machine Learning by Prof. Andrew Ng in Coursera.

TutorialsML/AI fundamentalsPython
Momentum
+0stars in 24 hours0.0%
1.43k
Stars
485
Forks
+-1
This week
1
Contributors
Created 2017-03-21 · Updated 2026-12-01 · #12664 today
Top developers
nsoojin
README

Coursera Machine Learning Assignments in Python

About

If you've finished the amazing introductory Machine Learning on Coursera by Prof. Andrew Ng, you probably got familiar with Octave/Matlab programming. With this repo, you can re-implement them in Python, step-by-step, visually checking your work along the way, just as the course assignments.

How to start

Dependencies

This project was coded in Python 3.6

  • numpy
  • matplotlib
  • scipy
  • scikit-learn
  • scikit-image
  • nltk

Installation

The fastest and easiest way to install all these dependencies at once is to use Anaconda.

Important Note

There are a couple of things to keep in mind before starting.

  • all column vectors from octave/matlab are flattened into a simple 1-dimensional ndarray. (e.g., y's and thetas are no longer m x 1 matrix, just a 1-d ndarray with m elements.) So in Octave/Matlab,
    >> size(theta)
    >> (2, 1)
    Now, it is
    >>> theta.shape
    >>> (2, )
  • numpy.matrix is never used, just plain ol' numpy.ndarray

Contents

  • Linear Regression
  • Linear Regression with multiple variables
  • Logistic Regression
  • Logistic Regression with Regularization
  • Multiclass Classification
  • Neural Networks Prediction fuction
  • Neural Networks Learning
  • Regularized Linear Regression
  • Bias vs. Variance
  • Support Vector Machines
  • Spam email Classifier
  • K-means Clustering
  • Principal Component Analysis
  • Anomaly Detection
  • Recommender Systems

Solutions

You can check out my implementation of the assignments here. I tried to vectorize all the solutions.

Nearby in the ranking
Similar items

AI Rank for iPhone

Follow AI model rankings

Download on the App Store