Skip to content

权重更新问题,def update_parameters(network, row, l_rate): #3

@QandYH

Description

@QandYH

def update_parameters(network, row, l_rate):
"""利用误差更新神经网络的参数(权重矩阵和偏置项)
:param network: 神经网络
:param row: 一个样本数据
:param l_rate: 学习率
:return:
"""
for i in range(len(network)):
inputs = row[:-1]
if i != 0: # 获取上一层网络的输出
inputs = [neuron['output'] for neuron in network[i - 1]]
for neuron in network[i]:
# 更新权重矩阵
for j in range(len(inputs)):
neuron['weights'][j] += l_rate * neuron['delta'] * inputs[j]
# 更新偏置项
neuron['weights'][-1] += l_rate * neuron['delta']这个函数为什么和公式不同,是公式给错了吗

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions