Get actor representation from reinforcement learning agent


actor = getActor(agent)



actor = getActor(agent) returns the actor representation object for the specified reinforcement learning agent.


collapse all

Assume that you have an existing trained reinforcement learning agent, agent.

Obtain the actor representation from the agent.

actor = getActor(agent);

Obtain the learnable parameters from the critic.

params = getLearnableParameters(actor);

Modify the parameter values. For this example, simply multiply all of the parameters by 2.

modifiedParams = cellfun(@(x) x*2,params,'UniformOutput',false);

Set the parameter values of the critic to the new modified values.

actor = setLearnableParameterValues(actor,modifiedParams);

Set the critic in the agent to the new modified critic.

agent = setActor(agent,actor);

Assume that you have an existing reinforcement learning agent, agent.

Further, assume that this agent has an actor representation that contains the following deep neural network structure.

originalActor = [
        imageInputLayer([4 1 1],'Normalization','none','Name','state')

Create an actor representation with an additional fully connected layer.

actorNetwork = [
        imageInputLayer([4 1 1],'Normalization','none','Name','state')
actor = rlRepresentation(actorNetwork,...

Set the actor representation of the agent to the new augmented actor.

agent = setActor(actor);

Input Arguments

collapse all

Reinforcement learning agent that contains an actor representation, specified as one of the following:

Output Arguments

collapse all

Actor representation object, returned as one of the following:

  • rlLayerRepresentation object for deep neural network representations

  • rlTableRepresentation object for value table or Q table representations

Introduced in R2019a