Chainerを始めよう1

Chainerとは
-> Deep learningのモデル、実行コードを直観的に記述できるpythonのフレームワーク
-> 使用することで、ニューラルネットワークやDeep learningの理解も深まる!?

ニューラルネットワークとは、脳のニューロンのネットワークをコンピュータ上で再現したモデル

ニューラルネットワークは、入力層(l-1層)で受け取り、隠れ層(l層)を通り、出力層(l+1層)から答えを返す

正しい答えと、NNの予想した答えとの誤差を損失関数と呼ぶ。損失関数の値が小さくなるよう値を変えていくことで、NNを学習させる


NNではWeight(結合重み)とBiasという二つのパラメータを使って、目的の値を出力する関数に近いものを作る
ニューロン同士のつながりの強さがweight
ニューロン・weightの出力に足すパラメーターbias
この関数をChainerではLinkと呼ぶ

ではchainerをインストールしましょう。

[vagrant@localhost python]$ pip install chainer
Collecting chainer
Downloading https://files.pythonhosted.org/packages/dc/bf/b561706d4e86f055841c7a5a414b5e5423bea230faa92abf5422c82cf995/chainer-6.4.0.tar.gz (876kB)
100% |████████████████████████████████| 880kB 641kB/s
Requirement already satisfied: setuptools in /home/vagrant/.pyenv/versions/3.5.2/lib/python3.5/site-packages (from chainer) (20.10.1)
Collecting typing<=3.6.6 (from chainer) Downloading https://files.pythonhosted.org/packages/4a/bd/eee1157fc2d8514970b345d69cb9975dcd1e42cd7e61146ed841f6e68309/typing-3.6.6-py3-none-any.whl Collecting typing_extensions<=3.6.6 (from chainer) Downloading https://files.pythonhosted.org/packages/62/4f/392a1fa2873e646f5990eb6f956e662d8a235ab474450c72487745f67276/typing_extensions-3.6.6-py3-none-any.whl Collecting filelock (from chainer) Downloading https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl Requirement already satisfied: numpy>=1.9.0 in /home/vagrant/.pyenv/versions/3.5.2/lib/python3.5/site-packages (from chainer) (1.15.0)
Collecting protobuf<3.8.0rc1,>=3.0.0 (from chainer)
Downloading https://files.pythonhosted.org/packages/81/59/c7b0815a78fd641141f24a6ece878293eae6bf1fce40632a6ab9672346aa/protobuf-3.7.1-cp35-cp35m-manylinux1_x86_64.whl (1.2MB)
100% |████████████████████████████████| 1.2MB 1.2MB/s
Requirement already satisfied: six>=1.9.0 in /home/vagrant/.pyenv/versions/3.5.2/lib/python3.5/site-packages (from chainer) (1.11.0)
Installing collected packages: typing, typing-extensions, filelock, protobuf, chainer
Running setup.py install for chainer … done
Successfully installed chainer-6.4.0 filelock-3.0.12 protobuf-3.7.1 typing-3.6.6 typing-extensions-3.6.6

はや、数秒ですね。
[vagrant@localhost python]$ pip list
Package Version
—————– ———
awscli 1.16.198
beautifulsoup4 4.6.1
botocore 1.12.188
certifi 2018.4.16
chainer 6.4.0

import chainer

print(chainer.print_runtime_info())

Platform: Linux-2.6.32-754.14.2.el6.x86_64-x86_64-with-centos-6.10-Final
Chainer: 6.4.0
NumPy: 1.15.0
CuPy: Not Available
iDeep: Not Available
None