LoginSignup
34
34

More than 5 years have passed since last update.

Deep LearningのライブラリChainerをインストールして使ってみた

Posted at

インストール

PFIのDeep LearningライブラリのChainerをインストールしてみた。
基本的にhttp://chainer.org/ のQUICK STARTの通り
pip install chainer
でインストール完了。超簡単。
自分がインストールした環境はMac OS X Mavericks 10.9.5

センチメント分析のサンプルを動かしてみる

download.shを実行すると解析用のデータをダウンロードしてくれる。
学習データ、テストデータ、開発データが入ってる。こんな形式。

(3 (2 (2 The) (2 Rock)) (4 (3 (2 is) (4 (2 destined) (2 (2 (2 (2 (2 to) (2 (2 be) (2 (2 the) (2 (2 21st) (2 (2 (2 Century) (2 's)) (2 (3 new) (2 (2 ``) (2 Conan)))))))) (2 '')) (2 and)) (3 (2 that) (3 (2 he) (3 (2 's) (3 (2 going) (3 (2 to) (4 (3 (2 make) (3 (3 (2 a) (3 splash)) (2 (2 even) (3 greater)))) (2 (2 than) (2 (2 (2 (2 (1 (2 Arnold) (2 Schwarzenegger)) (2 ,)) (2 (2 Jean-Claud) (2 (2 Van) (2 Damme)))) (2 or)) (2 (2 Steven) (2 Segal))))))))))))) (2 .)))

python train_sentiment.py
で学習開始。

学習結果はこんな感じ(途中結果)

Epoch: 0
loss: 272091.89
15.52 iters/sec, 550.39 sec

Epoch: 1
loss: 231616.00
16.56 iters/sec, 516.08 sec

Epoch: 2
loss: 214706.52
19.19 iters/sec, 445.15 sec

Epoch: 3
loss: 203173.80
14.26 iters/sec, 599.03 sec

Epoch: 4
loss: 193821.91
19.16 iters/sec, 445.83 sec

Train data evaluation:
Node accuracy: 77.93 %% (248,265/318,582)
Root accuracy: 39.56 %% (3,380/8,544)
Develop data evaluation:
Node accuracy: 74.72 %% (30,968/41,447)
Root accuracy: 34.15 %% (376/1,101)

とりあえず動きそうなので自分のデータでやってみよう。

34
34
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
34
34