Skip to content

Instantly share code, notes, and snippets.

@Jonalogy
Forked from undramatized/scikit_setup.md
Created October 27, 2016 06:16
Show Gist options
  • Save Jonalogy/76f7267c7c5587149f70ad7e4cc9ed3b to your computer and use it in GitHub Desktop.
Save Jonalogy/76f7267c7c5587149f70ad7e4cc9ed3b to your computer and use it in GitHub Desktop.
Setup and Installation of Scikit Learn

Written with StackEdit.

##Machine Learning with Scikit ###Setup and Installation

For this tutorial we will be working with a Python framework called Scikit Learn. This is a free machine learning library that will allow us to execute multiple ML techniques and methodologies.

Macs come pre-installed with Python, so let's dive right into it. (Windows users please pair programme)

Open up your terminal and enter:

$ which python

You should see:

/usr/local/bin/python

If you do not have Python, use Homebrew to install it:

$ brew install python

Also make sure that the version is 2.7. This will allow us to install the necessary dependencies.

$ python --version

Firstly, we need a package manager for python, to manage our libraries and dependencies. The most commonly used one is "pip". Most Macs come pre-installed with pip. Again you can check this using:

$ which pip

If you have it already, fantastic! Otherwise install it using EasyInstall.

$ easy_install pip

Now time for the dependencies. Before we can use Scikit Learn, we will need to have the following dependencies:

  • Scipy - Scientific Computing Library
  • Numpy - Library for complex mathematical computations
  • matplotlib - Graph and Visuals plotting library
  • Pandas - Data structures and Analysis
  • iPython - Interactive console
  • Sympy - Symbolic Mathematics
  • virtualenv - Create virtual environments for python (Like Docker)

Start off by installing the virtual environment packages.

$ pip install virtualenv
$ pip install virtualenvwrapper

Now we can install Numpy.

$ pip install numpy

Before we can install Scipy, we need to get a compiler. Here we are using Fortran, an open source free compiler.

$ brew install gcc
$ pip install scipy

Now we can go ahead with MatplotLib, Pandas and iPython, along with its dependencies.

$ pip install matplotlib
$ pip install pandas
$ pip install jinja2
$ pip install tornado
$ pip install zmq
$ pip install ipython
$ pip install jupyter

We're almost there! One last package, our Scikit-Learn:

$ pip install -U scikit-learn

####Awesome! We are now ready for some Machine Learning with Scikit-Learn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment