Code Monkey home page Code Monkey logo

word-embedding-dimensionality-selection's Introduction

Word Embedding Dimensionality Selection

This repo implements the dimensionality selection procedure for word embeddings. The procedure is proposed in the following papers, based on the notion of Pairwise Inner Produce (PIP) loss. No longer pick 300 as your word embedding dimensionality!

@inproceedings{yin2018dimensionality,
 title={On the Dimensionality of Word Embedding},
 author={Yin, Zi and Shen, Yuanyuan},
 booktitle={Advances in Neural Information Processing Systems},
 year={2018}
}

and

@article{yin2018pairwise,  
  title={Understand Functionality and Dimensionality of Vector Embeddings: the Distributional Hypothesis, the Pairwise Inner Product Loss and Its Bias-Variance Trade-off},  
  author={Yin, Zi},  
  journal={arXiv preprint arXiv:1803.00502},  
  year={2018}  
}

Currently, we implement the dimensionality selection procedure for the following algorithms:

  • Word2Vec (skip-gram)
  • GloVe
  • Latent Semantic Analysis (LSA)

How to use the tool

The tool provides an optimal dimensionality for an algorithm on a corpus. For example, you can use it to obtain the dimensionality for your Word2Vec embedding on the Text8 corpus. You need to have the following:

  • A corpus (--file [path to corpus])
  • A config file (yaml) for algorithm specific parameters (--config file [path to config file])
  • Name of algorithm (--algorithm [algorithm_name])

Run from root directory as package, e.g.:

python -m main --file data/text8.zip --config_file config/word2vec_sample_config.yml --algorithm word2vec

Implement your own

You can extend the implementation if you have another embedding algorithm that is based on matrix factorization. The only thing to do is to implement your matrix estimator as a subclass of SignalMatrix.

word-embedding-dimensionality-selection's People

Contributors

shudima avatar ziyin-dl avatar

Watchers

 avatar  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.