1 of 48

Reinforcement Learning�

Prof. André E. Lazzaretti

lazzaretti@utfpr.edu.br

​

​

2 of 48

Introduction (Markov Decision Process)

3 of 48

Introduction

4 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

5 of 48

6 of 48

7 of 48

8 of 48

9 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

10 of 48

11 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

12 of 48

13 of 48

14 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

15 of 48

16 of 48

17 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

18 of 48

19 of 48

20 of 48

21 of 48

22 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

23 of 48

→ during test stage

24 of 48

→ during test stage

25 of 48

26 of 48

27 of 48

28 of 48

29 of 48

30 of 48

31 of 48

32 of 48

33 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

34 of 48

35 of 48

Example

36 of 48

Topics

  • Definitions: action, state, return, discount factor, policy
  • Goal of reinforcement learning
  • State-action value function (Q-function)
    • RL -> learn the Q-function
  • Bellman equation
  • Lunar Lander
  • Deep Reinforcement Learning
  • ε-greedy policy
  • Code example

37 of 48

Reinforcement learning example

  • Codes.

38 of 48

Proximal policy optimization (PPO)

slippery

Each time step incurs -1 reward, unless the player stepped into the cliff, which incurs -100 reward.

39 of 48

Actor-Critic Idea

40 of 48

Step 1: Init Actor Network

41 of 48

Step 2: Init Critic Network

42 of 48

Step 3: Collect trajectories

43 of 48

Step 4: Rewards to go

44 of 48

Step 5: Calculate the advantages

45 of 48

Step 6: Optimize the Critic Network

46 of 48

Step 7: Optimize the Actor Network

If the ratio (new network is a bit different from the old network), go ahead and make the slight change

Don't make change (clipping!)

47 of 48

Step 8 and 9

Step 8:

  • Repeat steps 6 and 7 again, for n times!

​

Step 9:

  • Repeat 3 to 8 again, for T times!

48 of 48

Proximal policy optimization (PPO)