Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Python Machine Learning
Python Machine Learning

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

Arrow left icon
Profile Icon Sebastian Raschka Profile Icon Vahid Mirjalili
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (41 Ratings)
Paperback Dec 2019 772 pages 3rd Edition
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Sebastian Raschka Profile Icon Vahid Mirjalili
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (41 Ratings)
Paperback Dec 2019 772 pages 3rd Edition
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$29.99 $43.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Python Machine Learning

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 to 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 sophisticated 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 understanding of machine learning algorithms
  • Using pandas, NumPy, and Matplotlib to read in, process, and visualize data
  • ...

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

Before we discuss the perceptron and related algorithms in more detail, let's take a brief tour of the beginnings of machine learning. Trying to understand how the biological brain works, in order to design artificial intelligence (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). Biological 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:

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

Implementing a perceptron learning algorithm in Python

In the previous section, we learned how Rosenblatt's perceptron rule works; let's now 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 defining the perceptron interface as a Python class, which will allow 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 created upon the initialization of the object, but we do this by calling the object's other methods, for example, self.w_.

Additional resources for Python's scientific computing stack

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 (NN): ADAptive LInear NEuron (Adaline). Adaline was published by Bernard Widrow and his doctoral student Tedd Hoff only a few years after Rosenblatt's perceptron algorithm, and it can be considered an improvement on the latter (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 SGD.

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, which 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 vector...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Third edition of the bestselling, widely acclaimed Python machine learning book
  • Clear and intuitive explanations take you deep into the theory and practice of Python machine learning
  • Fully updated and expanded to cover TensorFlow 2, Generative Adversarial Network models, reinforcement learning, and best practices

Description

Python Machine Learning, Third Edition is a comprehensive guide to machine learning and deep learning with Python. It acts as both a step-by-step tutorial, and a reference you'll keep coming back to as you build your machine learning systems. Packed with clear explanations, visualizations, and working examples, the book covers all the essential machine learning techniques in depth. While some books teach you only to follow instructions, with this machine learning book, Raschka and Mirjalili teach the principles behind machine learning, allowing you to build models and applications for yourself. Updated for TensorFlow 2.0, this new third edition introduces readers to its new Keras API features, as well as the latest additions to scikit-learn. It's also expanded to cover cutting-edge reinforcement learning techniques based on deep learning, as well as an introduction to GANs. Finally, this book also explores a subfield of natural language processing (NLP) called sentiment analysis, helping you learn how to use machine learning algorithms to classify documents. This book is your companion to machine learning with Python, whether you're a Python developer new to machine learning or want to deepen your knowledge of the latest developments.

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 resource. Written for developers and data scientists who want to create practical machine learning and deep learning code, this book is ideal for anyone who wants to teach computers how to learn from data.

What you will learn

  • Master the frameworks, models, and techniques that enable machines to learn from data
  • Use scikit-learn for machine learning and TensorFlow for deep learning
  • Apply machine learning to image classification, sentiment analysis, intelligent web applications, and more
  • Build and train neural networks, GANs, and other models
  • Discover best practices for evaluating and tuning models
  • Predict continuous target outcomes using regression analysis
  • Dig deeper into textual and social media data using sentiment analysis

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 12, 2019
Length: 772 pages
Edition : 3rd
Language : English
ISBN-13 : 9781789955750
Vendor :
Google
Category :
Languages :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Dec 12, 2019
Length: 772 pages
Edition : 3rd
Language : English
ISBN-13 : 9781789955750
Vendor :
Google
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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
$279.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 $ 161.97
Advanced Deep Learning with Python
$48.99
Python Machine Learning
$54.99
Machine Learning for Algorithmic Trading
$57.99
Total $ 161.97 Stars icon

Table of Contents

20 Chapters
Giving Computers the Ability to Learn from Data Chevron down icon Chevron up icon
Training Simple Machine Learning Algorithms for Classification Chevron down icon Chevron up icon
A Tour of Machine Learning Classifiers Using scikit-learn Chevron down icon Chevron up icon
Building Good Training Datasets – Data Preprocessing Chevron down icon Chevron up icon
Compressing Data via Dimensionality Reduction Chevron down icon Chevron up icon
Learning Best Practices for Model Evaluation and Hyperparameter Tuning Chevron down icon Chevron up icon
Combining Different Models for Ensemble Learning Chevron down icon Chevron up icon
Applying Machine Learning to Sentiment Analysis Chevron down icon Chevron up icon
Embedding a Machine Learning Model into a Web Application Chevron down icon Chevron up icon
Predicting Continuous Target Variables with Regression Analysis Chevron down icon Chevron up icon
Working with Unlabeled Data – Clustering Analysis Chevron down icon Chevron up icon
Implementing a Multilayer Artificial Neural Network from Scratch Chevron down icon Chevron up icon
Parallelizing Neural Network Training with TensorFlow Chevron down icon Chevron up icon
Going Deeper – The Mechanics of TensorFlow Chevron down icon Chevron up icon
Classifying Images with Deep Convolutional Neural Networks Chevron down icon Chevron up icon
Modeling Sequential Data Using Recurrent Neural Networks Chevron down icon Chevron up icon
Generative Adversarial Networks for Synthesizing New Data Chevron down icon Chevron up icon
Reinforcement Learning for Decision Making in Complex Environments Chevron down icon Chevron up icon
Other Books You May Enjoy 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.5
(41 Ratings)
5 star 68.3%
4 star 19.5%
3 star 4.9%
2 star 4.9%
1 star 2.4%
Filter icon Filter
Top Reviews

Filter reviews by




THEODOROS ZAFEIRIDIS Jul 16, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
the best among many others
Feefo Verified review Feefo
Matthew Emerick Apr 20, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Disclaimer: The publisher asked me to review this book and gave me a review copy. I promise to be 100% honest in how I feel about this book, both the good and the less so.Overview:This book is for anyone with Python experience that in interested in learning about machine learning and artificial intelligence. It gives a wide range of experience for anyone that goes through the exercises, from the fundamentals to advanced TensorFlow, GANs, and reinforcement learning. By working through this book, the reader should know enough to join a machine learning team.What I Like:This book has a wonderful breadth and depth about it, and is structured very well. The very first chapter sets realistic expectations and how to get ready for the meat of the book. The second chapter follows quite well with the basics that the rest of the book is based on.Chapters four and five are great for preparing your data, which is required for the remaining chapters. Then comes a timely chapter on tuning your hyperparameters, which is essential for gaining the best results from your algorithm. Then come several chapters that go into detail on specific applications. Chapters thirteen and fourteen detail the use of TensorFlow, which is used in the remaining chapters.The final chapters go into more advanced applications of ML using the concepts already discussed in the book. This gives a little closure to the book, but I feel like it's missing something. Maybe a chapter listing ways to extend what you've already done, or sections of other concepts that were not discussed.What I Don't Like:One of the only things that I can really point out is that while chapter three works through classification algorithms (unsupervised learning), the following two chapters go through preparing your data which comes before using any of those clustering algorithms. The only way to look at it that make sense is to see chapter three giving you even more of a follow up introduction after the previous chapter before getting into more detail. It's probably not the path I would have gone, but I'm not the author. And, really, it's a small quibble.Chapter seven is also placed a little oddly, in that it's about ensemble learning, which is where you combine techniques, which haven't been taught yet, to get better results. I would have placed this at the end, which would have been a nice way to close out the book.There is also a section in chapter fourteen about migrating from the first version of TensorFlow to the second, which is an odd thing to have in a book that is introducing the reader to the library. Why not just stick with the newer version, which will be supported longer?What I Would Like to See:There is very little I would change in this book, other than a little more consistency with using the newest version of TensorFlow and a slight reorganization. I like the summaries at the end of the chapters. Project extension ideas would have been nice, as would add a chapter with a quick summary of important concepts that the authors didn't have time to go into. But otherwise, it's an excellent book.Overall, I give this book 4.6 out of 5 stars. I applaud the work done and look forward to more from the authors.
Amazon Verified review Amazon
acc_annon Dec 18, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Review of the drm-free pdf version sold by the publisher. One of the best practical books on the subject! Covering wide range of topics with concrete non-trivial practical examples, python code, data sets, and with enough-but-not-too-much theory and references to provide further insight and understanding. 750+ pages! Highly recommended.
Amazon Verified review Amazon
Puneet Apr 29, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Easy language book...
Amazon Verified review Amazon
B Apr 12, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
El libro cubre un amplio contenido en Machine Learning y Deep Learning, con explicaciones muy precisas de lo que se está haciendo en cada momento, es un libro muy bueno pero recomiendo tener algunas bases, lo recomiendo si quieres profundizar en el tema o si no has entendido del todo algunos fundamentos o bases, es perfecto para estudiantes y profesionales del sector, también habrá códigos que no funcionen 100% como en el libro y tendrás que adaptarlos o matizarlos, pues los paquetes han ido actualizándose y hay pequeños cambios, en cualquier caso, es fácil resolver cualquier problema que encuentres con los códigos si consultas en internet y en foros especializados.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.