All Projects → bentrevett → Pytorch Sentiment Analysis

bentrevett / Pytorch Sentiment Analysis

Licence: mit
Tutorials on getting started with PyTorch and TorchText for sentiment analysis.

Programming Languages

Jupyter Notebook
11667 projects

Projects that are alternatives of or similar to Pytorch Sentiment Analysis

Pytorch Pos Tagging
A tutorial on how to implement models for part-of-speech tagging using PyTorch and TorchText.
Stars: ✭ 96 (-97.01%)
Mutual labels:  jupyter-notebook, tutorial, pytorch-tutorial, pytorch-tutorials, natural-language-processing, cnn, lstm, rnn, recurrent-neural-networks
Pytorch Seq2seq
Tutorials on implementing a few sequence-to-sequence (seq2seq) models with PyTorch and TorchText.
Stars: ✭ 3,418 (+6.51%)
Mutual labels:  jupyter-notebook, tutorial, pytorch-tutorial, pytorch-tutorials, lstm, rnn, pytorch-nlp, torchtext
Neural Networks
All about Neural Networks!
Stars: ✭ 34 (-98.94%)
Mutual labels:  jupyter-notebook, cnn, lstm, rnn, sentiment-analysis, fasttext
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-96.98%)
Mutual labels:  jupyter-notebook, pytorch-tutorial, cnn, lstm, rnn, recurrent-neural-networks
End To End Sequence Labeling Via Bi Directional Lstm Cnns Crf Tutorial
Tutorial for End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF
Stars: ✭ 87 (-97.29%)
Mutual labels:  jupyter-notebook, tutorial, pytorch-tutorial, cnn, lstm
Machine Learning
My Attempt(s) In The World Of ML/DL....
Stars: ✭ 78 (-97.57%)
Mutual labels:  jupyter-notebook, tutorial, pytorch-tutorial, lstm, rnn
Pytorch Image Classification
Tutorials on how to implement a few key architectures for image classification using PyTorch and TorchVision.
Stars: ✭ 272 (-91.52%)
Mutual labels:  jupyter-notebook, tutorial, pytorch-tutorial, pytorch-tutorials, cnn
Thesemicolon
This repository contains Ipython notebooks and datasets for the data analytics youtube tutorials on The Semicolon.
Stars: ✭ 345 (-89.25%)
Mutual labels:  jupyter-notebook, tutorial, lstm, rnn, sentiment-analysis
Video Classification
Tutorial for video classification/ action recognition using 3D CNN/ CNN+RNN on UCF101
Stars: ✭ 543 (-83.08%)
Mutual labels:  jupyter-notebook, pytorch-tutorial, cnn, lstm, rnn
Deepseqslam
The Official Deep Learning Framework for Route-based Place Recognition
Stars: ✭ 49 (-98.47%)
Mutual labels:  cnn, lstm, rnn, recurrent-neural-networks
Sentiment Analysis Nltk Ml Lstm
Sentiment Analysis on the First Republic Party debate in 2016 based on Python,NLTK and ML.
Stars: ✭ 61 (-98.1%)
Mutual labels:  jupyter-notebook, lstm, sentiment-analysis, recurrent-neural-networks
Bitcoin Price Prediction Using Lstm
Bitcoin price Prediction ( Time Series ) using LSTM Recurrent neural network
Stars: ✭ 67 (-97.91%)
Mutual labels:  jupyter-notebook, lstm, rnn, recurrent-neural-networks
Twitter Sentiment Analysis
Sentiment analysis on tweets using Naive Bayes, SVM, CNN, LSTM, etc.
Stars: ✭ 978 (-69.52%)
Mutual labels:  cnn, lstm, sentiment-analysis, sentiment-classification
Lstm Sentiment Analysis
Sentiment Analysis with LSTMs in Tensorflow
Stars: ✭ 886 (-72.39%)
Mutual labels:  jupyter-notebook, lstm, rnn, sentiment-analysis
Getting Things Done With Pytorch
Jupyter Notebook tutorials on solving real-world problems with Machine Learning & Deep Learning using PyTorch. Topics: Face detection with Detectron 2, Time Series anomaly detection with LSTM Autoencoders, Object Detection with YOLO v5, Build your first Neural Network, Time Series forecasting for Coronavirus daily cases, Sentiment Analysis with BERT.
Stars: ✭ 738 (-77%)
Mutual labels:  jupyter-notebook, tutorial, lstm, sentiment-analysis
Nlp Tutorial
Natural Language Processing Tutorial for Deep Learning Researchers
Stars: ✭ 9,895 (+208.35%)
Mutual labels:  jupyter-notebook, tutorial, natural-language-processing, bert
Deep Learning With Python
Deep learning codes and projects using Python
Stars: ✭ 195 (-93.92%)
Mutual labels:  jupyter-notebook, cnn, rnn, recurrent-neural-networks
Linear Attention Recurrent Neural Network
A recurrent attention module consisting of an LSTM cell which can query its own past cell states by the means of windowed multi-head attention. The formulas are derived from the BN-LSTM and the Transformer Network. The LARNN cell with attention can be easily used inside a loop on the cell state, just like any other RNN. (LARNN)
Stars: ✭ 119 (-96.29%)
Mutual labels:  jupyter-notebook, lstm, rnn, recurrent-neural-networks
Codesearchnet
Datasets, tools, and benchmarks for representation learning of code.
Stars: ✭ 1,378 (-57.06%)
Mutual labels:  jupyter-notebook, natural-language-processing, cnn, rnn
Pytorch Question Answering
Important paper implementations for Question Answering using PyTorch
Stars: ✭ 154 (-95.2%)
Mutual labels:  jupyter-notebook, tutorial, pytorch-tutorial, natural-language-processing

PyTorch Sentiment Analysis

Note: This repo only works with torchtext 0.9 or above which requires PyTorch 1.8 or above. If you are using torchtext 0.8 then please use this branch

This repo contains tutorials covering how to do sentiment analysis using PyTorch 1.8 and torchtext 0.9 using Python 3.7.

The first 2 tutorials will cover getting started with the de facto approach to sentiment analysis: recurrent neural networks (RNNs). The third notebook covers the FastText model and the final covers a convolutional neural network (CNN) model.

There are also 2 bonus "appendix" notebooks. The first covers loading your own datasets with torchtext, while the second contains a brief look at the pre-trained word embeddings provided by torchtext.

If you find any mistakes or disagree with any of the explanations, please do not hesitate to submit an issue. I welcome any feedback, positive or negative!

Getting Started

To install PyTorch, see installation instructions on the PyTorch website.

To install torchtext:

pip install torchtext

We'll also make use of spaCy to tokenize our data. To install spaCy, follow the instructions here making sure to install the English models with:

python -m spacy download en_core_web_sm

For tutorial 6, we'll use the transformers library, which can be installed via:

pip install transformers

These tutorials were created using version 4.3 of the transformers library.

Tutorials

  • 1 - Simple Sentiment Analysis Open In Colab

    This tutorial covers the workflow of a PyTorch with torchtext project. We'll learn how to: load data, create train/test/validation splits, build a vocabulary, create data iterators, define a model and implement the train/evaluate/test loop. The model will be simple and achieve poor performance, but this will be improved in the subsequent tutorials.

  • 2 - Upgraded Sentiment Analysis Open In Colab

    Now we have the basic workflow covered, this tutorial will focus on improving our results. We'll cover: using packed padded sequences, loading and using pre-trained word embeddings, different optimizers, different RNN architectures, bi-directional RNNs, multi-layer (aka deep) RNNs and regularization.

  • 3 - Faster Sentiment Analysis Open In Colab

    After we've covered all the fancy upgrades to RNNs, we'll look at a different approach that does not use RNNs. More specifically, we'll implement the model from Bag of Tricks for Efficient Text Classification. This simple model achieves comparable performance as the Upgraded Sentiment Analysis, but trains much faster.

  • 4 - Convolutional Sentiment Analysis Open In Colab

    Next, we'll cover convolutional neural networks (CNNs) for sentiment analysis. This model will be an implementation of Convolutional Neural Networks for Sentence Classification.

  • 5 - Multi-class Sentiment Analysis Open In Colab

    Then we'll cover the case where we have more than 2 classes, as is common in NLP. We'll be using the CNN model from the previous notebook and a new dataset which has 6 classes.

  • 6 - Transformers for Sentiment Analysis Open In Colab

    Finally, we'll show how to use the transformers library to load a pre-trained transformer model, specifically the BERT model from this paper, and use it to provide the embeddings for text. These embeddings can be fed into any model to predict sentiment, however we use a gated recurrent unit (GRU).

Appendices

  • A - Using TorchText with your Own Datasets Open In Colab

    The tutorials use TorchText's built in datasets. This first appendix notebook covers how to load your own datasets using TorchText.

  • B - A Closer Look at Word Embeddings Open In Colab

    This appendix notebook covers a brief look at exploring the pre-trained word embeddings provided by TorchText by using them to look at similar words as well as implementing a basic spelling error corrector based entirely on word embeddings.

  • C - Loading, Saving and Freezing Embeddings Open In Colab

    In this notebook we cover: how to load custom word embeddings, how to freeze and unfreeze word embeddings whilst training our models and how to save our learned embeddings so they can be used in another model.

References

Here are some things I looked at while making these tutorials. Some of it may be out of date.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].