
Re: Bug in Disable the Randomization of Weights and Bias in Neural Network
Posted:
Mar 1, 2013 2:40 AM


"Subodh Paudel" <subodhpaudel@gmail.com> wrote in message <kgn590$2uj$1@newscl01ah.mathworks.com>... > Hi Matlab Expert, > I am using Matlab 2009a and 2009b. After my finding the weights and biases, i used the neural network; but it gives the different R2 value. I have used different methodologies to solve it. Because, my target is to fixed only the same weights for the >learning phase.
I don't understand , especially the last sentence.
Are you saying that when you insert trained weights into a new net, you get a different answer? If so, did you account for the fact that there is an automatic default normalization of variables that the weights act on?
> 1) When i obtain the weight and bias, after the newff .............., i disable the random initialization value and initialize my own weight. I did just like this: > > net=newff(P,T,H) > stream = RandStream.getDefaultStream; > reset(stream); > net.IW{1,1}=input_weight; > net.LW{2,1}=hidden_weight; > net.b{1}=bias_hiddenneurons; > net.b{2}=bias_output; > > Also, i found the randomization of the data using dividerand, then i also used below command to disable any randomization, but it does not work. > > net.divideFcn='';
This is the same as net.divideFcn = 'dividetrain' so there are no validationor training sets. > 2) Finally, i used as rand state because in my matlab it does not support rng(0).......... It does not again work > > rand ('state',0) > net=newff(P,T,H) > net.IW{1,1}=input_weight; > net.LW{2,1}=hidden_weight; > net.b{1}=bias_hiddenneurons; > net.b{2}=bias_out;
I assume that next you train the net? > when i calculate my R¨^2 value from several trials and the best trails, my R¨^2 value is 0.95 and obtain the weights and bias from it; and put in th > after the rand('state',0) and newff............, my R¨^2 value is 0.87, its value is decreasing, which i don't expect. Please, help me is there is bug in matlab or something i don't know the tricks to solve it. > I don't fully understand what you are doing.
Why don't you post your full code with comments and the results of a run on one of the MATLAB demo datasets.
help nndatasets.
Greg

