Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Machine Learning Foundations for LLM Work

Free · sign in to start and track progress

1 · Learning from data

  • 1Problems, data and baselines
  • 2Train, validation, test and leakage

    Exercise answers

    • Answer: Split by time, then leak on purpose
    • Answer: Build a contamination check
  • 3Loss functions and gradient descent

2 · Classifiers and generalisation

  • 4Logistic regression, step by step
  • 5Metrics, thresholds and calibration
  • 6Overfitting, regularisation and cross-validation

3 · The maths the later courses assume

  • 7Probability for evaluation
  • 8Standard errors, intervals and paired tests
  • 9Vectors, dot products and embeddings
  • 10A small neural network from scratch
CapstoneTicket triage you can defendReference implementation

Module 1 · Learning from data · Lesson 2

Train, validation, test and leakage

Why a model needs three sets with three different jobs, how random, stratified and time-based splits differ, and the ways information leaks from test into train, measured on the ticket data by committing each leak on purpose.

70 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvThe Hollowbrook ticket data

By the end of this lesson you can

  • Explain the separate jobs of the training, validation and test sets, and why tuning on the test set destroys its meaning
  • Implement random, stratified and time-based splits and choose the right one for data that arrives over time
  • Find three leakage mechanisms in a pipeline (a post-resolution feature, preprocessing fitted on all data, duplicates across splits) and fix them with a time split and a scikit-learn Pipeline
  • Explain why a fine-tuning run needs its own validation split and why contaminated evaluation sets inflate language-model benchmark scores

On this page

  • Why one score is not enough
  • Three ways to split
  • Leakage
  • The feature that arrives too late
  • Preprocessing fitted on all the data
  • Duplicates across the split
  • The worked numbers
  • The same problem in LLM work
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01Why one score is not enough
  2. 02Three ways to split
  3. 03Leakage
  4. 04The worked numbers
  5. 05The same problem in LLM work
  6. 06Connections
  7. 07Summary

Sources & further reading

  • Leakage and the Reproducibility Crisis in ML-based SciencePaper · Kapoor, Narayanan · Princeton · 2022The taxonomy of eight kinds of leakage in section 2 is the checklist this lesson is built around, and the civil-war case study shows what a leak does to a published claim.
  • Don't Push the Button! Exploring Data Leakage Risks in Machine Learning and Transfer LearningPaper · Apicella, Isgrò, Prevete · 2024A recent survey that categorises leakage by where in the workflow it enters, including preprocessing and transfer learning. Sections 3 and 4.
  • Model Evaluation, Model Selection, and Algorithm Selection in Machine LearningPaper · Raschka · 2018Sections 1 to 3 cover the holdout method, stratification and the pessimistic bias of a small test set, written as a tutorial.
  • Datasets: dividing the original datasetLab research · GoogleThe three sets, why the test set must stay untouched, and why test sets wear out with repeated use.
  • Common pitfalls and recommended practices: data leakageDocs · scikit-learnThe preprocessing-leakage example and the Pipeline fix, in the library the exercises use. Read the data leakage section.
  • Cross-validation: evaluating estimator performanceDocs · scikit-learnThe splitters this lesson names (`train_test_split`, `StratifiedKFold`, `TimeSeriesSplit`, `GroupKFold`) and when each applies.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 7 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks