Giter Club home page Giter Club logo

multi-label-text-classification's Introduction

Deep Learning for Multi-Label Text Classification

This repository is my research project, and it is also a study of TensorFlow, Deep Learning(Fasttext, CNN, LSTM, RCNN, etc.).

The main objective of the project is to solve the multi-label text classification problem based on Deep Neural Networks. Thus, the format of the data label is like [0, 1, 0, ..., 1, 1] according to the characteristics of such problem.

Requirements

  • Python 3.6
  • Tensorflow 1.8 +
  • Numpy
  • Gensim

Innovation

Data part

  1. Make the data support Chinese and English.(Which use jieba seems easy)
  2. Can use your own pre-trained word vectors.(Which use gensim seems easy)
  3. Add embedding visualization based on the tensorboard.

Model part

  1. Add the correct L2 loss calculation operation.
  2. Add gradients clip operation to prevent gradient explosion.
  3. Add learning rate decay with exponential decay.
  4. Add a new Highway Layer (Which is useful according to the model performance).
  5. Add Batch Normalization Layer.

Code part

  1. Can choose to train the model directly or restore the model from checkpoint in train.py.
  2. Can predict the labels via threshold and topK in train.py and test.py.
  3. Can calculate the evaluation metrics --- AUC & AUPRC.
  4. Add test.py, the model test code, it can show the predict value of each labels of the data in Testset when creating the final prediction file.
  5. Add other useful data preprocess functions in data_helpers.py.
  6. Use logging for helping recording the whole info (including parameters display, model training info, etc.).
  7. Provide the ability to save the best n checkpoints in checkmate.py, whereas the tf.train.Saver can only save the last n checkpoints.

Data

See data format in data folder which including the data sample files.

Text Segment

You can use jieba package if you are going to deal with the chinese text data.

Data Format

This repository can be used in other datasets(text classification) by two ways:

  1. Modify your datasets into the same format of the sample.
  2. Modify the data preprocess code in data_helpers.py.

Anyway, it should depends on what your data and task are.

Pre-trained Word Vectors

You can pre-training your word vectors(based on your corpus) in many ways:

  • Use gensim package to pre-train data.
  • Use glove tools to pre-train data.
  • Even can use a fasttext network to pre-train data.

Network Structure

FastText

References:


TextANN

References:

  • Personal ideas 🙃

TextCNN

References:


TextRNN

Warning: Model can use but not finished yet 🤪!

TODO

  1. Add BN-LSTM cell unit.
  2. Add attention.

References:


TextCRNN

References:

  • Personal ideas 🙃

TextRCNN

References:

  • Personal ideas 🙃

TextHAN

References:


TextSANN

Warning: Model can use but not finished yet 🤪!

TODO

  1. Add attention penalization loss.
  2. Add visualization.

References:


About Me

黄威,Randolph

SCU SE Bachelor; USTC CS Master

Email: [email protected]

My Blog: randolph.pro

LinkedIn: randolph's linkedin

multi-label-text-classification's People

Contributors

randolphvi avatar

Watchers

 avatar  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.