Skip to content
프로젝트

소개

문단 벡터를 학습하고 테스트하는 Python 스크립트

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

The repository contains some python scripts for training and inferring test document vectors using paragraph vectors or doc2vec.

Requirements

  • Python2: Pre-trained models and scripts all support Python2 only.
  • Gensim: Best to use my forked version of gensim; the latest gensim has changed its Doc2Vec methods a little and so would not load the pre-trained models.

Pre-Trained Doc2Vec Models

  • All data can be downloaded here (note: you'll be prompted to download a program called "Mediaflux Data Mover" - after installing it, click the link again and open Mediaflux Data Mover and you'll be able to download the data via the program).
  • English Wikipedia DBOW (1.4GB): 2016-doc2vec/enwiki_dbow.tgz
  • Associated Press News DBOW (0.6GB): 2016-doc2vec/apnews_dbow.tgz

Pre-Trained Word2Vec Models

For reproducibility we also released the pre-trained word2vec skip-gram models on Wikipedia and AP News:

  • All data can be downloaded here (note: you'll be prompted to download a program called "Mediaflux Data Mover" - after installing it, click the link again and open Mediaflux Data Mover and you'll be able to download the data via the program).
  • English Wikipedia Skip-Gram (1.4GB): 2016-doc2vec/enwiki_sg.tgz
  • Associated Press News Skip-gram (0.6GB): 2016-doc2vec/apnews_sg.tgz

Directory Structure and Files

  • train_model.py: example python script to train some toy data
  • infer_test.py: example python script to infer test document vectors using trained model
  • toy_data: directory containing some toy train/test documents and pre-trained word embeddings

Model Hyper-Parameter Explanation

  • sample: this is the sub-sampling threshold to downsample frequent words; 10e-5 is usually good for DBOW, and 10e-6 for DMPV
  • hs: 1 turns on hierarchical sampling; this is rarely turned on as negative sampling is in general better
  • dm: 0 = DBOW; 1 = DMPV
  • negative: number of negative samples; 5 is a good value
  • dbow_words: 1 turns on updating of word embeddings. In DBOW, word embeddings are technically not learnt (only document embeddings are learnt). To learn word vectors, DBOW runs a step of skip-gram before the DBOW step to update the word embeddings. With dbow_words turned off, this means DBOW will randomly initialise word embeddings and keep them randomly initialised. This is rather bad in practice (as the model does not see relationships between words in the embedding space), so it should be turned on
  • dm_concat: 1 = concatenate input word vectors for DMPV; 0 = sum/average input word vectors. This setting is only used for DMPV since DBOW has only one input word
  • dm_mean: 1 = average input word vectors; 0 = sum input word vectors. Again, this setting is only used for DMPV. The original paragraph vector paper concatenates input word vectors for DMPV, and that's the setting we used in our paper
  • iter: number of iterations/epochs to train the model

Publications

관련 프로젝트 살펴보기

불러오는 중…