Setup guide · Tools and services
The Hollowbrook ticket data
Generate the synthetic support-ticket dataset every Machine Learning Foundations exercise works on, check the summary matches, and know which columns are inputs, labels and leaks.
Machine Learning Foundations for LLM Work runs every lesson on one dataset: the support inbox of Hollowbrook Systems, the fictional software company of its running example. This guide gets that data onto your machine. It comes from a single Python script with a known generating process, so you can check a model's probabilities against the truth and watch leakage happen on purpose. Every ticket, customer, product and agent in it is invented, and the same seed gives byte-identical files on every run, so the numbers in the lessons and answers match yours.
Before you start
You need Python 3.12 or newer. Follow Python with uv first if python --version shows anything older or nothing at all. The script uses only the standard library, so there is nothing to install, and it runs in under a second.
1. Download the generator
In the folder of the exercise you're working on:
curl -fsSL -o generate_tickets.py https://codersinhoods.dev/downloads/hollowbrook-tickets/generate_tickets.pyOn Windows, run the same command in PowerShell with curl.exe in place of curl. Don't edit the file: the exercises' checks and the answers' expected output assume the data as published. The docstring at the top documents every design choice, and it's worth a read once you reach the lessons on splits and calibration.
2. Generate the data
python generate_tickets.py --out dataInside a uv project, uv run python generate_tickets.py --out data does the same. It writes four CSV files into data/ and prints a summary. The defaults are 6,000 tickets and seed 7; --n and --seed change them, but the answers assume the defaults.
3. Know the columns
tickets.csv has one row per ticket, sorted by time, so ticket ids sort like dates.
| Column | What it is | Use it as |
|---|---|---|
ticket_id | HB-000001…, assigned in time order | key |
customer_id | cust_0001…, about 400 customers; tickets cluster by customer | grouping key, join to usage.csv |
submitted_at | ISO datetime, January 2024 to October 2026 | input (and the key for a time split) |
channel | email, chat or form | input |
product_area | billing, access, editor, integrations, mobile, reports | input |
plan_tier | free, team, business, enterprise | input |
subject, body | the ticket text; bodies are 15 to 60 words | input |
category | billing, access, bug, how-to, feature-request | label (5-way classification) |
urgent | 0 or 1, about 16% positive | label (binary classification) |
hours_to_resolve | hours until the ticket was closed | regression target; never an input for urgency |
resolved_by | which of 12 agents closed it | never an input |
reopened | 0 or 1 | never an input |
The last three are only known after the ticket is resolved. Urgent tickets resolve faster and agents are routed by category, so each of them predicts a label almost for free, which is exactly the target leakage the splits lesson has you measure and then remove.
usage.csv has one row per customer: customer_id, plan_tier, seats, daily_active_seats_30d, features_enabled (1 to 12) and signup_date. Join it on customer_id for the regression exercises.
annotations.csv has 200 ticket ids with the category label two annotators gave them, annotator_a and annotator_b. They agree on about 85%, and the probability lesson computes how much of that is chance.
truth.csv has one row per ticket: p_urgent_true, the probability the generator drew urgent from; template_id, the text template behind the ticket; and duplicate_of, the earlier ticket this one is a near-copy of (about 3% of tickets are copies with a word changed, filed later and often by another customer).
Check it works
python generate_tickets.py --out data && wc -l data/*.csvExpected output:
tickets.csv 6000 rows, 2024-01-01 to 2026-10-31, 400 customers
category billing 922 (15.4%) access 1023 (17.1%) bug 1938 (32.3%) how-to 1381 (23.0%) feature-request 736 (12.3%)
urgent 943 (15.7%)
near-duplicates 180 (3.0%)
truth.csv 6000 rows
usage.csv 400 rows
annotations.csv 200 rows, annotators agree on 169 (84.5%)
201 data/annotations.csv
6001 data/tickets.csv
6001 data/truth.csv
401 data/usage.csv
12604 totalIf your counts match these to the ticket, you have the same data as the lessons. On Windows, (Get-Content data\tickets.csv).Count in PowerShell replaces wc -l and should print 6001.
Troubleshooting
python: command not found, or it starts Python 2 or 3.9. macOS and some Linux distributions ship an old interpreter under python3 and nothing under python. Run the script with uv run python generate_tickets.py --out data inside a uv project, or uv run --python 3.12 generate_tickets.py --out data anywhere, and uv fetches the right version.
curl in PowerShell prints a usage error or saves an HTML page. In Windows PowerShell curl is an alias for Invoke-WebRequest and the flags differ. Use curl.exe -fsSL -o generate_tickets.py …, and check the file starts with #!/usr/bin/env python3, not <!doctype html>.
Your summary numbers differ from the ones above. Either the file was edited, or you passed --n or --seed. Download it again and run with the defaults. The same seed gives identical bytes on every platform and on every Python release from 3.9 to 3.13, so a different count means a different input, not a different machine.
Going further
- Python with uv, for the project the exercises add numpy, pandas and scikit-learn to
- PyTorch on CPU, needed from the vectors and embeddings lesson onwards
Sources
- csv: CSV file reading and writingDocs · Python Software FoundationHow the generator writes its files (`DictWriter`, and why files are opened with `newline=''`), and how to read them back without pandas.
- random: Generate pseudo-random numbersDocs · Python Software FoundationWhy one seeded `random.Random` instance gives the same sequence on every run ("Notes on reproducibility"), and the `lognormvariate` draw behind `hours_to_resolve`.
- Common pitfalls and recommended practicesDocs · scikit-learnSection 12.2, data leakage, which is what the two post-resolution columns and `truth.csv` are there to let you commit on purpose and then fix.
Exercises that use this
- Explore the inbox and build the baselinesMachine Learning Foundations for LLM Work · Problems, data and baselines
- Flag the features that arrive too lateMachine Learning Foundations for LLM Work · Problems, data and baselines
- Split by time, then leak on purposeMachine Learning Foundations for LLM Work · Train, validation, test and leakage
- Build a contamination checkMachine Learning Foundations for LLM Work · Train, validation, test and leakage
- Fit a line by gradient descent in numpyMachine Learning Foundations for LLM Work · Loss functions and gradient descent
- Mini-batches and momentumMachine Learning Foundations for LLM Work · Loss functions and gradient descent
- Logistic regression in numpy, matched against scikit-learnMachine Learning Foundations for LLM Work · Logistic regression, step by step
- Curves, a cost-based threshold and a calibration checkMachine Learning Foundations for LLM Work · Metrics, thresholds and calibration
- Boosted trees: ranking against calibrationMachine Learning Foundations for LLM Work · Metrics, thresholds and calibration
- Learning curves, cross-validated regularisation and a second modelMachine Learning Foundations for LLM Work · Overfitting, regularisation and cross-validation
- Double descent on a laptopMachine Learning Foundations for LLM Work · Overfitting, regularisation and cross-validation
- Simulate an eval and compute kappaMachine Learning Foundations for LLM Work · Probability for evaluation
- Intervals and a paired comparison on the test ticketsMachine Learning Foundations for LLM Work · Standard errors, intervals and paired tests
- Clustered standard errors by customerMachine Learning Foundations for LLM Work · Standard errors, intervals and paired tests
- Build a nearest-neighbour duplicate finderMachine Learning Foundations for LLM Work · Vectors, dot products and embeddings
- The MLP in numpy, then in PyTorch, then against logistic regressionMachine Learning Foundations for LLM Work · A small neural network from scratch
- Dropout and weight decay on the validation curveMachine Learning Foundations for LLM Work · A small neural network from scratch
