反向传播神经网络的多个输入 [英] Multiple Inputs for Backpropagation Neural Network

查看:87
本文介绍了反向传播神经网络的多个输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为此工作了大约一个星期.我的编码没有错误,我只需要正确的算法和概念即可.我实现了一个由1个隐藏层组成的神经网络.我使用反向传播算法来校正权重.

I've been working on this for about a week. There are no errors in my coding, I just need to get algorithm and concept right. I've implemented a neural network consisting of 1 hidden layer. I use the backpropagation algorithm to correct the weights.

我的问题是网络只能学习一种模式.如果我一遍又一遍地使用相同的训练数据进行训练,那么在给定的输入在数值上接近训练数据的情况下,它将产生所需的输出.

My problem is that the network can only learn one pattern. If I train it with the same training data over and over again, it produces the desired outputs when given input that is numerically close to the training data.

training_input:1、2、3training_output:0.6、0.25

training_input:1, 2, 3 training_output: 0.6, 0.25

在300个时代之后......

after 300 epochs....

输入:1、2、3输出:0.6、0.25

input: 1, 2, 3 output: 0.6, 0.25

输入1、1、2输出:0.5853,0.213245

input 1, 1, 2 output: 0.5853, 0.213245

但是,如果我使用多个不同的训练集,它只会学习最后一个模式.神经网络不是应该学习多种模式吗?这是一个常见的初学者错误吗?如果是的话,请指出正确的方向.我看过许多在线指南,但从未见过有关处理多种输入的详细信息.我将sigmoid用于隐藏层,将tanh用于输出层.

But if I use multiple varying training sets, it only learns the last pattern. Aren't neural networks supposed to learn multiple patterns? Is this a common beginner mistake? If yes then point me in the right direction. I've looked at many online guides, but I've never seen one that goes into detail about dealing with multiple input. I'm using sigmoid for the hidden layer and tanh for the output layer.

+

训练数组示例:

13  tcp telnet  SF  118 2425    0   0   0   0   0   1   0   0   0   0   0   0   0   0   0   0   1   1   0   0   0   0   1   0   0   26  10  0.38    0.12    0.04    0   0   0   0.12    0.3 anomaly

0   udp private SF  44  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   4   3   0   0   0   0   0.75    0.5 0   255 254 1   0.01    0.01    0   0   0   0   0   anomaly

0   tcp telnet  S3  0   44  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   1   1   1   0   0   1   0   0   255 79  0.31    0.61    0   0   0.21    0.68    0.6 0   anomaly

最后一列(异常/正常)是预期的输出.我将所有内容都转换为数字,因此每个单词都可以由一个唯一的整数表示.

The last columns(anomaly/normal) are the expected outputs. I turn everything into numbers, so each word can be represented by a unique integer.

我一次给网络分配一个数组,然后使用最后一列作为预期的输出来调整权重.我大约有300个这样的数组.

I give the network one array at a time, then I use the last column as the expected output to adjust the weights. I have around 300 arrays like these.

对于隐藏的神经元,我尝试了3、6和20,但没有任何改变.

As for the hidden neurons, I tried from 3, 6 and 20 but nothing changed.

+

要更新权重,我计算输出层和隐藏层的梯度.然后,我计算增量并将其添加到其关联的权重中.我不明白如何学习将多个输入映射到多个输出.它看起来是线性的.

To update the weights, I calculate the gradient for the output and hidden layers. Then I calculate the deltas and add them to their associated weights. I don't understand how that is ever going to learn to map multiple inputs to multiple outputs. It looks linear.

推荐答案

如果通过反向传播算法对神经网络进行过多训练,则对于一个数据集,权重最终将收敛为一种状态,它将为该特定训练集提供最佳结果(机器学习的过度训练).它只会了解该特定训练集的输入数据和目标数据之间的关系,而不会了解您可能正在寻找的更广泛的一般关系.最好合并一些独特的集合,并在整个集合上训练您的网络.

If you train a neural network too much, with respect to the number of iterations through the back-propagation algorithm, on one data set the weights will eventually converge to a state where it will give the best outcome for that specific training set (overtraining for machine learning). It will only learn the relationships between input and target data for that specific training set, but not the broader more general relationship that you might be looking for. It's better to merge some distinctive sets and train your network on the full set.

在没有看到反向传播算法代码的情况下,我无法给您任何有关反向传播算法是否正常工作的建议.我在执行反向传播时遇到的一个问题是无法正确计算围绕输入值的激活函数的导数.这个网站对我很有帮助.

Without seeing the code for the back-propagation algorithm I could not give you any advice on if it's working correctly. One problem I had when implementing the back-propagation was not properly calculating the derivative of the activation function around the input value. This website was very helpful for me.

这篇关于反向传播神经网络的多个输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆