Code Monkey home page Code Monkey logo

disan's Introduction

Directional Self-Attention Network

Cite this paper using BibTex:

@inproceedings{shen2018disan,
Author = {Shen, Tao and Zhou, Tianyi and Long, Guodong and Jiang, Jing and Pan, Shirui and Zhang, Chengqi},
Booktitle = {AAAI Conference on Artificial Intelligence},
Title = {DISAN: Directional self-attention network for rnn/cnn-free language understanding},
Year = {2018}
}

Overall Requirements

  • Python3 (verified on 3.5.2, or Anaconda3 4.2.0)
  • tensorflow>=1.2

Python Packages:

  • numpy

This repo includes three part as follows:

  1. Directionnal Self-Attention Network independent file -> file disan.py
  2. DiSAN implementation for Stanford Natural Language Inference -> dir SNLI_disan
  3. DiSAN implementation for Stanford Sentiment Classification -> dir SST_disan

The Usage of disan.py will be introduced below, and as for the implementation of SNLI and SST, please enter corresponding folder for further introduction.

And, Code for the other experiments (e.g. SICK, MPQA, CR etc.) appeared in the paper is under preparation.


Usage of disan.py

Parameters:

  • param rep_tensor: 3D tensorflow dense float tensor [batch_size, max_len, dim]
  • param rep_mask: 2D tensorflow bool tensor as mask for rep_tensor, [batch_size, max_len]
  • param scope: tensorflow variable scope
  • param keep_prob: float, dropout keep probability
  • param is_train: tensorflow bool scalar
  • param wd: if wd>0, add related tensor to tf collectoion "reg_vars" for further l2 decay
  • param activation: disan activation function [elu|relu|selu]
  • param tensor_dict: a dict to record disan internal attention result (insignificance)
  • param name: record name suffix (insignificance)

Output:

2D tensorflow dense float tensor, which shape is [batch_size, dim] as the encoding result for each sentence.


Acknowledgements

  • Some basic neural networks are copied from Minjoon's Repo, including RNN cell, dropout-able dynamic RNN etc.

disan's People

Contributors

taoshen58 avatar

Watchers

James Cloos 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.