Reinforcement Learning Basics — ML Technical Interview Questions & Answers

Agents learning by trial, error and reward.

Reinforcement Learning Basics

  • Simple meaning: An agent takes actions in an environment and gets rewards. It is not a labelled marks sheet. It learns a policy: in this state, try this move.
  • Picture: Game paddle. Left/right = actions. Score up = reward. After many games it hits the ball more often. Robot vacuum: bump = negative reward.
  • Words: state, action, reward, policy. Exploration (try new) vs exploitation (repeat what worked).
  • Trap: calling every ML project RL. Trap: expecting sklearn.linear_model to be RL — this is a different family (Q-learning, policy gradients).

Technical Interview Tip: Try, get reward, improve. Games and robots, not pass/fail sheets.

Code Examples for Reinforcement Learning Basics

Reinforcement Learning Basics — working example

# PCA-style intuition: project 2D → 1D by a direction vector
points = [(1.0, 1.0), (2.0, 2.0), (3.0, 2.8)]
# unit direction along y = x
ux, uy = 0.7071, 0.7071
proj = [x * ux + y * uy for x, y in points]
print([round(v, 3) for v in proj])

# Tiny ensemble: average two model votes
votes = [1, 0, 1]
v2 = [1, 1, 1]
ens = [1 if a + b >= 2 else 0 for a, b in zip(v1, v2)]
print(ens)

Reinforcement Learning Basics — dim reduction compresses features; ensembles combine models; deep nets/RL/NLP are specialized families — practice the core math idea first.

How to Explain Reinforcement Learning Basics to an Interviewer

What signal does RL use?

Reward Not a labelled y for each row

Exploration vs exploitation?

Try new vs use what works