How to stop changing weights in neural network?
3 次查看(过去 30 天)
显示 更早的评论
I have assigned the input weights and layer weights to NN and i want that these weights should be fixed through out the whole training process. 'trainlm' is used which calls 'calcperf2.m' function.
But while training the NN, i found that the weights are changing. (I found it from line no. 134 and 151 in 'calcperf2.m' file).
How can be this weight changing stopped? I want the weights should not be changed and it should be same as assigned weights.
Following is my NN code:
input = [0 0 1 1; 0 1 0 1];
target = [0 1 1 0];
net = newff(input,target,[2],{'tansig','tansig'},'mytrainlm');
net.IW{1,1} = [ 3.1984 -3.1330; -2.6130 2.6804];
net.LW{2,1} = [ 7.3493 7.5012];
[net tr Y E] = train(net,input,target)
outputs = sim(net,input)
Please help me. Thanks.
0 个评论
采纳的回答
Greg Heath
2012-2-22
The whole purpose of training is to change weights from assigned inital values to final values that correspond to the minimum of an objective function.
If you don't want the initial weights to change, do not use train.
Hope this helps.
Greg
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!