GithubHelp home page GithubHelp logo

latent-attention's Introduction

Latent Attention For If-Then Program Synthesis

This repo provides the code to replicate the experiments in the paper

Xinyun Chen, Chang Liu, Richard Shin, Dawn Song, Mingcheng Chen, Latent Attention For If-Then Program Synthesis , in Proc. of NIPS 2016

Paper [arXiv] [NIPS]

Prerequisites

Tensorflow version >= v0.7

sklearn

jsonnet

Datasets

IFTTT

We use the same crawler from Quirk et al. to crawl recipes from IFTTT.com.

Processed data can be found in here.

Zapier

We additional provide a preprocessed dataset derived from Zapier recipes crawled using a crawler.

Processed data can be found under this folder.

Usage

Model architectures

The code includes the implementation of following models:

  • BDLSTM+LA: in configs/model.jsonnet, set model/name to be "rnn", model/decoder to be "LA".
  • BDLSTM+A: in configs/model.jsonnet, set model/name to be "rnn", model/decoder to be "attention".
  • BDLSTM: in configs/model.jsonnet, set model/name to be "rnn", don't set model/decoder(delete this line or set it to "").
  • Dict+LA: in configs/model.jsonnet, set model/name to be "Dict", model/decoder to be "LA".
  • Dict+A: in configs/model.jsonnet, set model/name to be "Dict", model/decoder to be "attention".
  • Dict: in configs/model.jsonnet, set model/name to be "Dict", don't set model/decoder(delete this line or set it to "").

Run experiments

In the following we list some important arguments in train.py:

  • --dataset: path to the preprocessed dataset.
  • --load-model: path to the pretrained model (optional).
  • --config: path to the file that stores the configuration of model architecture.
  • --logdir: path to the directory that stores the models (optional).
  • --output: name of the file that stores the prediction results (no need to specify the filename extension, the output is a pickle (.pkl) file).
python train.py --dataset dataset/IFTTT/msr_data.pkl --config configs/model.jsonnet --logdir model --output result

To ensemble results of several models:

python test_ensemble_probs.py --data dataset/IFTTT/msr_data.pkl --res result_0.pkl result_1.pkl ... result_N.pkl

Citation

If you use the code in this repo, please cite the following paper:

@inproceedings{chen2016latent,
  title={Latent Attention For If-Then Program Synthesis},
  author={Chen, Xinyun and Liu, Chang and Shin, Richard and Song, Dawn and Chen, Mingcheng},
  booktitle={Proceedings of the 29th Advances in Neural Information Processing Systems},
  year={2016}
}

latent-attention's People

Contributors

jungyhuk avatar liuchangacm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

latent-attention's Issues

LabelEncoder()

Where is the LabelEncoder() that can be used to map prediction numbers to real instructions.
E.G.
'label_names': ['Instagram',
'Instagram.Any_new_photo_by_you',
'Dropbox',
'Dropbox.Add_file_from_URL'],
'labels': [45, 193, 11, 20],

Where can I find the map between label_names and labels ?

Thanks a lot. I am trying to use your code to play with prediction.

Format of Pre-processed data

Hello.
What is the format of the pre-processed dataset of IFTTT ?
On unpickling the msr_data.pkl file, the data in it is not making much sense to me... because the attributes like correct_action_param, correct_trigger_param, label_names, words, url etc. are occurring together again and again, as a bundle, and after them is another bundle of some other attributes , namely label_types, trigger_chans, action_chans, action_funcs etc and then is a bundle of action and trigger fields, which is followed by some fields which I don't understand but I think are the fields which require user input and are initialized as NULL and then... I don't understand.

Can you tell me how to make sense of the data ? Also, it would be pretty helpful if you can tell me how to see the data in a pretty-formatted format.

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.