不麻木的基本神经网络->了解迭代步骤

问题描述

我试图可视化以下神经网络代码正在执行的步骤。这是绝对的基础,甚至不使用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)

在这里,我试图可视化正在发生的事情:

代码正在执行的第一个“迭代”步骤

The first "iteration" step the code is executing

代码正在执行的第二个“迭代”步骤

The second "iteration" step the code is executing

代码正在执行的第三个“迭代”步骤

The third "iteration" step the code executes

因此,最后是典型的神经网络图,其中包含所有步骤及其链接

all the three steps

现在我的问题是:正确吗?就像Python真的真的通过这两个函数在第三个函数(网络函数)中连接并正确链接到3 x 3矩阵点积的循环遍历for循环一样吗?

一开始就是魔术吗?

问题:

  1. 下一步将是什么?

  2. 如何遍历info1,info2和info3列表的输入值?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...