1
간단한 back-propagation 및 one-hot 인코딩을 사용하여 다중 계층 신경망에서 2D 데이터를 3 클래스로 분류하려고합니다. 점진적 학습을 일괄 학습으로 변경 한 후에는 출력이 0 ([0,0,0]
)으로 수렴되고 대부분 데이터 나 학습 속도가 더 빨라졌습니다. 다른 것을 파생시켜야하는지, 아니면 코드에서 버그를 만든 것인지 여부를 모르겠습니다.신경망 - 출력이 0으로 수렴됩니다, 파이썬
for each epoch: #pseudocode
for each input:
caluclate hiden neurons activations (logsig)
calculate output neurons activations (logsig)
#error propagation
for i in range(3):
error = (desired_out[i] - aktivations_out[i])
error_out[i] = error * deriv_logsig(aktivations_out[i])
t_weights_out = zip(*weights_out)
for i in range(hiden_neurons):
sum_error = sum(e*w for e, w in zip(error_out, t_weights_out[i]))
error_h[i] = sum_error * deriv_logsig(input_out[i])
#cumulate deltas
for i in range(len(weights_out)):
delta_out[i] = [d + x * coef * error_out[i] for d, x in zip(delta_out[i], input_out)]
for i in range(len(weights_h)):
delta_h[i] = [d + x * coef * error_h[i] for d, x in zip(delta_h[i], input)]
#batch learning after epoch
for i in range(len(weights_out)):
weights_out[i] = [w + delta for w, delta in zip(weights_out[i], delta_out[i])]
for i in range(len(weights_h)):
weights_h[i] = [w + delta for w, delta in zip(weights_h[i], delta_h[i])]