Git Product home page Git Product logo

transfer-learning-in-sentiment-tweets's Introduction

Transfer-Learning-in-Sentiment-Tweets

Task: Demonstrate the effective and efficiency of transfer learning via the Universal Language Model Fine-tuning model in NLP applications

For this demonstration, the Twitter data on people's belief on global warming/climate is used. Note that the sentiment of the tweets are based on the contributors evaluation of the tweets. This demonstration is done on a jupyter notebook.

Prerequisites:

  • Python 3
  • Jupyter notebook
  • fastai
  • pytorch
  • re
  • numpy, seaborn, pandas
  • data source: Figure-Eight

Description

This notebook focuses on the so-called Universal Language Model Fine-tuning (ULMFiT) introduced by Jeremy Howard and Sebastian Ruder [1]. The ULMFiT model consists of three main stages in the building a language model (LM):

  1. General-domain LM pre-training: Similar to the ImageNet database used in computer vision, the idea is to pre-train a large corpus of text. The ULMFiT has a pre-trained model called the Wikitext-103 where more than 20,000 Wikipedia articles was trained on. This is alreadly included in the fastai.text API, thus, it is not necessary to carry out this step.

  2. LM fine-tuning: Because the target data (typically) comes from a different distribution from the general-domain, it is necessary to fine-tune the LM to adapt to the idosyncrasies of the target data. Howard and Ruder suggested discriminative fine-tuning and slanted triangular learning rates for fine-tuning the LM. These techniques are available in fastai and are described in [1].

  3. Classifier fine-tuning: Using the updated weights from the previous step, a classifier can be fine-tuned. Howard and Ruder suggested a few techniques which include concat pooling and gradual unfreezing. The latter in particular is used in this demonstration. Again, the fastai framework allows one to perform this technique.

Reference

[1] J. Howard and S. Ruder. 2018.Universal Language Model Fine-tuning for Text Classification. arXiv:1801.06146.

transfer-learning-in-sentiment-tweets's People

Contributors

anthonyckleung avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.