Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On Natural Language Processing with PyTorch 1.x
Hands-On Natural Language Processing with PyTorch 1.x

Hands-On Natural Language Processing with PyTorch 1.x: Build smart, AI-driven linguistic applications using deep learning and NLP techniques

By Thomas Dop
S$47.99 S$32.99
Book Jul 2020 276 pages 1st Edition
eBook
S$47.99 S$32.99
Print
S$59.99
Subscription
Free Trial
eBook
S$47.99 S$32.99
Print
S$59.99
Subscription
Free Trial

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
Buy Now

Product Details


Publication date : Jul 9, 2020
Length 276 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781789802740
Category :
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Natural Language Processing with PyTorch 1.x

Chapter 1: Fundamentals of Machine Learning and Deep Learning

Our world is rich with natural language data. Over the past several decades, the way we communicate with one another has shifted to the digital realm and, as such, this data can be used to build models that can improve our online experience. From returning relevant results within a search engine, to autocompleting the next word you type in an email, the benefits of being able to extract insights from natural language is clear to see.

While the way we, as humans, understand language differs notably from the way a model or artificial intelligence may understand it, by shedding light on machine learning and what it is used for, we can begin to understand just how these deep learning models understand language and what fundamentally happens when a model learns from data.

Throughout this book, we will explore this application of artificial intelligence and deep learning to natural language. Through the use of PyTorch,...

Overview of machine learning

Fundamentally, machine learning is the algorithmic process used to identify patterns and extract trends from data. By training specific machine learning algorithms on data, a machine learning model may learn insights that aren't immediately obvious to the human eye. A medical imaging model may learn to detect cancer from images of the human body, while a sentiment analysis model may learn that a book review containing the words good, excellent, and entertaining is more likely to be a positive review than one containing the words bad, terrible, and boring.

Broadly speaking, machine learning algorithms fall into two main categories: supervised learning and unsupervised learning.

Supervised learning

Supervised learning covers any task where we wish to use an input to predict an output. Let's say we wish to train a model to predict house prices. We know that larger houses tend to sell for more money, but we don't know the exact...

Neural networks

In our previous examples, we have discussed mainly regressions in the form . We have touched on using polynomials to fit more complex equations such as . However, as we add more features to our model, when to use a transformation of the original feature becomes a case of trial and error. Using neural networks, we are able to fit a much more complex function, y = f(X), to our data, without the need to engineer or transform our existing features. 

Structure of neural networks

When we were learning the optimal value of , which minimized loss in our regressions, this is effectively the same as a one-layer neural network:

Figure 1.10 – One-layer neural network

Here, we take each of our features, , as an input, illustrated here by a node. We wish to learn the parameters, , which are represented as connections in this diagram. Our final sum of all the products between and gives us our final prediction, y:

A neural network...

NLP for machine learning

Unlike humans, computers do not understand text – at least not in the same way that we do. In order to create machine learning models that are able to learn from data, we must first learn to represent natural language in a way that computers are able to process.

When we discussed machine learning fundamentals, you may have noticed that loss functions all deal with numerical data so as to be able to minimize loss. Because of this, we wish to represent our text in a numerical format that can form the basis of our input into a neural network. Here, we will cover a couple of basic ways of numerically representing our data. 

Bag-of-words

The first and most simple way of representing text is by using a bag-of-words representation. This method simply counts the words in a given sentence or document and counts all the words. These counts are then transformed into a vector where each element of the vector is the count of the times each word in the...

Summary

In this chapter, we introduced the fundamentals of machine learning and neural networks, as well as a brief overview of transforming text for use within these models. In the next chapter, we will provide a brief overview of PyTorch and how it can be used to construct some of these models.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get to grips with word embeddings, semantics, labeling, and high-level word representations using practical examples
  • Learn modern approaches to NLP and explore state-of-the-art NLP models using PyTorch
  • Improve your NLP applications with innovative neural networks such as RNNs, LSTMs, and CNNs

Description

In the internet age, where an increasing volume of text data is generated daily from social media and other platforms, being able to make sense of that data is a crucial skill. With this book, you’ll learn how to extract valuable insights from text by building deep learning models for natural language processing (NLP) tasks. Starting by understanding how to install PyTorch and using CUDA to accelerate the processing speed, you’ll explore how the NLP architecture works with the help of practical examples. This PyTorch NLP book will guide you through core concepts such as word embeddings, CBOW, and tokenization in PyTorch. You’ll then learn techniques for processing textual data and see how deep learning can be used for NLP tasks. The book demonstrates how to implement deep learning and neural network architectures to build models that will allow you to classify and translate text and perform sentiment analysis. Finally, you’ll learn how to build advanced NLP models, such as conversational chatbots. By the end of this book, you’ll not only have understood the different NLP problems that can be solved using deep learning with PyTorch, but also be able to build models to solve them.

What you will learn

Use NLP techniques for understanding, processing, and generating text Understand PyTorch, its applications and how it can be used to build deep linguistic models Explore the wide variety of deep learning architectures for NLP Develop the skills you need to process and represent both structured and unstructured NLP data Become well-versed with state-of-the-art technologies and exciting new developments in the NLP domain Create chatbots using attention-based neural networks

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
Buy Now

Product Details


Publication date : Jul 9, 2020
Length 276 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781789802740
Category :

Table of Contents

14 Chapters
Preface Chevron down icon Chevron up icon
Section 1: Essentials of PyTorch 1.x for NLP Chevron down icon Chevron up icon
Chapter 1: Fundamentals of Machine Learning and Deep Learning Chevron down icon Chevron up icon
Chapter 2: Getting Started with PyTorch 1.x for NLP Chevron down icon Chevron up icon
Section 2: Fundamentals of Natural Language Processing Chevron down icon Chevron up icon
Chapter 3: NLP and Text Embeddings Chevron down icon Chevron up icon
Chapter 4: Text Preprocessing, Stemming, and Lemmatization Chevron down icon Chevron up icon
Section 3: Real-World NLP Applications Using PyTorch 1.x Chevron down icon Chevron up icon
Chapter 5: Recurrent Neural Networks and Sentiment Analysis Chevron down icon Chevron up icon
Chapter 6: Convolutional Neural Networks for Text Classification Chevron down icon Chevron up icon
Chapter 7: Text Translation Using Sequence-to-Sequence Neural Networks Chevron down icon Chevron up icon
Chapter 8: Building a Chatbot Using Attention-Based Neural Networks Chevron down icon Chevron up icon
Chapter 9: The Road Ahead Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
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.