我正在研究神經網絡。我正在探索使用大型數據集進行培訓的效果。目前我正在蹩腳的結果。有什麼建議麼?我不想使用除numpy以外的任何庫,請保持簡單。我是一名GCSE學生,所以我對微積分也不瞭解。 爲了提高我的網絡IVE說: 第二隱藏層, 多個時期, 不同的激活功能(RELU而不是乙狀結腸),每層 更多隱藏節點...但我的結果仍然是可怕的!神經網絡結果不好
import numpy as np
x = np.array([
[0000],
[0001],
[0010],
[0100],
[1000],
[0011],
[0110],
[1100],
[1001],
[1001],
[1110],
[1101],
[1011],
[1111],
[1111],
[1111],
[1111]
])
y = np.array([
[0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1]
]).T
w = np.random.random((1, 1))
w2 = np.random.random((1, 1))
w3 = np.random.random((1, 1))
for j in xrange(500000):
a2 = 1/(1 + np.exp(-(np.dot(x, w))))
a3 = 1/(1 + np.exp(-(np.dot(a2, w2))))
a4 = 1/(1 + np.exp(-(np.dot(a3, w3))))
a4delta = (y - a4) * (a4 * (1 - a4))
a3delta = a4delta.dot(w3.T) * (a3 * (1 - a3))
a2delta = a3delta.dot(w2.T) * (a2 * (1 - a2))
w3 += a3.T.dot(a4delta)
w2 += a2.T.dot(a3delta)
w += x.T.dot(a2delta)
print(a4)
您是否試圖確定二進制序列是否以1結尾? –
另外,我對Python有點熟悉,但是我不能讓你的代碼運行,因爲它認爲'0001'是一個無效的標記,也許是因爲你有前導0。有什麼我失蹤? –