Clear Filters
Clear Filters

is it possible to touch the weights & bias in neural network toolbox

3 views (last 30 days)
i am right now using neural network toolbox. and would love to do something on weights during training, like apply the saturation function on weights. but cannot find any helpful solution could anybody give any solution for this?

Answers (1)

Greg Heath
Greg Heath on 14 Feb 2018
% OMIT THE ENDING SEMICOLONS IN THE FOLLOWING 2 COMMANDS
net = fitnet
TRAINPARAM = net.trainParam
% You can directly modify every property listed. For example
net.trainParam.mu = 0.002;
% Now check to se if mu is changed
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 Comment
Lin Bai
Lin Bai on 14 Feb 2018
Thank you Greg, but this looks like how to get access to the weights/biases. My problem is to do something during training.
I used the following code to train, seems i have no access to the weights during training.
layers = [
imageInputLayer([28 28 1])
convolution2dLayer(3,16,'Padding',1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding',1)
batchNormalizationLayer
*myLayer(change weight when back propagation)*
reluLayer...];
options = trainingOptions('sgdm',...
'MaxEpochs',6, ...
'ValidationData',{valImages,valLabels},...
'ValidationFrequency',30,...
'Verbose',false,...
'Plots','training-progress');
net = trainNetwork(trainImages,trainLabels,layers,options);

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!