This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

getActor

Get actor representation from reinforcement learning agent

Syntax

actor = getActor(agent)

Description

example

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

Examples

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')
        fullyConnectedLayer(2,'Name','action')];

Create an actor representation with an additional fully connected layer.

actorNetwork = [
        imageInputLayer([4 1 1],'Normalization','none','Name','state')
        fullyConnectedLayer(3,'Name','x');
        fullyConnectedLayer(2,'Name','action')];
actor = rlRepresentation(actorNetwork,...
    'Observation',{'state'},getObservationInfo(env),
    'Action',{'action'},getActionInfo(env));

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