0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

3層ニューラルネットワークの実装

Posted at

#chainerを使って簡単な3層のニューラルネットワークを実装
今回はDeep Learning向けのフレームワークであるChainerを使ってモデルを作成。
1.入力層、隠れ層、出力層のノード数をそれぞれ3,2,4
2.全結合の順伝播型ニューラルネットワーク
3.活性化関数として今回はrelu関数

neuralnetwork.py
import chainer
import chainer.links as L
import chainer.functions as F
import numpy as np
np.random.seed(1)
fc1 = L.Linear(3, 2)
fc2 = L.Linear(2, 4)
x = np.array([[1, 2, 3]], "f")
u1 = fc1(x)
z1 = F.relu(u1)
y = fc2(z1)

また重み行列Wとバイアスベクトルbの結果も表示

fc1.W
fc1.b
fc2.W
fc2.b

使用した関数のリンク
chainer.links.Linear(https://docs.chainer.org/en/stable/reference/generated/chainer.links.Linear.html#chainer.links.Linear)
chainer.functions.relu(https://docs.chainer.org/en/stable/reference/generated/chainer.functions.relu.html#chainer.functions.relu)

0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?