我需要获取每个步骤(number_of_training_iterations
)的明显误差,然后使用例如pandas
库对其进行绘制。
我用于训练神经元网络的代码是:
def train(self, training_set_inputs, training_set_outputs, number_of_training_iterations):
for iteration in range(0, number_of_training_iterations):
# Neuronal network predicts
output_from_hidden_layer, output_from_output_layer = self.think(training_set_inputs)
# Calculate output layer error
output_layer_error = training_set_outputs - output_from_output_layer
output_layer_delta = output_layer_error * self.__sigmoid_derivative(output_from_output_layer)
# Calculate hidden layer error
hidden_layer_error = output_layer_delta.dot(self.output_layer.synaptic_weights.T)
hidden_layer_delta = hidden_layer_error * self.__sigmoid_derivative(output_from_hidden_layer)
# How much to adjust weights
hidden_layer_adjustment = training_set_inputs.T.dot(hidden_layer_delta)
output_layer_adjustment = output_from_hidden_layer.T.dot(output_layer_delta)
# Adjust weight of each layer
self.hidden_layer.synaptic_weights += hidden_layer_adjustment
self.output_layer.synaptic_weights += output_layer_adjustment
下面的代码训练神经网络。但是我不知道如何获得每个步骤的误差并将其绘制在图形中。
任何人都知道我可以采取哪些步骤来实现这一目标?
谢谢。