• Stars
    star
    245
  • Rank 165,304 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hierarchical Attention Networks | a PyTorch Tutorial to Text Classification

This is a PyTorch Tutorial to Text Classification.

This is the fourth in a series of tutorials I plan to write about implementing cool models on your own with the amazing PyTorch library.

Basic knowledge of PyTorch, recurrent neural networks is assumed.

If you're new to PyTorch, first read Deep Learning with PyTorch: A 60 Minute Blitz and Learning PyTorch with Examples.

Questions, suggestions, or corrections can be posted as issues.

I'm using PyTorch 1.1 in Python 3.6.


27 Jan 2020: Working code for two new tutorials has been added — Super-Resolution and Machine Translation


Contents

Objective

Concepts

Overview

Implementation

Training

Inference

Frequently Asked Questions

Objective

To build a model that can label a text document as one of several categories.

We will be implementing the Hierarchial Attention Network (HAN), one of the more interesting and interpretable text classification models.

This model not only classifies a document, but also chooses specific parts of the text – sentences and individual words – that it thinks are most important.


"I think I'm falling sick. There was some indigestion at first. But now a fever is beginning to take hold."


"But think about it! It's so cool. Physics is really all about math. What Feynman said, hehe."


"I want to tell you something important. Get into the stock market and investment funds. Make some money so you can buy yourself some yogurt."


"How do computers work? I have a CPU I want to use. But my keyboard and motherboard do not help."

"You can just google how computers work. Honestly, its easy."


"You know what's wrong with this country? Republicans and democrats. Always at each other's throats"

"There's no respect, no bipartisanship."


Tutorial in Progress

I am still writing this tutorial.

In the meantime, you could take a look at the code – it works!

We achieve an accuracy of 75.1% (against 75.8% in the paper) on the Yahoo Answer dataset.

More Repositories

1

a-PyTorch-Tutorial-to-Object-Detection

SSD: Single Shot MultiBox Detector | a PyTorch Tutorial to Object Detection
Python
2,976
star
2

a-PyTorch-Tutorial-to-Image-Captioning

Show, Attend, and Tell | a PyTorch Tutorial to Image Captioning
Python
2,675
star
3

Deep-Tutorials-for-PyTorch

In-depth tutorials for implementing deep learning models on your own with PyTorch.
1,467
star
4

a-PyTorch-Tutorial-to-Super-Resolution

Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network | a PyTorch Tutorial to Super-Resolution
Python
558
star
5

a-PyTorch-Tutorial-to-Sequence-Labeling

Empower Sequence Labeling with Task-Aware Neural Language Model | a PyTorch Tutorial to Sequence Labeling
Python
362
star
6

a-PyTorch-Tutorial-to-Transformers

Attention Is All You Need | a PyTorch Tutorial to Transformers
Python
177
star
7

chess-transformers

Teaching transformers to play chess
Python
38
star
8

Wide-Residual-Nets-for-SETI

Classification of simulated radio signals using Wide Residual Networks for use in the search for extra-terrestrial intelligence
Python
24
star
9

Mercator-Projection-Operations-on-Google-Static-Maps-Images

Perform Mercator Projection operations on Google Static Maps images,, usually as a data-preparation step for Image Classification tasks.
Python
8
star
10

Word2Vec-on-Reddit-s-Politics-Subreddit-Jan-Apr-2016-

Create word embeddings using comments from the /r/politics subreddit for the period Jan-Apr 2016.
Python
3
star
11

Anomaly-Detection-using-a-Deep-Learning-Auto-Encoder

A simple Anomaly Detection exercise to recognize images that contain faces.
R
3
star
12

Event-Detection-by-Finding-Anomalies-on-Google-Search-Trends-Data

Detect newsworthy events by performing anomaly detection on Google Search trends.
R
2
star
13

Implement-a-Broad-Search-Feature-by-Combining-Word-and-Document-Embeddings

Combine word and document embeddings using disease-related tweets to create an intelligent, broad search capability.
Python
1
star