Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/apursley2012/cartpole/llms.txt

Use this file to discover all available pages before exploring further.

CartPole // Balance Lab is an interactive reinforcement learning project that makes the Deep Q-Network training process visible in real time. The original Python/Keras implementation is preserved as a Jupyter notebook; the browser version recreates the same physics environment and neural network in vanilla JavaScript so anyone can watch, control, and experiment without installing anything.

Introduction

Understand the project goals, architecture, and how the Python notebook became a live browser demo.

Live Demo Guide

Learn every control, metric, and mode available in the interactive simulation.

Deep Q-Network

Explore the DQN architecture, Q-value update equation, and experience replay mechanism.

Source Code Reference

Full documentation of the CartPoleEnvironment, DQNAgent, and app controller classes.

What you can do

1

Watch the agent learn

Open the Live Demo and click Start Continuous Training to watch the DQN agent improve across hundreds of episodes in real time.
2

Understand the algorithm

Read The CartPole Problem and Deep Q-Network to understand the four state observations, the Q-value update equation, and how experience replay stabilizes training.
3

Take manual control

Switch to Manual Mode in the demo and try balancing the pole yourself with the arrow keys — then switch back to the AI agent to see the same problem through training data.
4

Explore the source

Browse the Reference section for full documentation of every class and parameter, or open the original Jupyter Notebook to inspect the Python/Keras implementation.

Key concepts

CartPole Problem

Four state values, two actions, and a reward structure that demands long-term stability.

Experience Replay

How storing and randomly sampling past transitions breaks temporal correlations in training.

DQN vs REINFORCE vs A2C

A comparison of three reinforcement learning approaches to the same control problem.

Build docs developers (and LLMs) love