Quest 2 β’ Lesson 1
π§ Reinforcement Learning Basics
Learn how agents learn through trial and error by interacting with an environment.
Reinforcement Learning (RL) is a type of machine learning where an agent learns to make decisions by interacting with an environment. The agent receives rewards or penalties for its actions and learns to maximise the total reward over time.
π― Key RL Concepts
- Agent β the learner/decision maker.
- Environment β the world the agent interacts with.
- State β the current situation of the agent in the environment.
- Action β what the agent can do (move up/down/left/right).
- Reward β feedback signal (positive or negative).
- Episode β one complete sequence of states, actions, and rewards.
π Interactive Grid Demo
Control the agent (yellow) to reach the goal (green) while avoiding obstacles (red). Every step costs -1, reaching the goal gives +10.
π How the demo works
Q[state][action] += lr * (reward + gamma * max(Q[next_state]) - Q[state][action])
# Agent selects action (exploration vs exploitation)
if random.random() < epsilon:
action = random.choice(actions) # explore
else:
action = argmax(Q[state]) # exploit
β¨ Challenge: Find the Shortest Path
Reset the grid and try to reach the goal in the fewest steps. What's the minimum steps you can achieve? (Hint: obstacles block the direct path.)
π‘ The optimal path requires careful planning. The minimum steps depend on the obstacle layout. Try different routes!
β‘οΈ Next Lesson
Lesson 2.2: Generative AI (GANs) β create new images with AI.
Continue to Lesson 2.2 β(Coming soon β check back or buy Pro Pack for early access)
β€οΈ Support Free Education
This course is 100% free. If it helps you, consider buying me a coffee.
β Buy Me a Coffee