如何解决不麻木的基本神经网络->了解迭代步骤
我试图可视化以下神经网络代码正在执行的步骤。这是绝对的基础,甚至不使用Numpy也能直观地看到并意识到代码中正在发生的事情:
这是到目前为止的注释代码:
weights = ([0.1,0.1,-0.3],#first matrix weight´s
[0.1,0.2,0.0],[0.0,1.3,0.1])
info1 = [8.5,9.5,9.9,9.0] #second matrix info´s
info2 = [0.65,0.8,0.9]
info3 = [1.2,0.5,1.0]
input = [info1[0],info2[0],info3[0]]
def w_sum(a,b): #(weighted) sum function
assert(len(a) == len(b))
output = 0
for i in range(len(a)):
output += (a[i] * b[i])
return output
def vect_mat_mul(vect,matrix): #dot product function
assert(len(vect) == len(matrix))
output = [0,0]
for i in range (len(vect)):
output[i] = w_sum(vect,matrix[i]) # updates the output = [0,0] list with the
# result of w_sum(a,b) on position [i]
# every iteration step i
return output
def neural_network(input,weights): #inputting the start values into the network
pred = vect_mat_mul(input,weights)
return pred
pred = neural_network(input,weights) #calling the network --> the variable
# 'output = [0,0] is Now updated with the
# values from the dot product
# and 'transported outwards' by assigning the return of the network to "pred"
print(pred)
在这里,我试图可视化正在发生的事情:
代码正在执行的第二个“迭代”步骤
代码正在执行的第三个“迭代”步骤
因此,最后是典型的神经网络图,其中包含所有步骤及其链接:
现在我的问题是:正确吗?就像Python真的真的通过这两个函数在第三个函数(网络函数)中连接并正确链接到3 x 3矩阵点积的循环遍历for循环一样吗?
一开始就是魔术吗?
问题:
-
下一步将是什么?
-
如何遍历info1,info2和info3列表的输入值?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。