"I want to do deep learning." With that in mind, it is often said that [Deep Learning from scratch](https://www.amazon.co.jp/%E3%82%BC%E3%83%AD%E3%81%8B%E3 % 82% 89% E4% BD% 9C% E3% 82% 8BDeep-Learning-% E2% 80% 95Python% E3% 81% A7% E5% AD% A6% E3% 81% B6% E3% 83% 87% E3% 82% A3% E3% 83% BC% E3% 83% 97% E3% 83% A9% E3% 83% BC% E3% 83% 8B% E3% 83% B3% E3% 82% B0% E3% 81% AE% E7% 90% 86% E8% AB% 96% E3% 81% A8% E5% AE% 9F% E8% A3% 85-% E6% 96% 8E% E8% 97% A4-% E5% I read BA% B7% E6% AF% 85 / dp / 4873117585). I felt like I understood somehow, I tried playing with the code in the book, but it doesn't work. When I was about to give up, the light came on.
Judgment of author-likeness in Aozora Bunko (KERAS + character-level cnn)
The crawling of Aozora Bunko is over, I ran the article aozora_cnn.py. I have up to epoch100, but it took me 3 days to finish all the learning.
The epoch11 model file seemed to be the highest value.
Checkpoints are set.
By checkpoint
If the accuracy at the time of verification is the highest value,
/tmp/Under the weight of the model at that time*.Save as an h5df file.
Epoch 11/100
378700/378774 [============================>.] - ETA: 0s - loss: 0.1420 - acc: 0.9449Epoch 00010: val_acc improved from 0.87362 to 0.89609, saving model to /tmp/weights.10-0.14-0.94-0.41-0.90.hdf5
378774/378774 [==============================] - 2298s - loss: 0.1420 - acc: 0.9449 - val_loss: 0.4083 - val_acc: 0.8961
Since the model file was not saved after epoch11, I tried running aozora_classification.py by specifying the /tmp/weight-*.h5df file created by the checkpoint of epoch11.
The character string to be judged is also in sample.
Atsushi Nakajima Let's judge the beginning of "The Moon Over the Mountains".
~Longxi's Li Zhi was a scholarly talent, in the last years of Tenpo, and was named after the tiger at a young age, and was then supplemented by Lieutenant Gangnam. I didn't know.~
Result is,ยทยทยท
Natsume Soseki | Ryunosuke Akutagawa | Ogai Mori | Ango Sakaguchi |
---|---|---|---|
0 | 1.056089e-09 | 1.293081e-07 | 0.000033 |
It looks like Ogai Mori! It looks like it's done! (It's natural because I haven't changed the code at all: hugging_face :: hugging_face :: hugging_face :)
I tried to judge. It looks like Natsume Soseki.
Natsume Soseki | Ryunosuke Akutagawa | Ogai Mori | Ango Sakaguchi |
---|---|---|---|
0 | 0.125387 | 0.000199 | 6.651750e-07 |
Recommended Posts