Code Monkey home page Code Monkey logo

usr2vec's Introduction

Usr2Vec

Implementation of the the usr2vec model to induce neural user embeddings, as described in the paper in the paper Quantifying Mental Health from Social Media with Neural User Embeddings. The resulting embeddings capture latent user aspects, e.g. political leanings and mental-health status (Figure 1)

A previous version of this model, described in the paper Modelling Context with User Embeddings for Sarcasm Detection in Social Media can be found here.

alt text Figure 1 - User embeddings projected into 2-Dimensions and colored according to mental health status.

If you use this code please cite our paper as:

Amir, S., Coppersmith, G., Carvalho, P., Silva, M.J. and Wallace, B.C., 2017. Quantifying Mental Health from Social Media with Neural User Embeddings. In Journal of Machine Learning Research, W&C Track, Volume 68.

Requirements:

The software is implemented in python 2.7 and requires the following packages:

Inputs/Outputs:

There are two inputs to this model:

  1. a text file with the training data --- the system assumes that the documents can be tokenized using whitespace (we recommend pre-tokenzing with the appropriate tokenizer) and that all messages from a user appear sequentially (see raw_data/sample.txt for an example)
  2. a text file with pre-trained word embeddings (e.g. word2vec, glove)

The output is a text file with a format similar to word2vec's, i.e. each line consists of user_id \t embedding.

Instructions

The software works in two main steps: (1) building the training the data; and (2) learning the user embeddings. The code can be executed as follow:

  1. Setup
    1. get the sma_toolkit
    2. edit scripts/setup.sh and set the path to the sma_toolkit
    3. run ./scripts/setup.sh
  2. Build training data
    1. get some pretrained word embeddings
    2. edit the paths on the file scripts/build_data.sh (i.e. the variables DATA_PATH, WORD_EMBEDDINGS)
    3. run ./scripts/build_data.sh
  3. Train model: run ./scripts/build_data.sh [DATA_PATH] [OUTPUT_PATH]

usr2vec'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.