Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Machine Learning with scikit-learn Quick Start Guide

You're reading from  Machine Learning with scikit-learn Quick Start Guide

Product type Book
Published in Oct 2018
Publisher Packt
ISBN-13 9781789343700
Pages 172 pages
Edition 1st Edition
Languages
Author (1):
Kevin Jolly Kevin Jolly
Profile icon Kevin Jolly

Table of Contents (10) Chapters

Preface Introducing Machine Learning with scikit-learn Predicting Categories with K-Nearest Neighbors Predicting Categories with Logistic Regression Predicting Categories with Naive Bayes and SVMs Predicting Numeric Outcomes with Linear Regression Classification and Regression with Trees Clustering Data with Unsupervised Machine Learning Performance Evaluation Methods Other Books You May Enjoy

Installing scikit-learn

There are two ways in which you can install scikit-learn on your personal device:

  • By using the pip method
  • By using the Anaconda method

The pip method can be implemented on the macOS/Linux Terminal or the Windows PowerShell, while the Anaconda method will work with the Anaconda prompt.

Choosing between these two methods of installation is pretty straightforward:

  • If you would like all the common Python package distributions for data science to be installed in one environment, the Anaconda method works best
  • If you would like to build you own environment from scratch for scikit-learn, the pip method works best (for advanced users of Python)
This book will be using Python 3.6 for all the code that is displayed throughout every chapter, unless mentioned otherwise.

The pip method

Scikit-learn requires a few packages to be installed on your device before you can install it. These are as follows:

  • NumPy: Version 1.8.2 or greater
  • SciPy: Version 0.13.3 or greater

These can be installed using the pip method by using the following commands:

pip3 install NumPy
pip3 install SciPy

Next, we can install scikit-learn using the following code:

pip3 install scikit-learn

Additionally, if you already have scikit-learn installed on your device and you simply want to upgrade it to the latest version, you can use the following code:

pip3 install -U scikit-learn
The version of scikit-learn implemented in the book is 0.19.1.

The Anaconda method

In the event that you have installed Python using the Anaconda distribution, you can install scikit-learn by using the following code in the Anaconda prompt:

The first step is to install the dependencies:

conda install NumPy
conda install SciPy

Next, we can install scikit-learn by using the following code:

conda install scikit-learn

Additionally, if you already have scikit-learn installed with the Anaconda distribution, you can upgrade it to the latest version by using the following code in the Anaconda prompt:

conda update scikit-learn
When upgrading or uninstalling scikit-learn that has been installed with Anaconda, avoid using the pip method at all costs as doing so is most likely going to fail upgrading or removing all the required files. Stick with either the pip method or the Anaconda method in order to maintain consistency.

Additional packages

In this section, we will talk about the packages that we will be installing outside of scikit-learn that will be used throughout this book.

Pandas

To install Pandas, you can use either the pip method or the Anaconda method, as follows:

Pip method:

pip3 install pandas

Anaconda method:

conda install pandas

Matplotlib

To install matplotlib, you can use either the pip method or the Anaconda method, as follows:

Pip method:

pip3 install matplotlib

Anaconda method:

conda install matplotlib

Tree

To install tree, you can use either the pip method or the Anaconda method, as follows:

Pip method:

pip3 install tree

Anaconda method:

conda install tree

Pydotplus

To install pydotplus, you can use either the pip method or the Anaconda method, as follows:

Pip method:

pip3 install pydotplus

Anaconda method:

conda install pydotplus

Image

To install Image, you can use either the pip method or the Anaconda method, as follows:

Pip method:

pip3 install Image

Anaconda method:

conda install Image
You have been reading a chapter from
Machine Learning with scikit-learn Quick Start Guide
Published in: Oct 2018 Publisher: Packt ISBN-13: 9781789343700
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}