Git Product home page Git Product logo

bachelor-transfer-learning's Introduction

Code and Models for my bachelor thesis "Transfer Learning for Short Text Classification Applications"

The files here can be used to create language models and use these for transfer learning based classifiers.

A visualization of the Sentiment140 based language model can be found at http://projector.tensorflow.org/.

The bookmarks show some preset clusters.

Getting Started

Just clone this git and run the jupyter notebooks.

Prerequisites

Take care that you follow the instructions for installing the fast.ai library correctly. First download and install Anaconda. Used for this project is conda 4.5.11. Newer versions might work too, but if you have issues, stick to the version used here.

For an installation guide for Anaconda go here.

fast.ai version 0.7 is required for this notebooks.

An installation guide for fast.ai can be found here.

Usage

Creating a language model

To create a language model based on the sentiment140 dataset you first need to download the dataset from Kaggle. Rename the downloaded file into "train.csv" and copy it into "Create Languagemodel/sentiment140" Now enter the Create Languagemodel folder, open a console and run

jupyter notebook

In the new browser window you can open the "Sentiment140-Languagemodel.ipynb" file and just run all the cells. This will take a while. The finished languagemodels name will be "lm0_fit_50k_bs70_clrB_noQRNN" and can be found in the models folder. If you just want to use the pre-trained model, just copy it from the models folder into the corresponding classification task.

Fine-tuning a classifier and classification

Each Classification task contains 3 .ipynb files and a folder. The three datasets for these tasks can be found on the following websites:

EmoContext: https://www.humanizing-ai.com/emocontext.html HateSpeech: https://data.world/ml-research/automated-hate-speech-detection-data Sentiment140: see above

These Datasets belong into the subfolder inside the classification tasks, along the tmp and models folder. Each models folder contains three subfolders, to use the corresponding languagemodel copy it into the correct subfolder along its itos_*.pkl file. Except for the WikiText103 languagemodel, the other two pre-trained models are already copied into the model folders of the EmoContext Folder. The WikiText103 model can be downloaded from fast.ai.

When all files are downloaded and copied to the correct folders, you just need to run

jupyter notebook

in the corresponding folder and run all cells in the notebook for the languagemodel you want to test.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

bachelor-transfer-learning's People

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.