MATLAB Answers

Modifing the weights of neural network by setting some weughts to zero

1 view (last 30 days)
Salem on 30 Mar 2016
Is there way to access the weights of deep neural networks and set some weights to zero of pretrained model then compute the accuracy of the model. I am working in a project and I need to do the following steps:
  1. train the model or download pretrained model
  2. Set some weights to zeros
  3. Do some computation (this is will be my work)
  4. Test the model again (without trian it again)
I tried those steps on the model pretrind myself using AutoencoderDigitsExample and accessed to the weights for example
but I could not modified the weights of the model when I did so
I recieved this error
You cannot set the read-only property 'EncoderWeights' of Autoencoder.
So please I am looking for a way to accessing the weights of any neural network pretrrained model trained by Matlab.
  1 Comment
cedric MAGUETA RUIVO on 19 Aug 2016
you can transform the autoencoder object into a neural network object with the network fonction and then use the IW and LW properties
net.IW{1}(1,1)=0; % set the first weigth of the first layer to zero
but with this methode ou can not more use the encode or decode function

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!