54
Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie Value Function Approximation and Deep Q Learning Clément Rambour Clément Rambour Value Function Approximation and Deep Q Learning 1 / 50

Value Function Approximation and Deep Q Learning

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Value Function Approximation and Deep Q Learning

Clément Rambour

Clément Rambour Value Function Approximation and Deep Q Learning 1 / 50

Page 2: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Plan

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 2 / 50

Page 3: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Cours précédent

Comment apprendre une bonne politique grâce à l’expérience

Pour l’instant : représentation tabulaire de la fonction de valeur d’état oud’état-action

Souvent trop d’états pour être applicable

Clément Rambour Value Function Approximation and Deep Q Learning 3 / 50

Page 4: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Aujourd’hui

Motivation :

Ne pas stocker ou apprendre explicitement pour chaque état

Une dynamique

Une récompense

Valeur d’action-état

Politique

Recherche d’une représentation compacte qui se généralise mieux

Réduction de l’impact mémoire

Réduction du coût en calcul

Réduit la quantité d’expérience nécessaire

Clément Rambour Value Function Approximation and Deep Q Learning 4 / 50

Page 5: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Aujourd’hui

Motivation :

Ne pas stocker ou apprendre explicitement pour chaque état

Une dynamique

Une récompense

Valeur d’action-état

Politique

Recherche d’une représentation compacte qui se généralise mieux

Réduction de l’impact mémoire

Réduction du coût en calcul

Réduit la quantité d’expérience nécessaire

Clément Rambour Value Function Approximation and Deep Q Learning 4 / 50

Page 6: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Plan

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 5 / 50

Page 7: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Principe

Inférence de la valeur d’un état/ d’un couple action-état grâce à un modèle

Clément Rambour Value Function Approximation and Deep Q Learning 6 / 50

Page 8: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Fonctions approximatrices

De nombreuses fonctions nont possible pour calculer la fonction de valeur :

Combinaison linaire de features

Réseaux de neurones

Arbres de décisions

Plus proches voisins

Fourier / ondelettes

Clément Rambour Value Function Approximation and Deep Q Learning 7 / 50

Page 9: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Fonctions approximatrices

De nombreuses fonctions nont possible pour calculer la fonction de valeur :

Combinaison linaire de features ← différentiable

Réseaux de neurones ← différentiable

Arbres de décisions

Plus proches voisins

Fourier / ondelettes

Clément Rambour Value Function Approximation and Deep Q Learning 8 / 50

Page 10: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 9 / 50

Page 11: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Apprentissage avec un oracle

Intuition : se ramener à un cas supervisé

Si on connaît la valeur de vπ(s)∀s

Apprentissage supervisé (s, vπ(s))

L’ojectif est d’obtenir la meilleure approximation de vπ grâce à la fonctionparamétrée v̂(s,w)

Clément Rambour Value Function Approximation and Deep Q Learning 10 / 50

Page 12: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Descente de gradient stochastique

But : trouver les paramètres w qui minimisent la loss L(vπ(s), v̂(s,w))

Générallement, L = MSE :

L(vπ(s), v̂(s,w)) = Eπ [(vπ(s)− v̂(s,w))2]

Minimum trouvé par descente de gradient :

∆w = −1

2α∇wL

Descente de gradient stochastique : gradient approché par une moyenne surun nombre finit d’échantillons (souvent un seul)

Clément Rambour Value Function Approximation and Deep Q Learning 11 / 50

Page 13: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Model Free Approximation

Ne nécessite pas forcément d’être calculé avec un oracle/les labels

Model free policy evaluation :

On suit une politique π

Convergence vers vπ ou qπValeurs d’état / d’actions-états stockées en mémoire

Mise à jour après un épisode (MC) ou après chaque étape (TD)

Modification de l’approche existente pour inclure la mise à jour desparamètres du modèle

Clément Rambour Value Function Approximation and Deep Q Learning 12 / 50

Page 14: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 13 / 50

Page 15: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Approximation linéaire

Chaque état s est représenté par un ensemble de descripteurs/features :x(s) = [x1(s), ..., xn(s)]

L’approximation de la fonction de valeur est obtenue par approximationlinéaire : v̂(s,w) = wTx(s)

La loss est donnée par L(w) = Eπ [(vπ(s)− v̂(s,w))2]

Gradient donné par :

∇wL = Eπ [2(vπ(s)− v̂(s,w))]∇w v̂(s,w)

Clément Rambour Value Function Approximation and Deep Q Learning 14 / 50

Page 16: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Monte Carlo Value function apprixmation

Monte Carlo : Le retour Gt est un estimateur non biaisé de vπ(s)

Apprentissage supervisé : (s1, G1), ..., (sT , GT )

Le gradient s’écrit :

∇wL = −2(Gt − v̂(s,w))∇w v̂(s,w)

La mise à jour :

∆w = −1

2α∇wL

= α(Gt − v̂(s,w)

)∇w v̂(s,w)

= α(Gt − x(st)

Tw)x(st)

Clément Rambour Value Function Approximation and Deep Q Learning 15 / 50

Page 17: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Monte Carlo Value function approximation

Clément Rambour Value Function Approximation and Deep Q Learning 16 / 50

Page 18: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 17 / 50

Page 19: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

TD Learing

Bootstraping

Mise à jour après chaque transition (s, a, r, s′) :

V (s) = V (s) + α(r + γV (s′)︸ ︷︷ ︸TD Target

−V (s))

TD Target : estimattion biaisée de vπ(s)

⇒ Utilisation de la TD Target approchée comme supervision :(s1, r1 + γv̂(s2,w)), ..., (sT , rT+1 + γv̂(sT ,w))

But : Trouver les poids qui minimisent la loss :

L(w) = Eπ [(rt+1 + γv̂(st,w)− v̂(st,w))2]

Pour TD(0), mise à jour cas linéaire :

∆w = α(r + γv̂(s′,w)− v̂(s,w)

)∇W v̂(s,w)

= α(r + γx(s′)Tw − x(s)Tw

)x(s) (1)

Clément Rambour Value Function Approximation and Deep Q Learning 18 / 50

Page 20: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

TD Learing

Bootstraping

Mise à jour après chaque transition (s, a, r, s′) :

V (s) = V (s) + α(r + γV (s′)︸ ︷︷ ︸TD Target

−V (s))

TD Target : estimattion biaisée de vπ(s)

⇒ Utilisation de la TD Target approchée comme supervision :(s1, r1 + γv̂(s2,w)), ..., (sT , rT+1 + γv̂(sT ,w))

But : Trouver les poids qui minimisent la loss :

L(w) = Eπ [(rt+1 + γv̂(st,w)− v̂(st,w))2]

Pour TD(0), mise à jour cas linéaire :

∆w = α(r + γv̂(s′,w)− v̂(s,w)

)∇W v̂(s,w)

= α(r + γx(s′)Tw − x(s)Tw

)x(s) (1)

Clément Rambour Value Function Approximation and Deep Q Learning 18 / 50

Page 21: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

TD(0) Linear value function approximaton

Clément Rambour Value Function Approximation and Deep Q Learning 19 / 50

Page 22: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 20 / 50

Page 23: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Control et approximation de la valeur

Approximation de la fonction de valeur état-action :

Qπ(s, a) ' Q̂(s, a;w)

Q̂(s, a;w) paramétrée par w

Schéma classique possible (légèrement modifié) :

Approximation de la fonction de valeur

ε-greedy amélioration

Parfois instable

Amélioration possible :

Approximation bien choisie

Bootstrapping

Off-policy learning

Clément Rambour Value Function Approximation and Deep Q Learning 21 / 50

Page 24: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Control et approximation de la valeur

Approximation de la fonction de valeur état-action :

Qπ(s, a) ' Q̂(s, a;w)

Q̂(s, a;w) paramétrée par w

Schéma classique possible (légèrement modifié) :

Approximation de la fonction de valeur

ε-greedy amélioration

Parfois instable

Amélioration possible :

Approximation bien choisie

Bootstrapping

Off-policy learning

Clément Rambour Value Function Approximation and Deep Q Learning 21 / 50

Page 25: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Contrôle avec un oracle

Qπ(s, a) ' Q̂(s, a;w) Mean Square Error :

L(w) = Eπ [(Qπ(s, a)− Q̂(s, a;w))2]

Minimum obtenu par stoachastic gradient descent :

∇wL(w) =1

2Eπ[(Qπ(s, a)− Q̂(s, a;w)

)∇wQ̂(s, a;w)

]

Clément Rambour Value Function Approximation and Deep Q Learning 22 / 50

Page 26: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

SARSA et approximation de la valeur

Résumé en deux étapes :

À partir de s choix d’une action a associée à une politique ε-greedy(π) → s′

Mise à jour de la fonction de valeur en fonction du couple (s′, a′) associé à laprochaine action :

Qπ(s, a)← Qπ(s, a) + α(r + γQπ(s

′, a′)−Q(s, a)

)SARSA avec approximation Qπ(s, a) ' Q̂(s, a;w)

Loss avec ojectif SARSA :

L(w) = Eπ [(r + γQπ(s′, a′;w)− Q̂(s, a;w))2]

L(w) ' (r + γQπ(s′, a′;w)− Q̂(s, a;w))2

gradient de la loss % w :

∇wL(w) = 2(r + γQ̂(s′, a′;w)− Q̂(s, a;w)

)∇wQ̂(s, a;w)

Mise à jour :

w ← w −1

2α∇wL(w)

Clément Rambour Value Function Approximation and Deep Q Learning 23 / 50

Page 27: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

SARSA et approximation de la valeur : cas linéaire

Couple états actions représentés par un vecteur de features :x(s, a) = [x1(s, a), ..., xn(s, a)]

Approximation linéaire :

Q̂(s, a;w) = wtx(s, a)

Loss avec ojectif SARSA :

L(w) ' (r + γQπ(s′, a′;w)− Q̂(s, a;w))2

gradient de la loss % w cas linéaire :

∇wL(w) = 2(r + γQ̂(s′, a′;w)− Q̂(s, a;w)

)∇wQ̂(s, a;w)

=(r + γx(s′, a′)Tw − x(s, a)Tw

)x(s, a)

Mise à jour :

w ← w −1

2α∇wL(w)

Clément Rambour Value Function Approximation and Deep Q Learning 24 / 50

Page 28: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Q-learning et approximation de la valeur

Résumé en deux étapes :

À partir de s choix d’une action a associée à une politique ε-greedy(π) ← s′

Mise à jour de la fonction de valeur en fonction du couple (s′, a′) associé à lameilleure action possible :

Qπ(s, a)← Qπ(s, a) + α(r + γmax

a′Qπ(s

′, a′)−Q(s, a)

)Q-learning avec approximation Qπ(s, a) ' Q̂(s, a;w)

Loss avec ojectif Q-learning :

L(w) = Eπ [(r + γmaxa′

Qπ(s′, a′;w)− Q̂(s, a;w))2]

L(w) ' (r + maxa′

γQπ(s′, a′;w)− Q̂(s, a;w))2

gradient de la loss % w :

∇wL(w) = 2(r + γmax

a′Q̂(s′, a′;w)− Q̂(s, a;w)

)∇wQ̂(s, a;w)

Mise à jour :

w ← w −1

2α∇wL(w)

Clément Rambour Value Function Approximation and Deep Q Learning 25 / 50

Page 29: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Q-learning et approximation de la valeur : cas linéaire

Couple états actions représentés par un vecteur de features :x(s, a) = [x1(s, a), ..., xn(s, a)]

Approximation linéaire :

Q̂(s, a;w) = wtx(s, a)

Loss avec ojectif Q-learning :

L(w) ' (r + maxa′

γQπ(s′, a′;w)− Q̂(s, a;w))2

gradient de la loss % w cas linéaire :

∇wL(w) = 2(r + γmax

a′Q̂(s′, a′;w)− Q̂(s, a;w)

)∇wQ̂(s, a;w)

=(r + γmax

a′x(s′, a′)Tw − x(s, a)Tw

)x(s, a)

Mise à jour :

w ← w −1

2α∇wL(w)

Clément Rambour Value Function Approximation and Deep Q Learning 26 / 50

Page 30: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Plan

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 27 / 50

Page 31: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Deep RL

Utiliser des réseaux de neurones pour approcher

La fonction de valeur (v ou Q)

La politique

Le modèle (de l’environnement)

Optimisation par descente de gradient stochastique

Clément Rambour Value Function Approximation and Deep Q Learning 28 / 50

Page 32: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 29 / 50

Page 33: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Deep Q-Networks (DQNs)

Représentation de la table de valeur état-action par un Q-network de paramètre θ

Clément Rambour Value Function Approximation and Deep Q Learning 30 / 50

Page 34: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

DQNs dans Atari

Clément Rambour Value Function Approximation and Deep Q Learning 31 / 50

Page 35: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

DQNs dans Atari

Apprentissage end to end des valeurs de Q(s, a) d’après les pixels s ← vecteurde features décrivant l’état

Entrée du réseau s concaténation des dernières frames observées (ex : 4dernières)

Sortie : Q(s, a) pour les actions réalisables (∼ 18 bouttons)

Architectures et hyperparmètres fixés pour toute la partie

Clément Rambour Value Function Approximation and Deep Q Learning 32 / 50

Page 36: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

DQ-learning

Loss : MSE optimisée par descente de gradient stochastique

Deux problèmes (principaux) pouvant amener à diverger :

Correlation entre les échantillons

Targets/labels non stationnaires

Deux solutions proposées pour le Deep Q-Learning (Mnih et Al. 2015)

Experience replay

Fixed Q-targets

Clément Rambour Value Function Approximation and Deep Q Learning 33 / 50

Page 37: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

DQNs : Experience replay

Pour éviter la forte correlation entre échantillons successifs : les données sontstockées dans un buffer D ← replay buffer

Experience replay consiste à répéter les étapes suivantes :

Échantillonnage d’une expérience (s, a, r, s′ ∼ D)

Calcul de la TD target pour l’échantillon : r + γmaxa′

Qθ(s′, a′)

Calcul de la loss :

L(θ) = (r + γmaxa′

Qθ(s′, a′)−Qθ(s, a))

2

Mise à jour des paramètres :

θ ← θ − α1

2∇θL(θ)

θ ← θ + α(r + γmax

a′Qθ(s

′, a′)−Qθ(s, a)

)∇θQθ(s, a)

Clément Rambour Value Function Approximation and Deep Q Learning 34 / 50

Page 38: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Fixed Q-Targets

Pour améliorer la stabilité, on peut fixer les poids du réseaux pour évaluer laTD target

Deux réseaux : un réseaux cible et un réseaux apprenant la fonction de valeur

θ− : les paramètres du réseau cible

θ : les paramètres du réseaux mis à jour

Léger changement dans le schéma précédent :

Échantillonnage d’une expérience (s, a, r, s′) ∼ D

Calcul de la TD target pour l’échantillon : r + γmaxa′

Qθ− (s′, a′)

Calcul de la loss :

L(θ) = (r + γmaxa′

Qθ− (s′, a′)−Qθ(s, a))

2

Mise à jour des paramètres :

θ ← θ − α1

2∇θL(θ)

θ ← θ + α(r + γmax

a′Qθ− (s

′, a′)−Qθ(s, a)

)∇θQθ(s, a)

Clément Rambour Value Function Approximation and Deep Q Learning 35 / 50

Page 39: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

DQN Pseudocode

Clément Rambour Value Function Approximation and Deep Q Learning 36 / 50

Page 40: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

DQN results dans Atari

Figure – Human-level control through deep reinforcement learning, Mnih et al, 2015

Clément Rambour Value Function Approximation and Deep Q Learning 37 / 50

Page 41: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Vanilla DQN vs. Fixed Target and experience replay

Clément Rambour Value Function Approximation and Deep Q Learning 38 / 50

Page 42: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 39 / 50

Page 43: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Double DQN

Q-learning : biaisé vers l’estimation du maximum dans la table Q

Combinaison d’estimateur peut réduire le biais (∼ bagging)

Double Q-Learning :

Combinaison de deux estimations de Q

Probabilité non nulle de sélectionner la meileure option pour l’une ou pourl’autre des estimations

réduction du biais

Clément Rambour Value Function Approximation and Deep Q Learning 40 / 50

Page 44: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Prioritized experience replay

Soit i l’index du i-eme tuple dans le buffer d’expérience (si, ai, ri, si+1)

Échantillonnage des tuples pour mettre à jour suivant une distribution p

Probabilité pi de sélectionner le tuple i proportionelle à l’erreur DQN ei :

ei = |r + maxa′

Qθ(si+1, a′)−Qθ(si, ai)|

Mise à jour des pi à chaque mise à jour de Qθ

une méthode :

pi =pβi∑k p

βk

β facteur de température

Clément Rambour Value Function Approximation and Deep Q Learning 41 / 50

Page 45: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Table of Contents

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 42 / 50

Page 46: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Fonctions valeur et avantage

Intuition : représentations pour décrire les états pas forcément adaptéespour décrire les actions

Exemple : le score dans un jeu indique l’intérêt d’un état s : v(s) mais pasl’intérêt entre deux action Q(s, a1) <> Q(s, a2)

Fonction d’avantage / Advantage function :

Aπ(s, a) = Qπ(s, a)− vπ(s, a)

Aπ donne la valeur d’une action

Clément Rambour Value Function Approximation and Deep Q Learning 43 / 50

Page 47: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Dueling DQN

Clément Rambour Value Function Approximation and Deep Q Learning 44 / 50

Page 48: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Dueling DQN

Clément Rambour Value Function Approximation and Deep Q Learning 45 / 50

Page 49: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Non unicité de l’avantage

Q est reconstruit à partir de l’avantage et la valeur d’état :

Qθ(s, a) = Vθ(s, a) +Aθ(s, a)

Infinité de V et A donnant le même Q : solution à une constante prêt

Nécessité de "punaiser" V et A en rajoutant une constante

Méthode 1 : Forcer Qθ(s, a) = Vθ(s) pour la meilleure action possible

Qθ(s, a) = Vθ(s, a) +

(Aθ(s, a)−max

a′Aθ(s, a′)

)

Méthode 2 : Utiliser la moyenne sur les actions Aθ(s, a′) comme origine (plusstable)

Qθ(s, a) = Vθ(s, a) +

(Aθ(s, a)−Aθ(s, a′)

)

Clément Rambour Value Function Approximation and Deep Q Learning 46 / 50

Page 50: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Non unicité de l’avantage

Q est reconstruit à partir de l’avantage et la valeur d’état :

Qθ(s, a) = Vθ(s, a) +Aθ(s, a)

Infinité de V et A donnant le même Q : solution à une constante prêt

Nécessité de "punaiser" V et A en rajoutant une constante

Méthode 1 : Forcer Qθ(s, a) = Vθ(s) pour la meilleure action possible

Qθ(s, a) = Vθ(s, a) +

(Aθ(s, a)−max

a′Aθ(s, a′)

)

Méthode 2 : Utiliser la moyenne sur les actions Aθ(s, a′) comme origine (plusstable)

Qθ(s, a) = Vθ(s, a) +

(Aθ(s, a)−Aθ(s, a′)

)

Clément Rambour Value Function Approximation and Deep Q Learning 46 / 50

Page 51: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Dueling DQN vs. Double DQN

Clément Rambour Value Function Approximation and Deep Q Learning 47 / 50

Page 52: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Conseils pratiques

Huber Loss sur l’erreur de Bellman (= l’erreur TD)

Double DQN (peu d’effort par rapport à simple DQN)

Essayer plusieurs seeds pendant les experiences

Learning rate scheduling. Haut learning rate au départ pour l’exploration

Clément Rambour Value Function Approximation and Deep Q Learning 48 / 50

Page 53: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Plan

1 Introduction

2 Approximation de la fonction de valeurStochastic gradient descentMonte Carlo with value function approximationTD Learning with value function approximationControl with value function approximation

3 Deep Reinforcement LearningEnd to end learning of QDouble DQNDueling DQN

4 Bibliographie

Clément Rambour Value Function Approximation and Deep Q Learning 49 / 50

Page 54: Value Function Approximation and Deep Q Learning

Introduction Approximation de la fonction de valeur Deep Reinforcement Learning Bibliographie

Bibliographie

Double DQN (Deep Reinforcement Learning with Double Q-Learning, VanHasselt et al, AAAI 2016)

Prioritized Replay (Prioritized Experience Replay, Schaul et al, ICLR 2016)

Dueling DQN (best paper ICML 2016) (Dueling Network Architectures forDeep Reinforcement Learning, Wang et al, ICML 2016)

Clément Rambour Value Function Approximation and Deep Q Learning 50 / 50