Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with scikit-learn Quick Start Guide

You're reading from   Machine Learning with scikit-learn Quick Start Guide Classification, regression, and clustering techniques in Python

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781789343700
Length 172 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Kevin Jolly Kevin Jolly
Author Profile Icon Kevin Jolly
Kevin Jolly
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Introducing Machine Learning with scikit-learn 2. Predicting Categories with K-Nearest Neighbors FREE CHAPTER 3. Predicting Categories with Logistic Regression 4. Predicting Categories with Naive Bayes and SVMs 5. Predicting Numeric Outcomes with Linear Regression 6. Classification and Regression with Trees 7. Clustering Data with Unsupervised Machine Learning 8. Performance Evaluation Methods 9. 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
lock icon The rest of the chapter is locked
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 R$50/month. Cancel anytime