Code Monkey home page Code Monkey logo

coursera-python's Introduction

Python Programming Instruction

The Python machine learning ecosystem has grown exponentially in the past few years, and 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.

All programming assignments use Jupyter Notebook, which provides an intuitive step-by-step flow.

Downloading the Assignments

Each assignment is contained in a separate folder. For example, homework 1 is contained within the folder HW1. Each folder contains:

  • The assignment jupyter notebook, which has a .ipynb extension. All the code which you need to write will be written within this notebook.

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:

  • Open the executable after download is complete and follow instructions.
  • Once installation is complete, open Anaconda prompt from the start menu. This will open a terminal with python enabled.

If you are on a linux machine:

  • Open a terminal and navigate to the directory where Anaconda was downloaded.

  • Change the permission to the downloaded file so that it can be executed. So if the downloaded file name is Anaconda3-5.1.0-Linux-x86_64.sh, then use the following command:

    chmod a+x Anaconda3-5.1.0-Linux-x86_64.sh

  • Now, run the installation script using ./Anaconda3-5.1.0-Linux-x86_64.sh, and follow installation instructions in the terminal.

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

conda create -n machine_learning python=3.6 scipy=1 numpy=1.13 matplotlib=2.1 jupyter

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 ./HW1/hw1.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:

  • Python Programming: A turorial with videos about the basics of python.

  • Numpy and matplotlib tutorial: We will be using numpy extensively for matrix and vector operations. This is great tutorial to get you started with using numpy and matplotlib for plotting.

  • Jupyter notebook: Getting started with the jupyter notebook.

Caveats and tips

  • In many of the exercises, the regularization parameter $\lambda$ is denoted as the variable name lambda_, notice the underscore at the end of the name. This is because lambda is a reserved python keyword, and should never be used as a variable name.

  • In numpy, the function dot is used to perform matrix multiplication. The operation '*' only does element-by-element multiplication (unlike MATLAB). If you are using python version 3.5+, the operator '@' is the new matrix multiplication, and it is equivalent to the dot function.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.