随机输入神经网络的顺序的影响 [英] Effects of randomizing the order of inputs to a neural network

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

问题描述

对于我的高级算法和数据结构课程,我的教授要求我们选择对我们感兴趣的任何话题.他还告诉我们进行研究,并尝试在其中实施解决方案.我选择了神经网络,因为这是我想学习很长时间的东西.

我已经能够使用神经网络实现与",或"和异或"运算,该神经网络的神经元对激活器使用阶跃函数.之后,我尝试实现一个反向传播的神经网络,该网络学习识别XOR运算符(使用S型函数作为激活器).通过使用3-3-1网络(在输入层和隐藏层有1个偏差,权重是随机初始化的),我能够使它在90%的时间内正常工作.在其他时候,它似乎陷入了我认为是局部最小值的境地,但是我不确定(我之前曾问过这个问题,人们告诉过我,不应有局部最小值).

在90%的工作时间中,我一直按以下顺序显示输入:[0, 0], [0, 1], [1, 0], [1, 0],预期输出设置为[0, 1, 1, 0].当我以相同的顺序一致地显示值时,网络最终将学习该模式.实际上,我发送的顺序无关紧要,只要每个纪元的顺序完全相同即可.

然后,我对训练集进行了随机化,因此这次输入的顺序被充分随机化了.我现在注意到我的神经网络被卡住了并且错误正在减少,但是速度非常小(在每个时期都越来越小).一段时间后,错误开始在一个值附近振荡(因此错误不再减少).

我是这个主题的新手,到目前为止,我所知道的一切都是自学成才的(阅读教程,论文等).为什么输入的显示顺序会改变我的网络行为?是因为错误的变化从一个输入到下一个输入是一致的(因为顺序是一致的),这使得网络易于学习?

我该怎么做才能解决此问题?我正在研究反向传播算法,以确保正确实现了该算法;目前,它以学习率和动力来实现.我正在考虑寻找其他增强功能,例如自适应学习率.但是,XOR网络通常被描绘成一个非常简单的网络,因此我认为我不需要使用复杂的反向传播算法.

解决方案

向网络展示构成训练集的观测值(输入向量)的顺序仅在一个方面很重要-随机安排根据响应变量的观察结果是更可取的.

例如,假设您有150个包含训练集的观测值,并且每个响应变量是三个类别标签(I,II或III类)之一,因此,观测值1-50位于I,51类中II级为-100,III级为101-50.您不希望做的就是按此顺序将它们显示给网络.换句话说,您不希望网络看到I类中的所有50个观测值,然后II类中的所有50个观测值,然后III类中的所有50个观测值.

训练分类器时发生了什么?好吧,最初,您是向网络呈现四个无序[0,1,1,0]的观测值.

我想知道在您的网络无法收敛的那些情况下输入向量的顺序是什么?如果它是[1,1,0,0]或[0,1,1,1],则与上面提到的这个经验丰富的经验规则是一致的.

另一方面,我想知道这个规则是否甚至适用于您的情况.原因是您的训练实例很少,即使顺序为[1,1,0,0],对多个时期进行训练(我确定您必须这样做)也意味着该顺序看起来更加随机"而不是上面提到的示例(即[1、3、0、0、1、1、0、0、1、1、0、0]是如何在三个时期内向网络展示训练数据) .

诊断该问题的一些建议:

  1. 如上所述,请查看非收敛情况下输入向量的顺序-它们是否按响应变量排序?

  2. 在非收敛情况下,请查看您的体重矩阵(我假设您有两个).查找任何非常大的值(例如,其他值的100倍,或初始化时使用的值的100倍).较大的重量可能会导致溢出.

For my Advanced Algorithms and Data Structures class, my professor asked us to pick any topic that interested us. He also told us to research it and to try and implement a solution in it. I chose Neural Networks because it's something that I've wanted to learn for a long time.

I've been able to implement an AND, OR, and XOR using a neural network whose neurons use a step function for the activator. After that I tried to implement a back-propagating neural network that learns to recognize the XOR operator (using a sigmoid function as the activator). I was able to get this to work 90% of the time by using a 3-3-1 network (1 bias at the input and hidden layer, with weights initialized randomly). At other times it seems to get stuck in what I think is a local minima, but I am not sure (I've asked questions on this before and people have told me that there shouldn't be a local minima).

The 90% of the time it was working, I was consistently presenting my inputs in this order: [0, 0], [0, 1], [1, 0], [1, 0] with the expected output set to [0, 1, 1, 0]. When I present the values in the same order consistently, the network eventually learns the pattern. It actually doesn't matter in what order I send it in, as long as it is the exact same order for each epoch.

I then implemented a randomization of the training set, and so this time the order of inputs is sufficiently randomized. I've noticed now that my neural network gets stuck and the errors are decreasing, but at a very small rate (which is getting smaller at each epoch). After a while, the errors start oscillating around a value (so the error stops decreasing).

I'm a novice at this topic and everything I know so far is self-taught (reading tutorials, papers, etc.). Why does the order of presentation of inputs change the behavior of my network? Is it because the change in error is consistent from one input to the next (because the ordering is consistent), which makes it easy for the network to learn?

What can I do to fix this? I'm going over my backpropagation algorithm to make sure I've implemented it right; currently it is implemented with a learning rate and a momentum. I'm considering looking at other enhancements like an adaptive learning-rate. However, the XOR network is often portrayed as a very simple network and so I'm thinking that I shouldn't need to use a sophisticated backpropagation algorithm.

解决方案

the order in which you present the observations (input vectors) comprising your training set to the network only matters in one respect--randomized arrangement of the observations according to the response variable is strongly preferred versus ordered arrangement.

For instance, suppose you have 150 observations comprising your training set, and for each the response variable is one of three class labels (class I, II, or III), such that observations 1-50 are in class I, 51-100 in class II, and 101-50 in class III. What you do not want to do is present them to the network in that order. In other words, you do not want the network to see all 50 observations in class I, then all 50 in class II, then all 50 in class III.

What happened during training your classifier? Well initially you were presenting the four observations to your network, unordered [0, 1, 1, 0].

I wonder what was the ordering of the input vectors in those instances in which your network failed to converge? If it was [1, 1, 0, 0], or [0, 1, 1, 1], this is consistent with this well-documented empirical rule i mentioned above.

On the other hand, i have to wonder whether this rule even applies in your case. The reason is that you have so few training instances that even if the order is [1, 1, 0, 0], training over multiple epochs (which i am sure you must be doing) will mean that this ordering looks more "randomized" rather than the exemplar i mentioned above (i.e., [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0] is how the network would be presented with the training data over three epochs).

Some suggestions to diagnose the problem:

  1. As i mentioned above, look at the ordering of your input vectors in the non-convergence cases--are they sorted by response variable?

  2. In the non-convergence cases, look at your weight matrices (i assume you have two of them). Look for any values that are very large (e.g., 100x the others, or 100x the value it was initialized with). Large weights can cause overflow.

这篇关于随机输入神经网络的顺序的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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