Book Image

Python Machine Learning (Wiley)

By : Wei-Meng Lee
Book Image

Python Machine Learning (Wiley)

By: Wei-Meng Lee

Overview of this book

With computing power increasing exponentially and costs decreasing at the same time, this is the best time to learn machine learning using Python. Machine learning tasks that once required enormous processing power are now possible on desktop machines. Python Machine Learning begins by covering some fundamental libraries used in Python that make machine learning possible. You'll learn how to manipulate arrays of numbers with NumPy and use pandas to deal with tabular data. Once you have a firm foundation in the basics, you'll explore machine learning using Python and the scikit-learn libraries. You'll learn how to visualize data by plotting different types of charts and graphs using the matplotlib library. You'll gain a solid understanding of how the various machine learning algorithms work behind the scenes. The later chapters explore the common machine learning algorithms, such as regression, clustering, and classification, and discuss how to deploy the models that you have built, so that they can be used by client applications running on mobile and desktop devices. By the end of the book, you'll have all the knowledge you need to begin machine learning using Python.
Table of Contents (16 chapters)
Free Chapter
1
Cover
2
Introduction
11
CHAPTER 9: Supervised Learning—Classification Using K‐Nearest Neighbors (KNN)
15
Index
16
End User License Agreement

Plotting Using Seaborn

While matplotlib allows you to plot a lot of interesting charts, it takes a bit of effort to get the chart that you want. This is especially true if you are dealing with a large amount of data and would like to examine the relationships between multiple variables.

Introducing Seaborn, a complementary plotting library that is based on the matplotlib data visualization library. Seaborn's strength lies in its ability to make statistical graphics in Python, and it is closely integrated with the Pandas data structure (covered in Chapter 3). Seaborn provides high‐level abstractions to allow you to build complex visualizations for your data easily. In short, you write less code with Seaborn than with matplotlib, while at the same time you get more sophisticated charts.

Displaying Categorical Plots

The first example that you will plot is called a categorical plot (formerly known as a factorplot). It is useful in cases when you want to plot the distribution...