Neural Network Projects with Python
eBook - ePub

Neural Network Projects with Python

The ultimate guide to using Python to explore the true power of neural networks through six projects

James Loy

  1. 308 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Neural Network Projects with Python

The ultimate guide to using Python to explore the true power of neural networks through six projects

James Loy

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Build your Machine Learning portfolio by creating 6 cutting-edge Artificial Intelligence projects using neural networks in Python

Key Features

  • Discover neural network architectures (like CNN and LSTM) that are driving recent advancements in AI
  • Build expert neural networks in Python using popular libraries such as Keras
  • Includes projects such as object detection, face identification, sentiment analysis, and more

Book Description

Neural networks are at the core of recent AI advances, providing some of the best resolutions to many real-world problems, including image recognition, medical diagnosis, text analysis, and more. This book goes through some basic neural network and deep learning concepts, as well as some popular libraries in Python for implementing them.

It contains practical demonstrations of neural networks in domains such as fare prediction, image classification, sentiment analysis, and more. In each case, the book provides a problem statement, the specific neural network architecture required to tackle that problem, the reasoning behind the algorithm used, and the associated Python code to implement the solution from scratch. In the process, you will gain hands-on experience with using popular Python libraries such as Keras to build and train your own neural networks from scratch.

By the end of this book, you will have mastered the different neural network architectures and created cutting-edge AI projects in Python that will immediately strengthen your machine learning portfolio.

What you will learn

  • Learn various neural network architectures and its advancements in AI
  • Master deep learning in Python by building and training neural network
  • Master neural networks for regression and classification
  • Discover convolutional neural networks for image recognition
  • Learn sentiment analysis on textual data using Long Short-Term Memory
  • Build and train a highly accurate facial recognition security system

Who this book is for

This book is a perfect match for data scientists, machine learning engineers, and deep learning enthusiasts who wish to create practical neural network projects in Python. Readers should already have some basic knowledge of machine learning and neural networks.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Neural Network Projects with Python è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Neural Network Projects with Python di James Loy in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Artificial Intelligence (AI) & Semantics. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2019
ISBN
9781789133318

Sentiment Analysis of Movie Reviews Using LSTM

In previous chapters, we looked at neural network architectures, such as the basic MLP and feedforward neural networks, for classification and regression tasks. We then looked at CNNs, and we saw how they are used for image recognition tasks. In this chapter, we will turn our attention to recurrent neural networks (RNNs) (in particular, to long short-term memory (LSTM) networks) and how they can be used in sequential problems, such as Natural Language Processing (NLP). We will develop and train a LSTM network to predict the sentiment of movie reviews on IMDb.
In this chapter, we'll cover the following topics:
  • Sequential problems in machine learning
  • NLP and sentiment analysis
  • Introduction to RNNs and LSTM networks
  • Analysis of the IMDb movie reviews dataset
  • Word embeddings
  • A step-by-step guide to building and training an LSTM network in Keras
  • Analysis of our results

Technical requirements

The Python libraries required for this chapter are as follows:
  • matplotlib 3.0.2
  • Keras 2.2.4
  • seaborn 0.9.0
  • scikit-learn 0.20.2
The code for this chapter can be found in the GitHub repository for the book.
To download the code onto your computer, you may run the following git clone command:
$ git clone https://github.com/PacktPublishing/Neural-Network-Projects-with-Python.git
After the process is complete, there will be a folder entitled Neural-Network-Projects-with-Python. Enter the folder by running the following:
$ cd Neural-Network-Projects-with-Python
To install the required Python libraries in a virtual environment, run the following command:
$ conda env create -f environment.yml
Note that you should have installed Anaconda on your computer first, before running this command. To enter the virtual environment, run the following command:
$ conda activate neural-network-projects-python
Navigate to the Chapter06 folder by running the following command:
$ cd Chapter06
The following file is located in the folder:
  • lstm.py: This is the main code for this chapter
To run the code, simply execute the lstm.py file:
$ python lstm.py

Sequential problems in machine learning

Sequential problems are a class of problem in machine learning in which the order of the features presented to the model is important for making predictions. Sequential problems are commonly encountered in the following scenarios:
  • NLP, including sentiment analysis, language translation, and text prediction
  • Time series predictions
For example, let's consider the text prediction problem, as shown in the following screenshot, which falls under NLP:
Human beings have an innate ability for this, and it is trivial for us to know that the word in the blank is probably the word Japanese. The reason for this is that as we read the sentence, we process the words as a sequence. The sequence of the words captures the information required to make the prediction. By contrast, if we discard the sequential information and only consider the words individually, we get a bag of words, as shown in the following diagram:
We can see that our ability to predict the word in the blank is now severely impacted. Without knowing the sequence of words, it is impossible to predict the word in the blank.
Besides text predictions, sentiment analysis and language translation are also sequential problems. In fact, many NLP problems are sequential problems, because the languages that we speak are sequential in nature, and the sequence conveys context and other subtle nuances.
Sequential problems also occur naturally in time series problems. Time series problems are common in stock markets. Often, we wish to know whether a particular stock will rise or fall on a certain day. This problem is accurately defined as a time series problem, because knowing the movement of the stocks in the preceding hours or minutes is often crucial to predicting whether the stock will rise or fall. Today, machine learning methods are being heavily applied in this domain, with algorithmic trading strategies driving the buying and selling of stocks.
In this chapter, we will focus on NLP problems. In particular, we will create a neural network for sentiment analysis.

NLP and sentiment analysis

NLP is a subfield in artificial intelligence (AI) that is concerned with the interaction of computers and human languages. As early as the 1950s, scientists were interested in designing intelligent machines that could understand human languages. Early efforts to create a language translator focused on the rule-based approach, where a group of linguistic experts handcrafted a set of rules to be encoded in machines. However, this rule-based approach produced results that were sub-optimal, and, often, it was impossible to convert these rules from one language to another, which meant that scaling up was difficult. For many decades, not much progress was made in NLP, and human language was a goal that AI couldn't reach—until the resurgence of deep learning.
With the proliferation of deep learning and neural networks in the image classification domain, scientists began to wonder whether the powers of neural networks could be applied to NLP. In the late '00s, tech giants, including Apple, Amazon, and Google, applied LSTM networks to NLP problems, and the results were astonishing. The ability of AI assistants, such as Siri and Alexa, to understand multiple languages spoken in different accents was the result of deep learning and LSTM networks. In recent years, we have also seen a massive improvement in the abilities of text translation software, such as Google Translate, which is capable of producing translations as good as human language experts.
Sentiment analysis is also an area of NLP that benefited from the resurgence of deep learning. Sentiment analysis is defined as the prediction of the positivity of a text. Most sentiment analysis problems are classification problems (positive/neutral/negative) and not regression problems.
There are many practical applications of sentiment analysis. For example, modern customer service centers use sentiment analysis to predict the satisfaction of customers through the reviews they provide on platforms such as Ye...

Indice dei contenuti

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Contributors
  6. Preface
  7. Machine Learning and Neural Networks 101
  8. Predicting Diabetes with Multilayer Perceptrons
  9. Predicting Taxi Fares with Deep Feedforward Networks
  10. Cats Versus Dogs - Image Classification Using CNNs
  11. Removing Noise from Images Using Autoencoders
  12. Sentiment Analysis of Movie Reviews Using LSTM
  13. Implementing a Facial Recognition System with Neural Networks
  14. What's Next?
  15. Other Books You May Enjoy
Stili delle citazioni per Neural Network Projects with Python

APA 6 Citation

Loy, J. (2019). Neural Network Projects with Python (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/921350/neural-network-projects-with-python-the-ultimate-guide-to-using-python-to-explore-the-true-power-of-neural-networks-through-six-projects-pdf (Original work published 2019)

Chicago Citation

Loy, James. (2019) 2019. Neural Network Projects with Python. 1st ed. Packt Publishing. https://www.perlego.com/book/921350/neural-network-projects-with-python-the-ultimate-guide-to-using-python-to-explore-the-true-power-of-neural-networks-through-six-projects-pdf.

Harvard Citation

Loy, J. (2019) Neural Network Projects with Python. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/921350/neural-network-projects-with-python-the-ultimate-guide-to-using-python-to-explore-the-true-power-of-neural-networks-through-six-projects-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Loy, James. Neural Network Projects with Python. 1st ed. Packt Publishing, 2019. Web. 14 Oct. 2022.