LoginSignup
4
4

More than 5 years have passed since last update.

word2vecの性能参考値メモ

Last updated at Posted at 2017-12-19

趣旨

gensimのword2vecを動かした際のサーバスペック、動作時間、入力語数等を参考までに記録しておくもの。検証レベルで大した規模ではないです。所感としては想像していたよりは軽かった。

環境

OS

Linux 4.11.0-1015-azure #15-Ubuntu SMP Thu Nov 2 17:19:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
MS Azure環境です。

CPU

2core
(Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz)

Memory

3.5GB

実行時間等

2017-12-18 13:00:03,893 : word2vec : INFO : collected 29642 word types from a corpus of 197737 raw words and 5056 sentences
2017-12-18 13:00:03,893 : word2vec : INFO : Loading a fresh vocabulary
2017-12-18 13:00:04,161 : word2vec : INFO : min_count=1 retains 29642 unique words (100% of original 29642, drops 0)
2017-12-18 13:00:04,161 : word2vec : INFO : min_count=1 leaves 197737 word corpus (100% of original 197737, drops 0)
2017-12-18 13:00:04,699 : word2vec : INFO : deleting the raw counts dictionary of 29642 items
2017-12-18 13:00:04,700 : word2vec : INFO : sample=0.001 downsamples 10 most-common words
2017-12-18 13:00:04,700 : word2vec : INFO : downsampling leaves estimated 195973
 word corpus (99.1% of prior 197737)
2017-12-18 13:00:04,701 : word2vec : INFO : estimated required memory for 29642
words and 200 dimensions: 62248200 bytes
2017-12-18 13:00:05,055 : word2vec : INFO : resetting layer weights
2017-12-18 13:00:07,413 : word2vec : INFO : training model with 3 workers on 29642 vocabulary and 200 features, using sg=1 hs=0 sample=0.001 negative=15 window=10
~中略~
2017-12-18 13:01:30,224 : word2vec : INFO : PROGRESS: at 100.00% examples, 11832
 words/s, in_qsize 0, out_qsize 1
2017-12-18 13:01:30,224 : word2vec : INFO : worker thread finished; awaiting finish of 0 more threads
2017-12-18 13:01:30,224 : word2vec : INFO : training on 988685 raw words (979818 effective words) took 82.8s, 11832 effective words/s

だいたい20万語、3万語彙ですね。かかっている時間は82秒。

(2018/03/08 追記)
600万語、9万語彙で約10分になりました。

Python/gensimのword2vecを使用しており、パラメータはこんな感じです。

sg=1, size=200, min_count=1, window=10, hs=0, negative=15, iter=5, sample=0.001

ちなみに新聞記事から名詞のみ抽出したコーパスを使っていました。

余談ですが、恐らくgensimの最適化まわりの仕様ゆえだと思いますが、Windowsだと同スペックでもLinuxと比べ格段に遅くなります。とはいえ、非力なWindows端末(i3程度)でも、1~2万語程度であれば十分動作確認は可能でした。
精度はまあ可もなく不可もなく、という感覚。もっと入力を増やせば違う世界があるのかもしれませんが…

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4