Get actor representation from reinforcement learning agent
actor = getActor(agent)
example
actor = getActor(agent) returns the actor representation object for the specified reinforcement learning agent.
actor
agent
collapse all
Assume that you have an existing trained reinforcement learning agent. For this example, load the trained agent from Train DDPG Agent to Control Double Integrator System.
load('DoubleIntegDDPG.mat','agent')
Obtain the actor representation from the agent.
actor = getActor(agent);
Obtain the learnable parameters from the actor.
params = getLearnableParameters(actor);
Modify the parameter values. For this example, simply multiply all of the parameters by 2.
2
modifiedParams = cellfun(@(x) x*2,params,'UniformOutput',false);
Set the parameter values of the actor to the new modified values.
actor = setLearnableParameters(actor,modifiedParams);
Set the actor in the agent to the new modified actor.
agent = setActor(agent,actor);
rlDDPGAgent
rlTD3Agent
rlPGAgent
rlACAgent
rlPPOAgent
Reinforcement learning agent that contains an actor representation, specified as one of the following:
rlDDPGAgent object
rlTD3Agent object
rlACAgent object
rlPGAgent object
rlPPOAgent object
rlDeterministicActorRepresentation
rlStochasticActorRepresentation
Actor representation object, specified as one of the following:
rlDeterministicActorRepresentation object — Returned when agent is an rlDDPGAgent or rlTD3Agent object
rlStochasticActorRepresentation object — Returned when agent is an rlACAgent, rlPGAgent, or rlPPOAgent object
getCritic | getLearnableParameters | setActor | setCritic | setLearnableParameters
getCritic
getLearnableParameters
setActor
setCritic
setLearnableParameters
You have a modified version of this example. Do you want to open this example with your edits?