To get the most out of this book
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Download the example code files
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at http://www.packt.com.
- Select the Support tab.
- Click on Code Downloads.
- Enter the name of the book in the Search box and follow the on-screen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
Alternatively, if you have obtained a copy of the book from elsewhere or do not wish to create an account at Packt, all code examples are also available for download through GitHub at https://github.com/rasbt/python-machine-learning-book-3rd-edition.
All code in this book is also available in the form of Jupyter notebooks, and a short introduction can be found in the code directory of Chapter 1, Giving Computers the Ability to Learn from Data, at https://github.com/rasbt/python-machine-learning-book-3rd-edition/tree/master/ch01#pythonjupyter-notebook. For more information about the general Jupyter Notebook GUI, please see the official documentation at https://jupyter-notebook.readthedocs.io/en/stable/.
While we recommend using Jupyter Notebook for executing code interactively, all code examples are available in both a Python script (for example, ch02/ch02.py
) and a Jupyter Notebook format (for example, ch02/ch02.ipynb
). Furthermore, we recommend that you view the README.md
file that accompanies each individual chapter for additional information and updates (for example, https://github.com/rasbt/python-machine-learning-book-3rd-edition/blob/master/ch01/README.md).
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you to better understand the changes in the output. You can download this file from https://static.packt-cdn.com/downloads/9781789955750_ColorImages.pdf. In addition, lower resolution color images are embedded in the code notebooks of this book that come bundled with the example code files.
Conventions used
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text are shown as follows: "And already installed packages can be updated via the --upgrade
flag."
A block of code is set as follows:
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> y = df.iloc[0:100, 4].values
>>> y = np.where(y == 'Iris-setosa', -1, 1)
>>> X = df.iloc[0:100, [0, 2]].values
>>> plt.scatter(X[:50, 0], X[:50, 1],
... color='red', marker='x', label='setosa')
>>> plt.scatter(X[50:100, 0], X[50:100, 1],
... color='blue', marker='o', label='versicolor')
>>> plt.xlabel('sepal length')
>>> plt.ylabel('petal length')
>>> plt.legend(loc='upper left')
>>> plt.show()
Any command-line input or output is written as follows:
> dot -Tpng tree.dot -o tree.png
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.