Code Monkey home page Code Monkey logo

naacl2021's Introduction

A Deep Metric Learning Approach to Account Linking

The code in this repository may be used to reproduce the author ID results found in the article:

A Deep Metric Learning Approach to Account Linking. NAACL (2021)
Aleem Khan, Elizabeth Fleming, Noah Schofield, Marcus Bishop, and Nicholas Andrews
[arxiv] [aclweb] [bib]

We provide instructions to use the preprocessed data below. To access the raw dataset (~23GB), please complete this form: https://forms.gle/TRga2LANBf4Zfo6W9

Please cite the paper above if you find this code or ideas from the paper useful in your own research.

For the latest related work, please see: https://cs.jhu.edu/~noa

Dependencies

In order to run the software in this repository, the packages listed in requirements.txt must be installed. One way to do this is to make a conda environment (conda create --prefix ./env python=3.8), activate it (conda activate ./env), and run pip install -r requirements.txt.

Then, include the location of this repository in your Python path:

export PYTHONPATH=$PYTHONPATH:${PATH_TO_THIS_REPOSITORY}

will enable you to import the aid (author ID) package.

Running an experiment

To run an experiment, first fetch and unpack the data files

https://storage.googleapis.com/naacl21_account_linking/1mil.tar.gz
https://storage.googleapis.com/naacl21_account_linking/dev_queries.tar.gz
https://storage.googleapis.com/naacl21_account_linking/dev_targets.tar.gz
https://storage.googleapis.com/naacl21_account_linking/test_queries.tar.gz
https://storage.googleapis.com/naacl21_account_linking/test_targets.tar.gz

and save them onto your filesystem, specifically into separate subdirectories train, dev, and test, to prevent name conflicts. Unpack the files and then run the json2tf.py script to produce sharded protocol buffer files for training. For example:

python json2tf.py --json /path/to/unpacked/json --tf /path/to/output/tfrecords --config /path/to/reddit/json/config`

NOTE: This will take several hours for the 1mil.tar.gz files.

Next, update the JOBS_DIR variable in run_training.sh to point to the location on your filesystem where output files should be written.

Finally, to run the experiment corresponding with one of the configuration files, say, the model availing of all features, using triplet loss, and varying episode lengths between one and sixteen posts, run the command:

./run_training.sh full_model.cfg --train_records=<TRAINING DATA> --train_tfrecord_path=<VALIDATION QUERIES> --valid_tfrecord_Path=<VALIDATION TARGETS>

NOTE: When specifying the data location, use a wildcard to specify the set of all sharded files. For example, dev/queries*, which you might need to quote to prevent your shell from expanding it.

Here, run_training.sh is a wrapper for the main trainer scripts/fit.py and its argument is a configuration file, which consists of a sequence of command-line arguments, one per line. These will override any defaults specified in scripts/fit.py. You may also provide additional command-line arguments at the end of the command above. If you run the run_training.sh script on a machine with a GPU, the script should automatically recognize and use a CUDA device.

Pretrained checkpoints

The pre-trained checkpoints below may be used to reproduce experimental results from the paper:

Checkpoints:

https://storage.googleapis.com/naacl21_account_linking/full_checkpoint.tar.gz
https://storage.googleapis.com/naacl21_account_linking/text_time_checkpoint.tar.gz

Pass the rank or link flags to scripts/fit.py to evaluate the performance of these checkpoints. See expts/reddit/test.sh.

naacl2021's People

Contributors

noa avatar

Stargazers

Yang Su avatar  avatar Henry Tischler avatar Kyle Dunovan avatar

Watchers

 avatar Kyle Dunovan avatar Marcus Bishop avatar  avatar

Forkers

tresca-msw

naacl2021's Issues

Code availability for UAR

Hello, thank you for the great research track on authorship attribution. Please forgive the incorrect placing of this issue however, 'uar' repository is closed for issues. Therefore, I'm creating the issue here. The code for 'Learning Universal Authorship Representations' paper is unavailable. I wanted to notify you because it can be missed easily. Hoping to see the implementation and am very excited about it.

Thanks,

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.