Building Machine Learning Systems with Python
eBook - ePub

Building Machine Learning Systems with Python

Explore machine learning and deep learning techniques for building intelligent systems using scikit-learn and TensorFlow, 3rd Edition

Luis Pedro Coelho, Willi Richert, Matthieu Brucher

  1. 406 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Building Machine Learning Systems with Python

Explore machine learning and deep learning techniques for building intelligent systems using scikit-learn and TensorFlow, 3rd Edition

Luis Pedro Coelho, Willi Richert, Matthieu Brucher

Book details
Book preview
Table of contents
Citations

About This Book

Get more from your data by creating practical machine learning systems with Python

Key Features

  • Develop your own Python-based machine learning system
  • Discover how Python offers multiple algorithms for modern machine learning systems
  • Explore key Python machine learning libraries to implement in your projects

Book Description

Machine learning allows systems to learn things without being explicitly programmed to do so. Python is one of the most popular languages used to develop machine learning applications, which take advantage of its extensive library support. This third edition of Building Machine Learning Systems with Python addresses recent developments in the field by covering the most-used datasets and libraries to help you build practical machine learning systems.

Using machine learning to gain deeper insights from data is a key skill required by modern application developers and analysts alike. Python, being a dynamic language, allows for fast exploration and experimentation. This book shows you exactly how to find patterns in your raw data. You will start by brushing up on your Python machine learning knowledge and being introduced to libraries. You'll quickly get to grips with serious, real-world projects on datasets, using modeling and creating recommendation systems. With Building Machine Learning Systems with Python, you'll gain the tools and understanding required to build your own systems, all tailored to solve real-world data analysis problems.

By the end of this book, you will be able to build machine learning systems using techniques and methodologies such as classification, sentiment analysis, computer vision, reinforcement learning, and neural networks.

What you will learn

  • Build a classification system that can be applied to text, images, and sound
  • Employ Amazon Web Services (AWS) to run analysis on the cloud
  • Solve problems related to regression using scikit-learn and TensorFlow
  • Recommend products to users based on their past purchases
  • Understand different ways to apply deep neural networks on structured data
  • Address recent developments in the field of computer vision and reinforcement learning

Who this book is for

Building Machine Learning Systems with Python is for data scientists, machine learning developers, and Python developers who want to learn how to build increasingly complex machine learning systems. You will use Python's machine learning capabilities to develop effective solutions. Prior knowledge of Python programming is expected.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Building Machine Learning Systems with Python an online PDF/ePUB?
Yes, you can access Building Machine Learning Systems with Python by Luis Pedro Coelho, Willi Richert, Matthieu Brucher in PDF and/or ePUB format, as well as other popular books in Computer Science & Data Modelling & Design. We have over one million books available in our catalogue for you to explore.

Information

Year
2018
ISBN
9781788622226
Edition
3

Classification II – Sentiment Analysis

For companies, it is vital to closely monitor the public reception of key events, such as product launches or press releases. With real-time access and easy accessibility of user-generated content on Twitter, it is now possible to do sentiment classification of tweets. Sometimes also called opinion mining, it is an active field of research in which several companies are already selling such services. As this shows that there obviously exists a market, we are motivated to use our classification muscles built in the last chapter to build our own home-grown sentiment classifier.

Sketching our roadmap

Sentiment analysis of tweets is particularly hard, because of Twitter's size limitation per message. This leads to a special syntax, creative abbreviations, and seldom-well-formed sentences. The typical approach of analyzing sentences, aggregating their sentiment information per paragraph, and then calculating the overall sentiment of a document does not work here.
Clearly, we will not try to build a state-of-the-art sentiment classifier. Instead, we want to do the following:
  • Use this scenario as a vehicle to introduce yet another classification algorithm, Naïve Bayes
  • Explain how Part Of Speech (POS) tagging works and how it can help us
  • Show some more tricks from the scikit-learn toolbox that can come in handy

Fetching the Twitter data

Naturally, we need tweets and their corresponding labels that describe sentiments. In this chapter, we will use the corpus from Niek Sanders, who has done an awesome job of manually labeling more than 5,000 tweets as positive, negative, or neutral and has granted us permission to use it in this chapter.
To comply with Twitter terms of services, we will not provide any data from Twitter nor show any real tweets in this chapter. Instead, we can use Sander's hand-labeled data, which contains the tweet IDs and their hand-labeled sentiments. We will use Twitter's API to fetch the corresponding tweets one by one. To not bore you too much, just execute the first part of the corresponding Jupyter notebook, which will start the downloading process. In order to play nicely with Twitter's servers, it will take quite some time to download all the data for more than 5,000 tweets, which means it is a good idea to start it right away.
The data comes with four sentiment labels, which are returned by load_sanders_data():
>>> X_orig, Y_orig = load_sanders_data()
>>> classes = np.unique(Y_orig)
>>> for c in classes: print("#%s: %i" % (c, sum(Y_orig == c)))
#irrelevant: 437 #negative: 448 #neutral: 1801 #positive: 391
Inside load_sanders_data(), we are treating irrelevant and neutral labels together as neutral, and dropping all non-English tweets, resulting in 3,077 tweets.
In case you get different counts here, it is because, in the meantime, tweets might have been deleted or set to be private. In that case, you might also get slightly different numbers and graphs than the ones shown in the upcoming sections.

Introducing the Naïve Bayes classifier

Naïve Bayes is probably one of the most elegant machine learning algorithms out there that is of practical use. And despite its name, it is not that naïve when you look at its classification performance. It proves to be quite robust to irrelevant features, which it kindly ignores. It learns fast and predicts equally so. It does not require lots of storage. So, why is it called naïve?
The Naïve was added to account for one assumption that is required for Naïve Bayes to work optimally. The assumption is that the features are uncorrelated. This, however, is rarely the case for real-world applications. Nevertheless, it still returns very good accuracy in practice, even when the independence assumption does not hold.

Getting to know the Bayes theorem

At its core, the Naïve Bayes classification is nothing more than keeping track of whi...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Contributors
  5. Preface
  6. Getting Started with Python Machine Learning
  7. Classifying with Real-World Examples
  8. Regression
  9. Classification I – Detecting Poor Answers
  10. Dimensionality Reduction
  11. Clustering – Finding Related Posts
  12. Recommendations
  13. Artificial Neural Networks and Deep Learning
  14. Classification II – Sentiment Analysis
  15. Topic Modeling
  16. Classification III – Music Genre Classification
  17. Computer Vision
  18. Reinforcement Learning
  19. Bigger Data
  20. Where to Learn More About Machine Learning
  21. Other Books You May Enjoy
Citation styles for Building Machine Learning Systems with Python

APA 6 Citation

Coelho, L. P., Richert, W., & Brucher, M. (2018). Building Machine Learning Systems with Python (3rd ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/778142/building-machine-learning-systems-with-python-explore-machine-learning-and-deep-learning-techniques-for-building-intelligent-systems-using-scikitlearn-and-tensorflow-3rd-edition-pdf (Original work published 2018)

Chicago Citation

Coelho, Luis Pedro, Wilhelm Richert, and Matthieu Brucher. (2018) 2018. Building Machine Learning Systems with Python. 3rd ed. Packt Publishing. https://www.perlego.com/book/778142/building-machine-learning-systems-with-python-explore-machine-learning-and-deep-learning-techniques-for-building-intelligent-systems-using-scikitlearn-and-tensorflow-3rd-edition-pdf.

Harvard Citation

Coelho, L. P., Richert, W. and Brucher, M. (2018) Building Machine Learning Systems with Python. 3rd edn. Packt Publishing. Available at: https://www.perlego.com/book/778142/building-machine-learning-systems-with-python-explore-machine-learning-and-deep-learning-techniques-for-building-intelligent-systems-using-scikitlearn-and-tensorflow-3rd-edition-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Coelho, Luis Pedro, Wilhelm Richert, and Matthieu Brucher. Building Machine Learning Systems with Python. 3rd ed. Packt Publishing, 2018. Web. 14 Oct. 2022.