![]() |
ノート/Deep Learning Tutorialの例題をやってみたhttp://pepper.is.sci.toho-u.ac.jp/pepper/index.php?%A5%CE%A1%BC%A5%C8%2FDeep%20Learning%20Tutorial%A4%CE%CE%E3%C2%EA%A4%F2%A4%E4%A4%C3%A4%C6%A4%DF%A4%BF |
![]() |
ノート/ノート
訪問者 2325 最終更新 2015-04-19 (日) 14:37:33
Theanoのインストール >>> ノート/theano
Tutorialのインストール >>> チュートリアル中のGetting Startedのページ
チュートリアルで使われるプログラムは、gitからダウンロードできる。
>>> ダウンロード
チュートリアルを試すのに使うデータセット(MNISTとか)は、チュートリアルファイル内のスクリプトを実行することでダウンロード・準備できる。
/bin/sh (チュートリアルトップ)/data/download.sh
プログラムは、Classifying MNIST digits using Logistic Regressionのページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/logistic_sgd.py
チュートリアルページにある結果と比較すると、
チュートリアルページ ... epoch 72, minibatch 83/83, validation error 7.510417 % epoch 72, minibatch 83/83, test error of best model 7.510417 % epoch 73, minibatch 83/83, validation error 7.500000 % epoch 73, minibatch 83/83, test error of best model 7.489583 % Optimization complete with best validation score of 7.500000 %,with test performance 7.489583 % The code run for 74 epochs, with 1.936983 epochs/sec
手元の実行結果 epoch 71, minibatch 83/83, validation error 7.520833 % epoch 72, minibatch 83/83, validation error 7.510417 % epoch 73, minibatch 83/83, validation error 7.500000 % epoch 73, minibatch 83/83, test error of best model 7.489583 % Optimization complete with best validation score of 7.500000 %,with test performance 7.489583 % The code run for 74 epochs, with 14.122137 epochs/sec The code for file logistic_sgd.py ran for 5.2s
プログラムは、Multilayer Perceptronのページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/mlp.py
結果は、mlp_log.txt
チュートリアルページにある結果と比較すると、
チュートリアルページ Optimization complete. Best validation score of 1.690000 % obtained at iteration 2070000, with test performance 1.650000 % The code for file mlp.py ran for 97.34m
手元の実行結果 Optimization complete. Best validation score of 1.690000 % obtained at iteration 2070000, with test performance 1.650000 % The code for file mlp.py ran for 51.45m
プログラムは、Convolutional Neural Networks (LeNet)のページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/mlp.py
結果は、&ref(): File not found: "convolutional_mlp_log.txt" at page "ノート/Deep Learning Tutorialの例題をやってみた";
チュートリアルページにある結果と比較すると、
チュートリアルページ CPU (Core i7-2600K CPU clocked at 3.40GHz and using flags ‘floatX=float32’) Optimization complete. Best validation score of 0.910000 % obtained at iteration 17800,with test performance 0.920000 % The code for file convolutional_mlp.py ran for 380.28m And similarly on a GeForce GTX 480 Optimization complete. Best validation score of 0.910000 % obtained at iteration 16400,with test performance 0.930000 % The code for file convolutional_mlp.py ran for 32.52m
手元の実行結果 (GeForce Titan Z) epoch 200, minibatch 100/100, validation error 0.910000 % Optimization complete. Best validation score of 0.910000 % obtained at iteration 19800, with test performance 0.920000 % The code for file convolutional_mlp.py ran for 13.49m
プログラムは、Denoising Autoencoders (dA)のページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/dA.py
結果は、dA_log.txt
チュートリアルページには、ログ出力は出ていない。実行時間は
手元の実行結果 (GeForce Titan Z) real 2m12.225s user 1m58.671s sys 0m12.949s
であった。
教師なし学習の結果のフィルタの様子は、
プログラムは、Stacked Denoising Autoencoders (SdA)のページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/SdA.py
結果は、SdA_log.txt
チュートリアルページにある結果と比較すると、
チュートリアルページ Pre-training takes 585.01 minutes, with an average of 13 minutes per epoch. Fine-tuning is completed after 36 epochs in 444.2 minutes, with an average of 12.34 minutes per epoch. The final validation score is 1.39% with a testing score of 1.3%. These results were obtained on a machine with an Intel Xeon E5430 @ 2.66GHz CPU, with a single-threaded GotoBLAS.
手元の実行結果 ... pre-training the model Pre-training layer 2, epoch 14, cost 176.348 The pretraining code for file SdA.py ran for 54.79m ... finetunning the model epoch 103, minibatch 50000/50000, validation error 1.470000 % Optimization complete with best validation score of 1.470000 %, on iteration 2600000, with test performance 1.370000 % The training code for file SdA.py ran for 168.50m
プログラムは、Restricted Boltzmann Machines (RBM)のページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/rbm.py
結果は、rbm_log.txt
チュートリアルページにある結果と比較すると、
チュートリアルページ We ran the code with PCD-15, learning rate of 0.1 and a batch size of 20, for 15 epochs. Training the model takes 122.466 minutes on a Intel Xeon E5430 @ 2.66GHz CPU, with a single-threaded GotoBLAS. Training epoch 14, cost is -62.755739271 Training took 122.466000 minutes
手元の実行結果 Using gpu device 0: GeForce GTX TITAN Z Training epoch 14, cost is -62.1733 Training took 56.496167 minutes
教師なし学習の結果のフィルタと、サンプルイメージの様子(詳細は原ページにあり)は、
プログラムは、Deep Belief Networksのページ にある通り。(プログラムのリストはこちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/DBN.py
結果は、DBN_log.txt
チュートリアルページにある結果と比較すると、
チュートリアルページ On an Intel(R) Xeon(R) CPU X5560 running at 2.80GHz, using a multi-threaded MKL library (running on 4 cores), pretraining took 615 minutes with an average of 2.05 mins/(layer * epoch). Fine-tuning took only 101 minutes or approximately 2.20 mins/epoch.
手元の実行結果 Using gpu device 0: GeForce GTX TITAN Z Pre-training layer 2, epoch 99, cost -47.6387 The pretraining code for file DBN.py ran for 90.85m 60, cost -48.1429 epoch 235, minibatch 5000/5000, validation error 1.260000 % The fine tuning code for file DBN.py ran for 35.07m, minibatch 5000/5000, validation error 1.260000 % Optimization complete with best validation score of 1.260000 %, obtained at iteration 590000, with test performance 1.270000 %
プログラムは、Contractive auto-encoders (cA)のページ にある(というよりプログラムしかない)。
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/cA.py
結果は、&ref(): File not found: "cA_log.txt" at page "ノート/Deep Learning Tutorialの例題をやってみた";
チュートリアルページには結果が出ていないので、手元の結果のみ掲載。
手元の実行結果 Using gpu device 0: GeForce GTX TITAN Z The code for file cA.py ran for 17.47m ... loading data Training epoch 0, reconstruction cost 589.572 jacobian norm 20.9939 Training epoch 1, reconstruction cost 115.134 jacobian norm 10.6737 Training epoch 2, reconstruction cost 101.291 jacobian norm 10.1344 Training epoch 3, reconstruction cost 94.2199 jacobian norm 9.84684 Training epoch 4, reconstruction cost 89.5886 jacobian norm 9.64734 Training epoch 5, reconstruction cost 86.1486 jacobian norm 9.49856 Training epoch 6, reconstruction cost 83.466 jacobian norm 9.38141 Training epoch 7, reconstruction cost 81.3509 jacobian norm 9.28326 Training epoch 8, reconstruction cost 79.6479 jacobian norm 9.19747 Training epoch 9, reconstruction cost 78.2063 jacobian norm 9.12142 Training epoch 10, reconstruction cost 76.9452 jacobian norm 9.05341 Training epoch 11, reconstruction cost 75.8432 jacobian norm 8.9915 Training epoch 12, reconstruction cost 74.8995 jacobian norm 8.93378 Training epoch 13, reconstruction cost 74.1056 jacobian norm 8.87923 Training epoch 14, reconstruction cost 73.4411 jacobian norm 8.82917 Training epoch 15, reconstruction cost 72.8792 jacobian norm 8.78441 Training epoch 16, reconstruction cost 72.3725 jacobian norm 8.74322 Training epoch 17, reconstruction cost 71.8618 jacobian norm 8.70261 Training epoch 18, reconstruction cost 71.3046 jacobian norm 8.66102 Training epoch 19, reconstruction cost 70.6458 jacobian norm 8.61776 real 18m19.035s user 13m7.272s sys 5m7.113s
プログラムは、Recurrent Neural Networks with Word Embeddingsのページ にある通り。(プログラムの リストは こちら)
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/rnnslu.py
結果は、rnnslu_log.txt (先頭と終りの数行のみ掲示)
チュートリアルページには、 Running experiments on ATIS using this repository will run one epoch in less than 40 seconds on i7 CPU 950 @ 3.07GHz using less than 200 Mo of RAM: [learning] epoch 0 >> 100.00% completed in 34.48 (sec) << 手元の実行結果 Using gpu device 0: GeForce GTX TITAN Z (...) [learning] epoch 0 >> 100.00% completed in 50.09 (sec) << (...) [learning] epoch 59 >> 100.00% completed in 45.20 (sec) << ('BEST RESULT: epoch', 38, 'valid F1', 97.16, 'best test F1', 93.92, 'with the model', 'code/rnnslu') real 54m17.383s user 49m15.965s sys 4m42.051s
プログラムは、LSTM (Long Short Term Memory) Networks for Sentiment Analysisのページ にある通り。(プログラムのリストはこれ(lstm.py)とこれ(lmdb.py))
実行は、($HOME)/.theanorcを適宜設定した上で(最大のポイントは、gpu をオンにする)
python code/lstm.py
結果は、lstm_log.txt
チュートリアルページには結果が載っていないので、手元実行のデータだけ。
手元の実行結果 Using gpu device 0: GeForce GTX TITAN Z 1998 train examples 105 valid examples 500 test examples Epoch 0 Update 10 Cost 0.689779222012 Epoch 0 Update 20 Cost 0.685189962387 (...) Epoch 79 Update 9970 Cost 1.29124291561e-05 Epoch 79 Update 9980 Cost 1.89245997717e-06 Epoch 79 Update 9990 Cost 7.68178233557e-06 Saving... Done ('Train ', 0.0, 'Valid ', 0.22857142857142854, 'Test ', 0.19599999999999995) Early Stop! Seen 1840 samples Train 0.0 Valid 0.190476190476 Test 0.186 The code run for 80 epochs, with 12.409125 sec/epochs real 19m50.399s user 17m22.829s sys 2m16.979s