article-image

[NEW COURSE] Deep Reinforcement Learning in PyTorch (v2)

author-avatar-1
Lazy Programmer
May 15, 2025

I’m excited to announce the release of my latest course:
Advanced AI: Deep Reinforcement Learning in PyTorch (v2)

If you’ve ever been curious about how AI can teach itself to solve complex tasks — from playing video games to controlling robots — this course will show you exactly how it works, and how you can build it yourself.

Don’t want to read my little spiel? Just get the course here: https://deeplearningcourses.com/c/deep-reinforcement-learning-in-pytorch

The non-VIP Udemy version of the course (without the portfolio optimization project) can be found here: https://tinyurl.com/2vetuu7m


What is Reinforcement Learning (RL), and Why Should You Care?

Reinforcement Learning is one of the most fascinating fields in AI. It’s the technology behind many high-profile breakthroughs:

  • AlphaGo and AlphaZero: Superhuman performance in board games

  • OpenAI’s Dota 2 bot: Mastering a complex team-based strategy game

  • Self-driving cars, robotics, finance, recommendation systems, and more

At its core, RL is about agents learning from experience — just like humans. They take actions, observe outcomes, and adapt to maximize rewards over time.


What You’ll Learn in This Course

This course is designed to take you from theory to practice, covering both classical and deep reinforcement learning techniques:

Preliminaries

  • Learn the core concepts: rewards, value functions, the Bellman equation, and policies

  • Master foundational algorithms like Q-Learning, Temporal Difference (TD) learning, and Monte Carlo methods

Coding RL from Scratch

  • Get hands-on with Python and Gymnasium (OpenAI’s environment toolkit)

  • Implement Q-Learning and understand the role of vectorized environments and auto-reset

Deep Reinforcement Learning (DQN)

  • Build Deep Q-Networks with experience replay and target networks

  • Implement DQN in Python and understand the role of decreasing epsilon in exploration

Policy Gradient Methods & A2C

  • Learn about policy optimization, actor-critic models, and entropy regularization

  • Implement the Advantage Actor Critic (A2C) algorithm from scratch

️ Real Projects: Training Agents on Atari Games

  • Use Stable Baselines 3 and special environment wrappers to train agents to play Atari games

  • Build both DQN and A2C agents that can learn to play games from pixels


Bonus: Algorithmic Trading with A2C (VIP Section)

For those enrolled in the VIP version of the course, I’ve included a powerful bonus section:
Multi-Period Portfolio Optimization using A2C (Advantage Actor-Critic).

In many of my other courses (like TensorFlow 2PyTorchFinancial Engineering, and Pairs Trading), we’ve built simple trading agents — often using basic inputs like historical returns, and typically focusing on single-asset strategies.

This new section takes things to the next level.

You’ll learn how to train an agent that:

  • Uses technical indicators as input features
  • Allocates portfolio weights across multiple assets instead of just buying/selling one
  • Makes decisions on a multi-period basis (e.g. monthly or quarterly rebalancing)
  • Learns entirely from experience — no assumptions about future returns or covariances

We go beyond the limitations of traditional finance models. While Markowitz Portfolio Theory assumes known return statistics and optimizes for just one period, our A2C-based approach learns in a more realistic environment where future market behavior is uncertain and evolving.

This is practical, modern portfolio management — powered by reinforcement learning.


What’s New in Version 2?

  • Updated and cleaned-up code for better readability and maintainability

  • Improved explanations and more structured lessons

  • Compatibility with modern libraries like Gymnasium and Stable Baselines 3

  • Additional implementation examples and optional deep dives


‍ Who This Course is For

This course is designed for:

  • Machine learning engineers looking to dive into RL

  • Students and researchers working on AI projects

  • Developers and hobbyists who want to build agents that learn

  • Anyone who wants to understand how AI can learn from its environment

Whether you’re a complete beginner to RL or looking to sharpen your deep RL skills, this course has something for you.


Ready to Get Started?

Enroll now and start building your own reinforcement learning agents

I can’t wait to see what you’ll build. If you’ve ever wanted to teach machines to learn — this is your chance.

– Lazy Programmer

Get the latest news to your inbox!

Latest articles

View all
blog article image

AI Safety is Dead: Game Theory Explains Why

In this blog post, we take a game-theoretic perspective to explain why prioritizing AI safety — while well-meaning — is not a rational choice....

Read more
blog article image

[NEW COURSE] Evolutionary AI: Deep Reinforcement Learning in Python (v2)

Deep reinforcement learning (RL) has given us some of the most jaw-dropping breakthroughs in AI — from robots that can walk and run, to AlphaGo...

Read more
blog article image

What is the Sliding Window Method in Time Series Analysis?

Sliding Window Method in Time Series Analysis: A Self-Supervised Learning Approach The sliding window method is a foundational technique in time...

Read more