Borrar filtros
Borrar filtros

how to freeze and reset the weights to initial values of neural network.?

24 visualizaciones (últimos 30 días)
I have a trained RL agent and now i want to retrain only a selected few layers of same agent while keeping some of layers of actor and critic to remain freezed. how can i do it ? I am attaching a agent for reference .
So i need two things one is how to freeze a certain layers of actor and critic network while training an RL agent again.
and how can i reset the weights of a specific layer of trained RL agent`s actor and critic network.
any help would be really appreciated thanks.

Respuestas (1)

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis el 12 de Feb. de 2024
You can accomplish what you asked with something along the lines of:
init_model = getModel(getCritic(agent));
new_model_layers = init_model.Layers;
new_model_layers(2).WeightLearnRateFactor = 0; %select appropriate index
new_model_layers(2).Weights = single(zeros(20,4));
new_model = dlnetwork(new_model_layers);
%reset critic
critic = getCritic(agent);
critic = setModel(critic,new_model);
agent = setCritic(agent,critic);

Community Treasure Hunt

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

Start Hunting!

Translated by