« Back to home

Jump start Scikit-learn in 3 steps

Scikit-learn is a comprehensive toolbox for machine learning in Python. This guide shows how to install scikit-learn on top of the Canopy Python distribution in a Windows machine.

  1. Install Python

    Download and run the Canopy express python installer for your windows distribution. Adding the installation to the path environment variable deals with previous installations and other conflicts. The following PowerShell (PS) command does exactly that:

     [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Users\YOURNAME\AppData\Local\Enthought\Canopy32\User;C:\Users\YOURNAME\AppData\Local\Enthought\Canopy32\User\Scripts", "User")

    Open a new PS terminal and type python to start an interactive Canopy python shell. Use the exit() to return to PowerShell.

  2. Install PIP

    The Python Packaging Index (PIP) downloads and manages Python packages conveniently. The recommended way to install PIP in Windows is executing the linked script:

     python get-pip.py
  3. Install Scikit-learn

    At this point, you would like to use Canopy's graphical package manager to install libraries such as numpy, scipy or matplotlib. However, Scikit-learn must be installed via command line using PIP:

     pip install -U scikit-learn

Package Manager - Canopy

Within a Python shell, type import sklearn; to confirm that the library is ready to be used. A more complete test is described in their official website.

In coming posts, I'll provide examples and a small project using scikit-learn.


comments powered by Disqus