Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Deep Reinforcement Learning Hands-On

You're reading from   Deep Reinforcement Learning Hands-On A practical and easy-to-follow guide to RL from Q-learning and DQNs to PPO and RLHF

Arrow left icon
Product type Paperback
Published in Nov 2024
Publisher Packt
ISBN-13 9781835882702
Length 716 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Maxim Lapan Maxim Lapan
Author Profile Icon Maxim Lapan
Maxim Lapan
Arrow right icon
View More author details
Toc

Table of Contents (29) Chapters Close

Preface 1. Part 1 Introduction to RL FREE CHAPTER
2. What Is Reinforcement Learning? 3. OpenAI Gym API and Gymnasium 4. Deep Learning with PyTorch 5. The Cross-Entropy Method 6. Part 2 Value-based methods
7. Tabular Learning and the Bellman Equation 8. Deep Q-Networks 9. Higher-Level RL Libraries 10. DQN Extensions 11. Ways to Speed Up RL 12. Stocks Trading Using RL 13. Part 3 Policy-based methods
14. Policy Gradients 15. Actor-Critic Method: A2C and A3C 16. The TextWorld Environment 17. Web Navigation 18. Part 4 Advanced RL
19. Continous Action Space 20. Trust Region Methods 21. Black-Box Optimizations in RL 22. Advanced Exploration 23. Reinforcement Learning with Human Feedback 24. AlphaGo Zero and MuZero 25. RL in Discrete Optimization 26. Multi-Agent RL 27. Bibliography
28. Index

Models

In this example, two architectures of DQN are used: a simple feed-forward network with three layers and a network with 1D convolution as a feature extractor, followed by two fully connected layers to output Q-values. Both of them use the dueling architecture described in Chapter 8. Double DQN and two-step Bellman unrolling have also been used. The rest of the process is the same as in a classical DQN (from Chapter 6). Both models are in Chapter10/lib/models.py and are very simple. Let’s start with the feed-forward model:

class SimpleFFDQN(nn.Module): 
    def __init__(self, obs_len: int, actions_n: int): 
        super(SimpleFFDQN, self).__init__() 
 
        self.fc_val = nn.Sequential( 
            nn.Linear(obs_len, 512), 
            nn.ReLU(), 
            nn.Linear(512, 512), 
            nn.ReLU(), 
            nn.Linear(512, 1) 
        ) 
 
        self.fc_adv = nn.Sequential( 
            nn.Linear(obs_len, 512), 
   ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime