神经网络问题
我在我的项目中使用外部库用于人工神经网络。
在测试 ANN 时,它给了我所有 NaN
的输出(不是 C# 中的数字)
ANN 有 8 个输入、5 个隐藏层、5 个隐藏层、2 个输出,并且所有激活层都是线性类型,并且它使用反向传播,学习率为0.65
我使用了一个测试用例进行训练
{ -2.2, 1.3, 0.4, 0.5, 0.1, 5, 3, -5 } ,{ -0.3, 0.2 }
1000 epoch我在
{ 0.2, -0.2, 5.3, 0.4, 0.5, 0, 35, 0.0 }
上测试了它,得到了{ NaN , NaN}
注意:这是产生相同情况的许多示例之一...
我正在尝试发现它是否是库中的错误,或者不合逻辑的配置......
我可以想到的原因对于不合逻辑的配置:
- 所有层不应该是线性的
- 不能有尺寸递减的层,即
8-5-5-2
不好.. - 只有一个测试用例?
- 值必须在 [0,1] 或 [-1,1] 范围内
上述任何原因都可能是导致错误的原因,或者在 ANN 设计中存在一些我不知道的约束/规则。 ?
注意:我是 ANN 的新手
I am using an external library for Artificial Neural Networks in my project..
While testing the ANN, It gave me output of all NaN
(not a number in C#)
The ANN has 8 input , 5 hidden , 5 hidden , 2 output, and all activation layers are of Linear type , and it uses back-propagation, with learning rate 0.65
I used one testcase for training
{ -2.2, 1.3, 0.4, 0.5, 0.1, 5, 3, -5 } ,{ -0.3, 0.2 }
for 1000 epochAnd I tested it on
{ 0.2, -0.2, 5.3, 0.4, 0.5, 0, 35, 0.0 }
which gave{ NaN , NaN}
Note: this is one example of many that produces same case...
I am trying to discover whether it is a bug in the library, or an illogical configuration..
The reasons I could think of for illogical configuration:
- All layers should not be linear
- Can not have descending size layers, i.e
8-5-5-2
is bad.. - Only one testcase ?
- Values must be in range [0,1] or [-1,1]
Is any of the above reasons could be the cause of error, or there are some constraints/rules that I do not know in ANN designing..?
Note: I am newbie in ANN
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,如果不了解您正在使用的库的任何信息,就不容易猜测。通常,ANN 输入需要介于 0..1 或 -1..1 之间,因此可能是因为您的值超出该范围,从而导致不幸的结果。
如果上述是问题的原因,则有许多技术可以对要传递给 ANN 的数据进行编码,例如,您可以缩放输入以确保它们始终在范围内并保持相对关系。
Well, with out knowing anything about the library you are using it is not easy to guess. Typically a ANN inputs are required to be between 0..1 or -1..1, so maybe it is because you have values outside of that range causing the unfortunate results.
If the above is the cause of the problem, there are a number of techniquest for encoding data to be passed to a ANN, for example you could scale your inputs to ensure they are always in range and maintain the relative relationship.