Effacer les filtres
Effacer les filtres

how can I change autoencoder weights?

7 vues (au cours des 30 derniers jours)
nadia
nadia le 11 Avr 2018
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.

Réponses (1)

Anurag Ojha
Anurag Ojha le 11 Juin 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:

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by