Lesson 71
Soft Actor-Critic
Maximize both return and action entropy, so a continuous policy keeps several good actions alive. One example is on this page.
Intermediate12 min
What You Will Learn
- Idea
- Example
- When to use it
Idea
Soft Actor-Critic adds an entropy bonus to the critic target. The agent is paid for return and for staying uncertain when several actions are fine. A temperature, alpha, sets how much that randomness is worth. Two critics still contribute the minimum Q, as in TD3.
Example
import math
log_pi = math.log(0.8)
q1, q2, alpha, gamma, reward = 1.2, 1.0, 0.2, 0.9, 0.0
soft = reward + gamma * (min(q1, q2) - alpha * log_pi)
print(f"sac target: {soft:.3f}")Output:
sac target: 0.940When to use it
- Use it for continuous control when a brittle deterministic policy is a problem.
- The entropy term
- alpha * log piraises the target when the action was not a certainty. - Alpha can be fixed or learned. Higher alpha explores more.
Loading playground…