训练神经网络来添加 [英] Training a neural network to add

查看:84
本文介绍了训练神经网络来添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要训练一个网络来相乘或相加2个输入,但是对于20000之后的所有点来说,它似乎都不是很好 迭代.更具体地说,我在整个数据集上对其进行训练,它对于最后一点非常接近,但是似乎 好像对于第一个端点来说并没有什么好转.我将数据归一化,使它介于-0.8和0.8之间.这 网络本身由2个输入3个隐藏神经元和1个输出神经元组成.我还将网络的学习率设置为0.25, 并将其用作学习函数tanh(x).

I need to train a network to multiply or add 2 inputs, but it doesn't seem to approximate well for all points after 20000 iterations. More specifically, I train it on the whole dataset and it approximates well for the last points, but it seems like it isn't getting any better for the first endpoints. I normalize the data so that it is between -0.8 and 0.8. The network itself consists of 2 inputs 3 hidden neurons and 1 output neuron. I also set the network's learning rate to 0.25, and use as a learning function tanh(x).

对于在数据集中最后训练的点,它的近似值非常好,但是对于第一个点,它看起来像 不能很好地估计.我想知道它是什么,不管是我使用的拓扑结构,还是它都无法很好地进行调整 还有其他东西吗?

It approximates really well for points that are trained last in the dataset, but for the first points it seems like it can't approximate well. I wonder what it is, that isn't helping it adjust well, whether it is the topology I am using, or something else?

在该网络的隐藏层中还有多少个神经元合适?

Also how many neurons are appropriate in the hidden layer for this network?

推荐答案

考虑一下,如果用线性函数x替换tanh(x)阈值函数-称其为a.x-并将a视为每个神经元的唯一学习参数.这实际上就是您的网络将要优化的目标;这是tanh函数的零交叉的近似值.

Think about what would happen if you replaced your tanh(x) threshold function with a linear function of x - call it a.x - and treat a as the sole learning parameter in each neuron. That's effectively what your network will be optimising towards; it's an approximation of the zero-crossing of the tanh function.

现在,当您层叠此线性类型的神经元时会发生什么?当脉冲从输入到输出时,您乘上每个神经元的输出.您正在尝试通过一组乘法来近似加法.正如他们所说,这不会计算.

Now, what happens when you layer neurons of this linear type? You multiply the output of each neuron as the pulse goes from input to output. You're trying to approximate addition with a set of multiplications. That, as they say, does not compute.

这篇关于训练神经网络来添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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