How to stop changing weights in neural network?

3 views (last 30 days)
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.

Accepted Answer

Greg Heath
Greg Heath on 22 Feb 2012
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

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!