大工至善|大学至真分享 http://blog.sciencenet.cn/u/lcj2212916

博文

[转载]【源码】神经网络训练仿真

已有 1164 次阅读 2019-3-7 08:02 |系统分类:科研笔记|文章来源:转载

本程序训练了多个神经网络(它们的隐藏层神经元数量不同),并允许用户选择性能最好的网络。

The program trains several neural networks (that vary in their number of hidden layer neurons) and enables users to pick the best. 


该程序分别使用名为Inputs1.txt和Targets1.txt文件中包含的输入和目标数据来训练网络。

The program trains the networks using input and target data contained in files named Inputs1.txt and Targets1.txt respectively. 


程序将提供的数据随机分成3部分:70%用于训练,15%用于验证,15%用于测试

The program randomly splits the supplied data into 3 portions: 70% for training, 15% for validation, and 15% for testing. 


用户可以选择在第68行到第70行中更改以上数据的比例。

The user has the option to change this proportioning in lines 68 to 70.


用户还可以选择使用自己的测试数据:这些数据应与Inputs2.txt和Targets2.txt相同的格式保存。

The user also has the option to use his/her own test data: these should be saved in same format as Inputs2.txt and Targets2.txt


当程序运行时,将训练100个不同的网络:各网络的隐藏层神经元数量不同。

When the program runs, it trains 100 different networks: the networks differ in their number of hidden layer neurons. 


生成的神经网络保存在名为networks的文件夹中,该文件夹与运行此程序的文件夹相同。

The networks generated are saved in in a folder named networks, within the same folder where this program is run. 


保存为net1的网络有1个隐藏层神经元,net2有2个,net3有3个,net4有4个,…

The network saved as net1 has 1 hidden layer neuron, net2 has 2, net3 has 3, net4 has 4,....


用户可以将第65行中的值1:100更改为所需的隐藏层神经元个数。

Users may change the values 1:100 in line 65 to their desired values.


trainlm采用了Levenberg-Marquardt算法进行训练。

Training is done using the Levenberg-Marquardt algorithm, trainlm. 


用户也可以通过修改第62行来更改自己需要的算法。

Users may change to their desired algorithm by changing line 62.


该程序还将计算得到均方根误差(RMSEs)保存在一个名为rmse.txt的文件中。

The program also computes and saves root-mean-squared-errors (RMSEs) in a file named rmse.txt. 


文件中的数据分为3列:第1列为隐藏层神经元的数量,第2列为根据随机15%测试数据计算的RMSE,第3列为根据用户自己的测试数据计算的RMSE。

Data in the file is in 3 columns: column 1 for the number of hidden layer neurons, column 2 for the RMSE computed on the random 15% test data, and column 3 for the RMSE computed on the user's own test data.


此文件上的数据将指导用户决定哪种神经网络的性能最好。

The data on this file guides the user to decide which of the networks is best. 


具有较小RMSE的网络性能更好,尤其是对于根据用户自己的测试数据计算的RMSE,这些数据超出了用于训练的数据覆盖范围。

Networks with smaller RMSEs are better, especially for the RMSEs computed on the user's own test data which is outside the range of data used for the training. 


关于如何使用RMSE来选择最优网络的更详细的指南包含在本程序作者编写的一本书中,书名为“Computer Neural Networks on MATLAB”。

More detailed guide on how to use the RMSEs to choose an optimal network is contained in a book authored by the writer of this program and titled "Computer Neural Networks on MATLAB"。


完整源码下载地址:

http://page2.dfpan.com/fs/5lcej2c21929116e3a7/  


更多精彩文章请关注微信号:qrcode_for_gh_60b944f6c215_258.jpg




https://blog.sciencenet.cn/blog-69686-1166130.html

上一篇:[转载]关于判决树学习
下一篇:[转载]【新书推荐】【2019.12】无线网络技术与网络安全
收藏 IP: 111.38.170.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-26 10:40

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部