MATLAB中的神经网络,初始权重 [英] Neural Networks in MATLAB, initial weights

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

问题描述

我用newff(...)在MATLAB中建立了神经网络.当您使用相同的输入和输出对其进行训练时,在不同的运行中训练结果会有所不同.我知道发生这种情况是因为每次运行时权重都不同.我的问题是,每次训练NN时如何使初始权重相同,以便获得相同的结果? 此外,是否有可能从训练No1中节省一些权重,然后再将其用于训练No2中?如何实现?

I made Neural Network in MATLAB with newff(...). When you train it with the same inputs and outputs, the training results are different on different runs. I understand that it is happening because the weights are different for each time I run it. My question is how to make initial weights to be the same each time I train my NN so I can get the same results? Also, is it possible to save some weights from training No1 and latter use it for training No2, and how?

Tnx

推荐答案

方式(取决于您所使用的MATLAB版本):

To generate reproducible results, you need to manually set the random number generator to the same seed/state at the beginning of the code. This can be done in a number of ways (depending on what version of MATLAB you have):

旧样式:

rand('twister',1234)

更新后的样式:

RandStream.setGlobalStream( RandStream('mt19937ar','Seed',1234) );

R2011a中引入了新功能,该功能简化了最后一个功能.致电:

A new function was introduced in R2011a that simplifies the last call:

rng(1234,'twister')

后一种语法是推荐的方法.

The latter syntax is the recommended approach.

这篇关于MATLAB中的神经网络,初始权重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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