How to stop changing weights in neural network?

2 Ansichten (letzte 30 Tage)
Ayesa
Ayesa am 22 Feb. 2012
Bearbeitet: Jamie am 21 Okt. 2013
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.

Akzeptierte Antwort

Greg Heath
Greg Heath am 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

Weitere Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by