方式1:手推写神经元节点的前向、后向计算(参数更新) import numpy as np _w = [0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65] _b = [0.35, 0.65] _x = [5, 10] _y = [0.01, 0.09] lr = 0.5 def w(index): return _w[index - 1] def x(index): return _x[index - 1] def b(index): return _b[index - 1] def y(index): return _y[index - 1] def set_w(index, gd): _w[index - 1] = _w[index - 1] - lr * gd def sigmoid(z): return 1.0 / (1 + np.exp(-z)) def training(): # 前向传播节点计算 neth1 = w(1) * x(1) + w(2) * x(2) + b(1) outh1 = sigmoid(neth1) neth2 = w(3) * x(1) + w(4) * x(2) + b(1) outh2 = sigmoid(neth2) neth3 = w(5) * x(1) + w(6) * x(2) + b(1) outh3 = sigmoid(neth3) neto1 = w(7) * outh1 + w(9) * outh2 + w(11) * outh3 + b(2) outo1 = sigmoid(neto1) neto2 = w(8) * outh1 + w(10) * outh2 + w(12) * outh3 + b(2) outo2 =
构成CNN主要组件思想---BP
于 2024-04-08 10:55:43 首次发布