Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Python Machine Learning, Second Edition
Python Machine Learning, Second Edition

Python Machine Learning, Second Edition: Machine Learning and Deep Learning with Python, scikit-learn, and TensorFlow , Second Edition

Arrow left icon
Profile Icon Sebastian Raschka Profile Icon Vahid Mirjalili
Arrow right icon
£7.99 £26.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (89 Ratings)
eBook Sep 2017 622 pages 2nd Edition
eBook
£7.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m
Arrow left icon
Profile Icon Sebastian Raschka Profile Icon Vahid Mirjalili
Arrow right icon
£7.99 £26.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (89 Ratings)
eBook Sep 2017 622 pages 2nd Edition
eBook
£7.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m
eBook
£7.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Python Machine Learning, Second Edition

Chapter 2. Training Simple Machine Learning Algorithms for Classification

In this chapter, we will make use of two of the first algorithmically described machine learning algorithms for classification, the perceptron and adaptive linear neurons. We will start by implementing a perceptron step by step in Python and training it to classify different flower species in the Iris dataset. This will help us understand the concept of machine learning algorithms for classification and how they can be efficiently implemented in Python.

Discussing the basics of optimization using adaptive linear neurons will then lay the groundwork for using more powerful classifiers via the scikit-learn machine learning library in Chapter 3, A Tour of Machine Learning Classifiers Using scikit-learn.

The topics that we will cover in this chapter are as follows:

  • Building an intuition for machine learning algorithms
  • Using pandas, NumPy, and Matplotlib to read in, process, and visualize data
  • Implementing linear...

Artificial neurons – a brief glimpse into the early history of machine learning

Before we discuss the perceptron and related algorithms in more detail, let us take a brief tour through the early beginnings of machine learning. Trying to understand how the biological brain works, in order to design AI, Warren McCulloch and Walter Pitts published the first concept of a simplified brain cell, the so-called McCulloch-Pitts (MCP) neuron, in 1943 (A Logical Calculus of the Ideas Immanent in Nervous Activity, W. S. McCulloch and W. Pitts, Bulletin of Mathematical Biophysics, 5(4): 115-133, 1943). Neurons are interconnected nerve cells in the brain that are involved in the processing and transmitting of chemical and electrical signals, which is illustrated in the following figure:

Artificial neurons – a brief glimpse into the early history of machine learning

McCulloch and Pitts described such a nerve cell as a simple logic gate with binary outputs; multiple signals arrive at the dendrites, are then integrated into the cell body, and, if the accumulated signal exceeds...

Implementing a perceptron learning algorithm in Python

In the previous section, we learned how the Rosenblatt's perceptron rule works; let us now go ahead and implement it in Python, and apply it to the Iris dataset that we introduced in Chapter 1, Giving Computers the Ability to Learn from Data.

An object-oriented perceptron API

We will take an object-oriented approach to define the perceptron interface as a Python class, which allows us to initialize new Perceptron objects that can learn from data via a fit method, and make predictions via a separate predict method. As a convention, we append an underscore (_) to attributes that are not being created upon the initialization of the object but by calling the object's other methods, for example, self.w_.

Note

If you are not yet familiar with Python's scientific libraries or need a refresher, please see the following resources:

Adaptive linear neurons and the convergence of learning

In this section, we will take a look at another type of single-layer neural network: ADAptive LInear NEuron (Adaline). Adaline was published by Bernard Widrow and his doctoral student Tedd Hoff, only a few years after Frank Rosenblatt's perceptron algorithm, and can be considered as an improvement on the latter. (Refer to An Adaptive "Adaline" Neuron Using Chemical "Memistors", Technical Report Number 1553-2, B. Widrow and others, Stanford Electron Labs, Stanford, CA, October 1960).

The Adaline algorithm is particularly interesting because it illustrates the key concepts of defining and minimizing continuous cost functions. This lays the groundwork for understanding more advanced machine learning algorithms for classification, such as logistic regression, support vector machines, and regression models, which we will discuss in future chapters.

The key difference between the Adaline rule (also known as the Widrow...

Summary

In this chapter, we gained a good understanding of the basic concepts of linear classifiers for supervised learning. After we implemented a perceptron, we saw how we can train adaptive linear neurons efficiently via a vectorized implementation of gradient descent and online learning via stochastic gradient descent.

Now that we have seen how to implement simple classifiers in Python, we are ready to move on to the next chapter, where we will use the Python scikit-learn machine learning library to get access to more advanced and powerful machine learning classifiers that are commonly used in academia as well as in industry. The object-oriented approach that we used to implement the perceptron and Adaline algorithms will help with understanding the scikit-learn API, which is implemented based on the same core concepts that we used in this chapter: the fit and predict methods. Based on these core concepts, we will learn about logistic regression for modeling class probabilities and support...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Second edition of the bestselling book on Machine Learning
  • A practical approach to key frameworks in data science, machine learning, and deep learning
  • Use the most powerful Python libraries to implement machine learning and deep learning
  • Get to know the best practices to improve and optimize your machine learning systems and algorithms

Description

Publisher's Note: This edition from 2017 is outdated and is not compatible with TensorFlow 2 or any of the most recent updates to Python libraries. A new third edition, updated for 2020 and featuring TensorFlow 2 and the latest in scikit-learn, reinforcement learning, and GANs, has now been published. Machine learning is eating the software world, and now deep learning is extending machine learning. Understand and work at the cutting edge of machine learning, neural networks, and deep learning with this second edition of Sebastian Raschka’s bestselling book, Python Machine Learning. Using Python's open source libraries, this book offers the practical knowledge and techniques you need to create and contribute to machine learning, deep learning, and modern data analysis. Fully extended and modernized, Python Machine Learning Second Edition now includes the popular TensorFlow 1.x deep learning library. The scikit-learn code has also been fully updated to v0.18.1 to include improvements and additions to this versatile machine learning library. Sebastian Raschka and Vahid Mirjalili’s unique insight and expertise introduce you to machine learning and deep learning algorithms from scratch, and show you how to apply them to practical industry challenges using realistic and interesting examples. By the end of the book, you’ll be ready to meet the new data analysis opportunities. If you’ve read the first edition of this book, you’ll be delighted to find a balance of classical ideas and modern insights into machine learning. Every chapter has been critically updated, and there are new chapters on key technologies. You’ll be able to learn and work with TensorFlow 1.x more deeply than ever before, and get essential coverage of the Keras neural network library, along with updates to scikit-learn 0.18.1.

Who is this book for?

If you know some Python and you want to use machine learning and deep learning, pick up this book. Whether you want to start from scratch or extend your machine learning knowledge, this is an essential and unmissable resource. Written for developers and data scientists who want to create practical machine learning and deep learning code, this book is ideal for developers and data scientists who want to teach computers how to learn from data.

What you will learn

  • Understand the key frameworks in data science, machine learning, and deep learning
  • Harness the power of the latest Python open source libraries in machine learning
  • Explore machine learning techniques using challenging real-world data
  • Master deep neural network implementation using the TensorFlow 1.x library
  • Learn the mechanics of classification algorithms to implement the best tool for the job
  • Predict continuous target outcomes using regression analysis
  • Uncover hidden patterns and structures in data with clustering
  • Delve deeper into textual and social media data using sentiment analysis

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 20, 2017
Length: 622 pages
Edition : 2nd
Language : English
ISBN-13 : 9781787126022
Vendor :
Google
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 20, 2017
Length: 622 pages
Edition : 2nd
Language : English
ISBN-13 : 9781787126022
Vendor :
Google
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
£169.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts
£234.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total £ 116.97
Artificial Intelligence with Python
£41.99
Python Machine Learning, Second Edition
£32.99
Statistics for Machine Learning
£41.99
Total £ 116.97 Stars icon
Banner background image

Table of Contents

17 Chapters
1. Giving Computers the Ability to Learn from Data Chevron down icon Chevron up icon
2. Training Simple Machine Learning Algorithms for Classification Chevron down icon Chevron up icon
3. A Tour of Machine Learning Classifiers Using scikit-learn Chevron down icon Chevron up icon
4. Building Good Training Sets – Data Preprocessing Chevron down icon Chevron up icon
5. Compressing Data via Dimensionality Reduction Chevron down icon Chevron up icon
6. Learning Best Practices for Model Evaluation and Hyperparameter Tuning Chevron down icon Chevron up icon
7. Combining Different Models for Ensemble Learning Chevron down icon Chevron up icon
8. Applying Machine Learning to Sentiment Analysis Chevron down icon Chevron up icon
9. Embedding a Machine Learning Model into a Web Application Chevron down icon Chevron up icon
10. Predicting Continuous Target Variables with Regression Analysis Chevron down icon Chevron up icon
11. Working with Unlabeled Data – Clustering Analysis Chevron down icon Chevron up icon
12. Implementing a Multilayer Artificial Neural Network from Scratch Chevron down icon Chevron up icon
13. Parallelizing Neural Network Training with TensorFlow Chevron down icon Chevron up icon
14. Going Deeper – The Mechanics of TensorFlow Chevron down icon Chevron up icon
15. Classifying Images with Deep Convolutional Neural Networks Chevron down icon Chevron up icon
16. Modeling Sequential Data Using Recurrent Neural Networks Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(89 Ratings)
5 star 67.4%
4 star 14.6%
3 star 7.9%
2 star 2.2%
1 star 7.9%
Filter icon Filter
Top Reviews

Filter reviews by




VISA Nov 30, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book! Presenting the machine learning algorithms and some of the elements of the linked theory, altogether with Python code is really useful.
Amazon Verified review Amazon
sipy Aug 14, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book will stay on your reference shelf for years to come!The authors clearly have taught these materials many times before, and their significant mathematical and technical prowess is delivered using a very approachable style. This book seems best suited for someone who wants to sit down and begin to apply Python Machine Learning to a problem that they already know they have. It's not particularly an "intro course to M.L.", but it contains enough details that you could easily follow along and learn how to use the various tools and techniques of the field if you've never seen or heard of them before.The copious notes scattered throughout this book are pure gold, mined from the obvious experiences of the authors while working in the field. If there ever is a Machine Learning equivalent to the venerable "Forrest M. Mims Engineering Notebook" for electronics, I feel these two authors could write it!Once you use this book to work on your current M.L. problem in Python, you will find yourself returning to it as a reference for other problems in the M.L. space. Its lucid explanations will help reinforce the topics presented, and cement your understanding of the materials.This book will get you writing Python Machine Learning code to work your current M.L. problem in no time flat!
Amazon Verified review Amazon
Dave May 20, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It is the best book on Machine Learning using python. Algorithms are well explained. Suitable for beginners though you need to know some calculus.
Amazon Verified review Amazon
Bio620 Mar 17, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very interesting book
Amazon Verified review Amazon
Jano Aug 08, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very steep learning curve.I almost gave up in chapter two at perceptron but since that algorithm is the foundation of all I spent a whole week to understand it. The code the author uses is pretty much optimized and it was not in sync with the mathematical introduction. But the first 30 pages are absolutely neccessary to read and understand deeply in order to move on.After page 30 it became a little faster to proceed with the book since topics from page 30 - 107 are mostly the extension of the perceptron. At page 107- 160 I am already accustomedto the authors style and to the books logic so it is now quite effective to read and digest the models.And that is where I am at the moment. I gave this book 5 stars since I wanted a high quality ML and python book which leads me through the models in a step-by-step way no matter how hard it is mathematically or programmtechnically. And I got this.negative:The pdf version has color pictures which is nice especially for multiline charts ( like page 212) where the b&w book just visually flat and some chart elements cannot be identified.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.