how can I change autoencoder weights?

2 visualizaciones (últimos 30 días)
nadia
nadia el 11 de Abr. de 2018
Respondida: Anurag Ojha el 11 de Jun. de 2024
Hi, I train an autoencoder in matlab R2016a and I want to change some weights of encoder or decoder and flip them to zero or one, but by doing it, I saw this error"You cannot set the read-only property 'EncoderWeights' of Autoencoder.". I need to change the weights and consider the changes. how can I do it? is there any way to solve this problem? thanks.

Respuestas (1)

Anurag Ojha
Anurag Ojha el 11 de Jun. de 2024
Hi Nadia
Unfortunately, you cannot directly modify the weights of an autoencoder in MATLAB. The 'EncoderWeights' property is read-only, which means you cannot change its values. However, you can train a new autoencoder with the desired weights by specifying the 'EncoderWeights' option during training.
Here's an example:
% Create and train an autoencoder
autoenc = trainAutoencoder(X, hiddenSize);
% Modify the weights
newWeights = ones(size(autoenc.EncoderWeights)); % Set all weights to 1
% Train a new autoencoder with the modified weights
newAutoenc = trainAutoencoder(X, hiddenSize, 'EncoderWeights', newWeights);
Adding MATLAB documentation, for your reference:

Categorías

Más información sobre Pattern Recognition and Classification en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by