Basics of Content-based Predictive Analytics Filters
How to Extract, Transform, and Load Data for Predictive Analysis
The Problem with Relying on Only One Predictive Analysis

How to Install the Python Dependencies for Predictive Analysis

The scikit-learn module requires (or is dependent on) a few other modules to be installed before you can start using it for predictive analysis. Modules that are dependent on other modules are called dependencies. In this case, the dependencies are numpy, scipy, and matplotlib.

You need to install the following dependencies:

  • numpy

  • scipy

  • matplotlib

These packages may be available from several locations:

Choosing the versions that have Windows installers will make the installation process quicker and as simple as possible.

Installing the dependencies is similar to installing scikit-learn. It’s a series of prompts and clicks. To stay consistent across all dependencies, choose the default options.

How to install numpy

You may download numpy from the SourceForge website.

  1. From the SourceForge website, do a search for numpy in the search form.

    Many listings show up. The needed module is numpy-1.8.0. If you search for it, it should appear as the top listing onscreen. To be sure that you have the same file, check to make sure it has the following description:

    Numerical Python: Numerical Python adds a fast and sophisticated array facility to the Python language.
  2. Click the Download Now button to download the latest version of.

    Doing so takes you to the download page; in a few seconds, a prompt appears, asking you to accept the download of the file.

    Here is a direct link to the download page.

    image0.jpg
  3. Click the Save File button and wait for the download to finish.

    The file numpy-1.8.0.win32-superpack-python2.7.exe will be downloaded.

  4. Go to your downloads folder (or wherever you saved the file) and run the file by double-clicking the filename.

    This may open a series of prompts or warnings that will ask whether you want to proceed with running an executable file. They’ll be similar to those that show up when you install scikit.

  5. Click the OK/Run/Allow button and continue.

    A screen showing some important and useful information about the project appears.

  6. Click the Next button.

    A screen appears, asking where you want the module installed.

  7. Accept the default location of the setup and click Next.

    A screen appears, displaying one final prompt before installation begins.

  8. Clicking Next begins the installation process.

    When the status bar is finished, you’re notified that your installation is complete.

  9. Click the Finish button and then the Close button.

    That’s it for this dependency — numpy is installed.

How to install scipy

You may download scipy from the SourceForge website. The installation process is pretty much the same as the installation for numpy.

  1. From the SourceForge website, do a search for scipy in the search form.

    The top listing from the search should be

    SciPy: Scientific Library for Python
  2. Click the Download Now button to download the latest version of scipy.

    Doing so takes you to the download page. In a few seconds, a prompt appears, asking you to accept the download of the file.

    Here is a direct link to the download page.

    image1.jpg

The rest of the installation process is the same as listed for .

How to install matplotlib

The final module to install is . To get the executable file, go to matplotlib and click the link to matplotlib-1.2.1.win32-py2.7.exe. Doing so takes you to the SourceForge website; the download prompt appears in a few seconds. Once again, the rest of the installation process is the same as listed for numpy.

image2.jpg

Here is a direct link to the download page.

How to check your installation

When you’ve installed scikit-learn and all its dependencies, be sure you confirm that the installation went as expected. You want to avoid running into any problem or unexpected errors later on.

  1. Go to the Python interactive shell by choosing Windows Start button->Python2.7->Python (command line).

    The process is similar if you did a custom installation of Python.

  2. In the interactive shell, try running in the following statement to import all the modules that you installed:

    >>> import sklearn, numpy, scipy, matplotlib

    If the Python interpreter returns no errors, then your installation succeeded.

    image3.jpg

    If you get an error message, then something went wrong in the installation process. You’ll have to reinstall the module that is listed in the line that begins with .

    image4.jpg

    Assuming everything went as planned, then you’re ready to begin using scikit-learn to build a predictive model.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Run Test Data and Evaluate an SVM Supervised Learning Model
How to Prepare Data for Predictive Analysis
How Predictive Analytics Increases Returns on Investments (ROI)
How to Run Training Data in an SVM Supervised Learning Model
How to Cluster by Nearest Neighbors in Predictive Analysis
Advertisement

Inside Dummies.com