训练好,预测差

发布于 2024-10-04 15:30:02 字数 657 浏览 0 评论 0原文

我已经编写了一个用于在神经网络中进行预测的代码...

训练中的误差很好(低于 1%),但是对于预测来说误差很高(大约 20%)...我认为我的网络训练过度了,但我不知道不知道解决这个问题的方法...我改变了层数、神经元数量和训练函数,但结果没有改变...

所以我把我的代码放在这个论坛上,希望得到答案它: 链接文本

此 zip 文件包含 2 个文件:

1-数据的 Excel 文件:第 1-4 行用于训练输入,第 5 行用于训练输出(第 6 行是输出,但在此代码中未使用),第 7-10 行用于测试输入,第 11 行用于测试输出。

2-matlab代码

运行程序后出现4个图表:第一行是训练数据,第二行是测试数据。

如果有人知道答案,请更改我的代码并重新输入。

多谢。

编辑:

更多描述:

我有 2 个输出,每个输出有两个代码...对于第 6 行(第二个输出),此代码具有可接受的结果,但对于第 5 行没有好的结果...

请更改我的代码并应用您的建议,然后如果您认为您的建议有用,请将其放在这里...我在其他论坛收到了一些建议,这些建议是通用解决方案,对结果没有影响...

I've written a code for prediction in neural network...

the error in training is good ( below 1 %) but for prediction the error is high ( about 20 %)...I think my network is over trained but i don't know a way to solve this problem...I've changed number of layers,number of neurons and training function but the result has not changed...

so I put my code in this forum and hope to get an answer for it:
link text

this zip file contains 2 files:

1-an Excel file for datas : lines 1-4 for training input, line 5 for training output (line 6 is output but didn't use in this code), line 7-10 for testing input, line 11 for testing output.

2-matlab code

after running the program 4 chart appear: first row is for trained data and second row for tested datas.

if somebody knows the answer, please change my code and put it again.

thanks a lot.

EDIT:

more description:

I have 2 output and two code for each...for line 6 ( second output) this code has acceptable results but for line 5 no good result...

please change my code and apply your suggestions on it and put it here if you think that your suggestion is useful...I have received some suggestions in other forums that are general solutions with no influence on results...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

陌生 2024-10-11 15:30:02

正如人们所提到的,您可能对训练数据过度拟合了人工神经网络。根据数据集,如果训练足够长的时间,您可能会得到任意良好的训练数据拟合。另一个问题可能是训练数据不能正确表示问题空间。即测试数据中的输入与您用于训练的数据非常不同。如果是这种情况,人工神经网络就无法充分发挥作用。

为了克服过度拟合,试试这个。将数据分成3组;培训、验证和测试。在训练人工神经网络时,还会计算验证集上的误差。如果验证集在 5 个时期内没有改善(您始终可以配置它),则停止训练。

另外,作为一般观点。我没有机会查看您的数据和源代码,但请记住,您将需要大量数据才能获得良好的结果。如果您只有几个数据点,那么将很难/不可能取得好的结果。

我建议您阅读此处的指南,以对许多内容有一个很好的概述ANN 的各个方面。

祝你好运!

As people have mentioned you are likely overfitting the ANN to the training data. Depending on the dataset you might get an arbitrarily good fit of the training data if you train long enough.. Another problem could be that the training data does not properly represent the problem space. I.e. there are inputs in the test data that are very dissimilar to the data you used for training. If that is the case there is no way the ANN can function adequately.

In order to overcome the overfitting, try this. Split the data into 3 sets; training, validation and testing. While training the ANN also calculate the error on the validation set. If the validation set does not improve for, let's say, 5 epochs (you can always configure this) then stop training.

Also, as a general point. I did not have a chance to look at your data and source code, but remember that you will need a significant amount of data in order to get good results. If you only have a few datapoints then it will be very hard/impossible to achieve good results.

I recommend reading the guide here for a good overview of many aspects of ANNs.

Good luck!

抠脚大汉 2024-10-11 15:30:02

如果您认为问题可能是过度训练,请尝试训练它们,直到它们的错误率达到 5%、10%,而不是 1%。你的错误百分比越低,他们就越难概括——他们只会知道准确地识别你给他们的东西。

If you believe the problem might be overtraining, try training them until they have 5%, 10% error instead of 1%. The lower your error percentage, the more difficult will be for them to generalize -- they'll just know to recognize EXACTLY what you gave them.

林空鹿饮溪 2024-10-11 15:30:02

如果您使用 Matlab,请尝试使用贝叶斯正则化而不是默认的 Levenberg-Marquardt 算法来训练您的网络(net.trainFcn = 'trainbr' 而不是 trainlm)

If you are using Matlab try training your network with Bayesian regularization instead of default Levenberg-Marquardt algorithm (net.trainFcn = 'trainbr' instead of trainlm)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文