dibgerge / ml-coursera-python-assignments

Python assignments for the machine learning class by andrew ng on coursera with complete submission for grading capability and re-written instructions.
5.44k stars 2.15k forks source link

Coursera Machine Learning MOOC by Andrew Ng

Python Programming Assignments

This repositry contains the python versions of the programming assignments for the Machine Learning online class taught by Professor Andrew Ng. This is perhaps the most popular introductory online machine learning class. In addition to being popular, it is also one of the best Machine learning classes any interested student can take to get started with machine learning. An unfortunate aspect of this class is that the programming assignments are in MATLAB or OCTAVE, probably because this class was made before python became the go-to language in machine learning.

The Python machine learning ecosystem has grown exponentially in the past few years, and is still gaining momentum. I suspect that many students who want to get started with their machine learning journey would like to start it with Python also. It is for those reasons I have decided to re-write all the programming assignments in Python, so students can get acquainted with its ecosystem from the start of their learning journey.

These assignments work seamlessly with the class and do not require any of the materials published in the MATLAB assignments. Here are some new and useful features for these sets of assignments:

Downloading the Assignments

To get started, you can start by either downloading a zip file of these assignments by clicking on the Clone or download button. If you have git installed on your system, you can clone this repository using :

clone https://github.com/dibgerge/ml-coursera-python-assignments.git

Each assignment is contained in a separate folder. For example, assignment 1 is contained within the folder Exercise1. Each folder contains two files:

Requirements

These assignments has been tested and developed using the following libraries:

- python==3.6.4
- numpy==1.13.3
- scipy==1.0.0
- matplotlib==2.1.2
- jupyter==1.0.0
- jupyter-client==5.0.1

We recommend using at least these versions of the required libraries or later. Python 2 is not supported.

Python Installation

We highly recommend using anaconda for installing python. Click here to go to Anaconda's download page. Make sure to download Python 3.6 version. If you are on a windows machine:

Once you have installed python, create a new python environment will all the requirements using the following command:

conda env create -f environment.yml

After the new environment is setup, activate it using (windows)

activate machine_learning

or if you are on a linux machine

source activate machine_learning 

Now we have our python environment all set up, we can start working on the assignments. To do so, navigate to the directory where the assignments were installed, and launch the jupyter notebook from the terminal using the command

jupyter notebook

This should automatically open a tab in the default browser. To start with assignment 1, open the notebook ./Exercise1/exercise1.ipynb.

Python Tutorials

If you are new to python and to jupyter notebooks, no worries! There is a plethora of tutorials and documentation to get you started. Here are a few links which might be of help:

Caveats and tips

Acknowledgements