==============================================================================================
  RAHUL'S ML BLOG -- notes on machine learning, worked out by hand                    est. 2026
==============================================================================================
  home | about | archive | glossary | contact
----------------------------------------------------------------------------------------------

  ALL POSTS -- a book in 23 chapters (69 posts), plus references and standalone specials,
  every number worked by hand.
  First time here? Start from the beginning.


  CHAPTER 1 -- PREDICTING HOUSE PRICES (2026)
  -------------------------------------------
  post 1    Part 1 -- Guessing House Prices, End to End
  post 2    Part 2 -- Ask the Closest Rows: Gap, Same-Ruler, and How Slow It Gets
  post 3    Part 3 -- The Straight-Stick Rule: Dials, Leftovers, and Numerics


  CHAPTER 2 -- GRADING A GUESSER (2026)
  -------------------------------------
  post 4    Part 1 -- Two Rulers for One Guess: MSE and R^2
  post 5    Part 2 -- Reading the Dials: What the Coefficients Say


  CHAPTER 3 -- SORTING INTO BINS (2026)
  -------------------------------------
  post 6    Part 1 -- The S-Curve, the Four-Box Table, and Why Accuracy Lies
  post 7    Part 2 -- The Trade Curve: Sliding the Cutoff and What AUC Measures
  post 8    Part 3 -- Leash and Cloud: L2 Punishment and the Two-Cloud Wall
  post 9    Part 4 -- Picking Settings, Skewed Piles, and Averaging Many Classes


  CHAPTER 4 -- HUMBLE DIALS AND WOBBLE BANDS (2026)
  -------------------------------------------------
  post 10   Part 1 -- The Leash: Ridge, Lasso, and Humbling the Dials
  post 11   Part 2 -- One Dial Is a Lie: Bootstrap, Wobble Bands, and the Free Exam
  post 12   Part 3 -- The Dial by Hand: Where the Dials Really Come From


  CHAPTER 5 -- QUESTION CHARTS AND COMMITTEES (2026)
  --------------------------------------------------
  post 13   Part 1 -- Question Charts: Building a Tree by Hand
  post 14   Part 2 -- The Mixing Ruler: Gini, Information Gain, and Pruning
  post 15   Part 3 -- Committees: Bagging, Random Forest, and Boosting


  CHAPTER 6 -- FINDING PATTERNS WITHOUT ANSWERS (2026)
  ----------------------------------------------------
  post 16   Part 1 -- Looking at a Sheet With No Answers: Means, Distance, and the Ruler Problem
  post 17   Part 2 -- The Strongest Direction: Crushing a Many-Wall Room Into a Flat Page (PCA)
  post 18   Part 3 -- Grouping by Nearest Centre: K-Means From a Blank Sheet
  post 19   Part 4 -- The Family Tree: Hierarchical Clustering and the Dendrogram
  post 20   Part 5 -- Both Tools on NCI60: PCA and Clustering on Real Gene Data
  post 21   Part 6 -- Filling the Blanks: Recommender Systems and Matrix Factorisation


  CHAPTER 7 -- BUILDING A NEURAL NETWORK FROM SCRATCH (2026)
  ----------------------------------------------------------
  post 22   Part 1 -- Stacked Rooms and One Walk by Hand: How a Network Computes a Guess
  post 23   Part 2 -- Rolling Downhill by Hand: How a Network Learns


  CHAPTER 8 -- KEEPING A NETWORK HONEST (2026)
  --------------------------------------------
  post 24   Five Machines Against Memorising: A Tax, a Coffee Break, a Fire Alarm, and a Humbler


  CHAPTER 9 -- MACHINES THAT LOOK AT PICTURES (2026)
  --------------------------------------------------
  post 25   Part 1 -- A Magic Paper Slid Over a Photo: How a Picture Network Sees
  post 26   Part 2 -- The Deep Factory: Humbler, Send-Home, and the Confusion Sheet


  CHAPTER 10 -- MACHINES THAT READ WORDS (2026)
  ---------------------------------------------
  post 27   Part 1 -- Words Into a Machine: The Notepad and the Walking Worker
  post 28   Part 2 -- The Two-Memory Worker: How an LSTM Remembers Far-Back Words
  post 29   Part 3 -- The Look-Across Machine: Attention and the Transformer by Pencil
  by hand:  The Walking Machine and the Vault -- RNN and LSTM by Pencil
  by hand:  LSTM From Pencil -- RNN and LSTM From Scratch, Nothing But a Pencil


  CHAPTER 11 -- ATTENTION GROWS EYES (2026)
  -----------------------------------------
  post 30   Part 1 -- The Vision Transformer: A Photo Cut Into Strips That Look at Each Other
  post 31   Part 2 -- Encoder or Decoder: The One Mask That Splits BERT From GPT
  by hand:  Transformer From Pencil -- Attention From Scratch, One Number at a Time
  by hand:  Attention and the Transformer by Pencil -- Every Word Looks at Every Word
  by hand:  The Mark That Tells a Transformer Where It Is -- Positional Encoding Built From Scratch
  by hand:  Transformers With Pencil -- A Whole Block Worked by Hand, One Line at a Time
  by hand:  Vision Transformer From Pencil -- Strips, Seat-Stamps, and Masks by Hand


  CHAPTER 12 -- REINFORCEMENT LEARNING (2026)
  -------------------------------------------
  intro:    The Agent Ladder -- Five Cats, One New Power Each, From Reflex to Learning
  post 32   Part 1 -- Bandits and Exploration: The Greedy Shopkeeper and His Faulty Machines
  post 33   Part 2 -- Worth and Bellman from Zero: What a Spot Is Worth When the Future Branches
  post 34   Part 3 -- Grading a Plan by Pencil: A Table of Lies That Heals Into the Truth
  post 35   Part 4 -- Finding the Best Plan by Pencil: How Good Arrows Spread From the Runway
  post 36   Part 5 -- No Map in the Arguments: Value Iteration Built by Pencil


  CHAPTER 13 -- SAMPLE-BASED LEARNING (2026)
  ------------------------------------------
  post 37   Part 1 -- No Die, Just a Sample: TD(0) Built by Pencil
  post 38   Part 2 -- Max or Honest Average: Q-Learning and Expected Sarsa by Pencil
  post 39   Part 3 -- A Notebook and a Rehearsal: Dyna-Q by Pencil
  post 40   Part 4 -- A Clock for Curiosity: Dyna-Q+ by Pencil
  ref:      The Sample-based Map: MC, TD, DP, and the Sarsa Family


  CHAPTER 14 -- FUNCTION APPROXIMATION (2026)
  -------------------------------------------
  post 41   Part 1 -- Too Many Spots for a Table: State Aggregation by Pencil
  post 42   Part 2 -- Sharp From Blurry: Tile Coding by Pencil
  post 43   Part 3 -- Letting the Car Choose: Sarsa Control by Pencil
  post 44   Part 4 -- Two Stages and a Bend: A Q-Network by Pencil


  CHAPTER 15 -- TRAINING THE Q-NETWORK (2026)
  -------------------------------------------
  post 45   Part 1 -- One Miss, a Thousand Nudges: Backpropagation by Pencil
  post 46   Part 2 -- A Smarter Step: Adam and Replay by Pencil
  post 47   Part 3 -- The Frozen Twin: A Batch of Misses at Once
  post 48   Part 4 -- The World Calls Three Times: Wiring the Agent by Pencil
  post 49   Part 5 -- From Eight Dials to a Soft Landing: The Whole Agent by Pencil


  CHAPTER 16 -- POLICY GRADIENT (2026)
  ------------------------------------
  post 50   Propose and Grade: Actor-Critic by Pencil


  CHAPTER 17 -- TWO THE SAMPLE-BASED MAP SKIPPED (2026)
  -----------------------------------------------------
  post 51   Part 1 -- Wait for the Whole Trip: Monte Carlo by Pencil
  post 52   Part 2 -- Fix the Biggest Surprise First: Priority Sweeping by Pencil


  CHAPTER 18 -- CHOOSING THE MACHINE (2026)
  ------------------------------------------
  post 53   Four Questions Before Any Arithmetic: Which Machine for Which World


  CHAPTER 19 -- LEARNING BY COPYING (2026)
  -----------------------------------------
  post 54   Part 1 -- The Diary and the Eight Envelopes: Learning by Copying
  post 55   Part 2 -- The Copying Machine by Pencil
  post 56   Part 3 -- One Question, Two Right Answers: Where Copying Breaks
  post 57   Part 4 -- Teaching the Wind: Flow Matching by Pencil
  post 58   Part 5 -- Riding the Wind: From Noise to an Answer


  CHAPTER 20 -- THE PUSH-T MACHINE (2026)
  ----------------------------------------
  post 59   Part 1 -- From Five to Twenty-Two: Why Flow Matching Needs a Clock
  post 60   Part 2 -- Wrong Wind Shows Every Dial Which Way to Turn
  post 61   Part 3 -- Eight Blind Ticks, Then The Overshoot


  CHAPTER 21 -- SELF, NET, AND THE CALL THAT DOES NOT LOOP (2026)
  -----------------------------------------------------------------
  post 62   Part 1 -- One Dot Away From An Infinite Loop


  CHAPTER 22 -- THE FATE OF EVERY NUMBER (2026)
  ----------------------------------------------
  post 63   Part 1 -- The 90 Comes Back As 89.94
  post 64   Part 2 -- The 52 Forces The Flip
  post 65   Part 3 -- Born, Works, Dies -- Then All Twelve Dials Turn


  CHAPTER 23 -- POLICY GRADIENTS (2026)
  --------------------------------------
  post 66   Part 1 -- No Answer Key, Only a Score
  post 67   Part 2 -- Why the Log Times the Score Turns the Dial
  post 68   Part 3 -- Subtract a Yardstick, Lose No Truth
  post 69   Part 4 -- Trust the Critic a Little: GAE by Pencil


  REFERENCES -- flip-to decoders, one per cluster of chapters
  -----------------------------------------------------------
  ref:      A. Classification Reference -- Loss, Leash, Grid, and All the Terms   (companion to Chapter 3)
  ref:      B. Distance and Clustering Reference -- Rulers, Traps, and Ethics   (companion to Chapter 6)
  ref:      C. LSTM From Pencil -- RNN and LSTM From Scratch   (companion to Chapter 10)
  ref:      D. Transformer From Pencil -- Attention From Scratch   (companion to Chapter 10)
  ref:      E. Vision Transformer From Pencil -- Strips, Seat-Stamps, and Masks   (companion to Chapter 11)
  ref:      The Sample-based Map -- MC, TD, DP, and the Sarsa Family   (companion to Chapter 13)


  STANDALONE SPECIALS -- written for Hacker News, each self-contained
  ------------------------------------------------------------------
  special:  Genetic Algorithm From Scratch -- Optimising With No Gradient
  special:  Cheapest Walk: UCS and A* -- Every Pop Shown, the Proof Included
  special:  Informed Search Jargon -- One Machine, Three Slips, Every Word Debunked
  special:  Bayes by Head-Count -- The Greedy Shopkeeper and His Faulty Machine
  special:  The Walking Machine and the Vault -- RNN and LSTM by Pencil
  special:  Attention and the Transformer by Pencil -- Every Word Looks at Every Word
  special:  The Mark That Tells a Transformer Where It Is -- Positional Encoding From Scratch
  special:  The Window That Drops Its Best Old Match -- Sliding Window Attention by Pencil
  special:  The Two Flips That Are Not the Same Flip -- Attention's Shapes by Pencil
  special:  Sliding Window Self-Attention, Built From One Pencil And One Page
  special:  Build a GPT, Forced -- A Reading Ladder
  special:  A Writing Machine of One Room -- Smallest GPT That Works, by Pencil
  special:  What a Machine Does When You Press "h" -- Every Matrix, Forced Into Being
  special:  What Happens When You Press "h" in a GPT -- A Plain Walkthrough
  special:  Press "h" -- Final GPT Pencil Pass
  special:  A Note a Machine Keeps So It Stops Redoing Old Work -- KV Cache by Pencil
  special:  The Agent Ladder -- Five Cats, One New Power Each
  special:  Transformers With Pencil -- A Whole Block Worked by Hand

----------------------------------------------------------------------------------------------

  home . source on GitHub
==============================================================================================