liveBook · Manning

Actor network

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

An actor network is a neural network that represents a reinforcement-learning policy and produces action choices or action probabilities.

An actor network is the policy network in reinforcement learning: it converts an observed state into action probabilities or action choices. section 12.3

In an actor–critic setup, the actor selects actions while a separate critic estimates state value. A PyTorch actor can use fully connected layers, ReLU activations, and a final softmax over actions. section 12.3

A typical actor interaction and update proceeds as follows:

  • Pass the current state through the actor to obtain action probabilities. section 12.3
  • Sample an action from a categorical distribution, step the environment, and compute an advantage using the critic. section 12.3
  • Update the actor with the sampled action’s log probability weighted by the detached advantage. section 12.3

CartPole

For CartPole-v1, the actor receives four observations—cart position, cart velocity, pole angle, and pole angular velocity—and returns probabilities for pushing left or right. Training can track episode rewards and plot their trend. section 12.3

class Actor(nn.Module):
  
    def __init__(self, state_dim,  action_dim):
        super(Actor, self).__init__()
        self.fc1 = nn.Linear(state_dim, 64)
        self.fc2 = nn.Linear(64, 32)
        self.fc3 = nn.Linear(32, action_dim)
  
    def forward(self, state):
        x1 = F.relu(self.fc1(state))
        x2 = F.relu(self.fc2(x1))
        action_probs = F.softmax(self.fc3(x2), dim=-1)
        return action_probs

Inspect the compact PyTorch Actor class, including its three-layer architecture, ReLU activations, and softmax output. section 12.3

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines architecture, action sampling, advantage-based loss, optimization, and reward tracking without deriving policy-gradient theory.
Examples
Uses CartPole-v1, left-or-right actions, a three-layer PyTorch model, reward tracking, and Stable-Baselines3 implementations.
What it assumes
Assumes basic neural-network and reinforcement-learning familiarity while identifying states, actions, rewards, critics, and advantages.
What you can do after
Build it from scratch in PyTorch or apply it through Stable-Baselines3 A2C and PPO workflows.
How it connects
Connects reinforcement learning, policy networks, critic networks, A2C, PPO, PyTorch, and OpenAI Gym.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.