Assigning weight and bias values for a Network
1 次查看(过去 30 天)
显示 更早的评论
Hello all.. My network has 3 inputs, 5 neurons in a single hidden layer and 1 output. I observed that ANN automatically assigns weight and bias values for my network and thus training and simulation of the network 5 times will always generate 5 different output values. So after training/simulation I extracted the weight and bias values of the network using the code below
InputWeight = myFunc.IW{1};
LayerWeight = myFunc.LW{2};
b1 = myFunc.b{1,1};
b2 = myFunc.b{2,1};
I assigned these values to my network's IW, LW, b1 and b2 using the code below... (InputData is an (3xN) matrix and OutputData a (1xN) matrix)
NormInp = minmax(InputData);
myFunc = newff(NormInp, [5,1],{'tansig', 'purelin'});
myFunc = configure(myFunc,InputData, OutputData);
myFunc.IW{1,1} = IW;
myFunc.b{1,1} = b1;
myFunc.LW{2,1} = LW;
myFunc.b{2,1} = b2;
myFunc = train(myFunc, InputData, OutputData);
myOut = sim(myFunc,InputData);
Running this code about 5 times, generated exactly the same output. But when I change, the activation functions to;
myFunc = newff(NormInp, [5,1],{'purelin','tansig'});
normalize input/outputdata to [-1 to +1] and de-normalize the output, each element of the output matrix turns out to be the same i.e having a (1xN) matrix in which each of the elements is equal to 77. Please does anyone know what is responsible for the wrong output??
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Install Products 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!