Giter VIP home page Giter VIP logo

doc2vec's Introduction

doc2vec

A simple and readable implementation of doc2vec [1], using Python 3, Keras and TensorFlow.

Installation

pip install -r requirements.txt
python setup.py install

Assumptions

This implementation assumes that your documents are all in the same directory, and named with monotonically incrementing integer IDs, e.g. 0.txt, 1.txt. Each file should contain an ordinary text document, i.e. without any special preprocessing.

Usage

doc2vec path/to/docs/ \
    --save path/to/save/model.hdf5 \
    --save_vocab path/to/save/vocab.vocab \
    --train

By default, this will use the Distributed Memory (DM) model. You can also use the Distributed Bag-Of-Words (DBOW) model with:

doc2vec path/to/docs/ --model dbow

Previously trained models can be loaded with:

doc2vec path/to/docs/ \
    --load path/to/load/model.hdf5 \
    --load_vocab path/to/load/vocab.vocab

And document embeddings can be written to file as follows:

doc2vec path/to/docs/ \
    --load path/to/load/model.hdf5 \
    --load_vocab path/to/load/vocab.vocab \
    --save_doc_embeddings path/to/save/embeddings.hdf5

Finally, you can see all available options and model parameters with:

doc2vec -h

References

  1. Le, Quoc, and Mikolov, Tomas. "Distributed representations of sentences and documents." International Conference on Machine Learning. 2014.
  2. Bird, Steven, Loper, Edward and Klein, Ewan. "Natural Language Processing with Python." O’Reilly Media Inc. 2009.

doc2vec's People

Contributors

samueljamesbell avatar dependabot[bot] 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.