Skip to content
Episode 98 · Who won't show up?

Machine learning, deep learning and neural networks

Tuesday, 9:30: Hotel Ribeira in Porto loses 6% of its room nights to guests who never arrive, and asks StayHub to predict them. Maya's first idea is to ask the concierge's LLM.

How a program can learn a rule from examples instead of being told it, and why your API calls never teach the model anything.

30 min foundationAI ⊃ ML ⊃ deep learning ⊃ LLMsTraining vs inference: learning weights vs using themSupervised, unsupervised and reinforcement learningHow a neural network learns: weights, loss, gradient descentOverfitting vs generalization
  1. Problem

    A hotel wants to know which bookings will be no-shows, so it can overbook safely and stop losing 6% of room nights.

  2. Why the simple system fails

    Hand-written rules ("non-refundable rate = will show up") catch the obvious cases, then drown in exceptions nobody can maintain.

  3. Engineering concept

    Let the program find the rule: give it labelled examples, measure how wrong it is (loss), and nudge its numbers (weights) to be less wrong, millions of times.

  4. Technology

    Neural networks trained with gradient descent on GPUs, then served as frozen weights for fast, cheap inference.

  5. Trade-offs

    Learned rules need data, compute and evaluation, can't easily explain themselves, and can memorise the training set instead of learning the pattern.

01

The problem

2 min
Tuesday, 9:30. A request from Hotel Ribeira in Porto.
  1. Maya · Product manager
    Ribeira loses 6% of room nights to no-shows. Can't we just ask the concierge's LLM about each booking?
  2. You · Engineer at StayHub
    Our rule today is "non-refundable means they'll show". It finds about 35% of no-shows.
  3. Lina · Senior engineer, your mentor
    Before we pick a tool, make a guess.
02

The big idea

4 min
Let the data write the rule
The big idea

Machine learning: give the program data and answers, and it finds the rule; judge it only on data it has never seen.

A new receptionist gets no rulebook for spotting no-shows. After months of watching bookings and who turned up, she just knows, because she adjusted her hunches every time she was wrong. That adjusting is training.

03

How it works

5 min
How a model learns from past bookings
  1. 1
    Predict

    Run a past booking through the model with its current , the adjustable numbers inside it. It says "30% no-show risk".

  2. 2
    Measure

    The guest didn't come. A turns "how wrong was 30%?" into one number.

  3. 3
    Nudge

    moves every weight a tiny step in the direction that lowers the loss. Repeat over millions of bookings.

  4. 4
    Stack it

    A stacks many such units in layers; many layers is what means.

  5. 5
    Training vs inference

    Training changes the weights. uses frozen weights to answer. Our concierge calls are all inference: the LLM learns nothing from our chats.

  6. 6
    Overfitting

    : the model memorises its training examples instead of the pattern. Only a held-out month it never saw reveals it.

Three kinds of learning: (examples with answers, like no-shows), (find groups without answers), (act, get a reward, improve).

04

Watch a decision being made

4 min
Worked example

Lina sets up the no-show model (you do the split)

Build a no-show model for Hotel Ribeira and prove it beats today's rule (35% of no-shows found) before the hotel overbooks on it.

  1. 1Frame the question

    Input: fields known at booking time (lead time, rate type, deposit, channel, past stays). Output: probability of no-show. Label: did the guest arrive?

    Why: A field like "checked in" would leak the answer and make the model look perfect.

  2. 2Hold out a month

    Train on bookings up to August; keep September aside, untouched while tuning. Lina checks the split is by date, not random.

    Why: In real use the model predicts the future from the past. A later month is the honest rehearsal.

  3. 3Train small, compare with the rule

    A small model first. On September, flagging the riskiest 5%: the rule finds 35% of no-shows, the model 62%, in under 10 ms.

    python
    model.fit(X_train, y_train)            # training: weights change
    p = model.predict_proba(X_september)   # inference: weights frozen

    Why: A model must beat the simple thing on unseen data, or it isn't worth its pipeline.

  4. 4Serve and watch it

    The booking service calls it at checkout. Each month, compare predictions with who actually came, and retrain.

    Why: The world changes; accuracy decays silently unless you measure it.

The whole thing in one line: A supervised problem, a held-out month, a small model that finds 62% of no-shows versus the rule's 35%, and monthly checks.
05

In real life

3 min
Train your own, or use a pretrained model?

Netflix: trains its own models

  • Recommendations are famously learned from members' viewing history (it ran the public Netflix Prize on it)
  • Needs data teams, training pipelines and constant evaluation

Fits a defined prediction with lots of your own history.

Expedia: plugged in a pretrained LLM

  • Announced in 2023 a ChatGPT-powered conversational trip planner
  • No training data needed; pays per call, depends on someone else's model

Fits open-ended language tasks with no labelled data.

06

What goes wrong

3 min
Judging a model by its training score

A big network can memorise and still fail on new data.

Instead

Report results only on held-out data, next to the simple baseline.

Reaching for ML before you have data

With a few hundred examples, a model is noisy and hard to test.

Instead

Rules and logging first; a model when it clearly beats the rules.

Treating a trained model as finished

New channels or policies decay accuracy silently.

Instead

Compare with real outcomes monthly and retrain on a schedule.

07

Trade-offs

3 min
OptionFits whenYou pay
Hand-written rulesLittle data, strict explainabilityMisses combinations nobody thought of
Classic ML on your dataStructured data, lots of labelled historyA pipeline, retraining, monitoring
Pretrained LLM via promptingFree text, many small tasks, no labelsSlower, costlier per call, less predictable
Wednesday, 15:00. Choosing how to build it.
  1. Karim · CTO
    We already pay for an LLM. Send it each booking and ask "no-show risk?". No pipeline to build.
  2. Lina · Senior engineer, your mentor
    A second per booking at checkout, and it's never seen our 20 million bookings.
  3. Karim · CTO
    A training pipeline is an engineer for a month.
08

Your job as tech lead

4 min

Claude Code can write the code for this. You still own the decisions, and you have to know what good looks like to accept or reject its work.

Decisions you own
  • Whether the problem needs ML, and which kind: no-shows from booking fields is a small model, not an LLM call.
  • The bar to beat: the rule's 35%, on a month the model never saw.
  • What the score may trigger: a deposit request, an overbooking suggestion, or nothing automatic.
Tell Claude Code
Hotel Ribeira wants no-show predictions. Plan first, then build a baseline in notebooks/no-show. Train on bookings with check-in before 2026-09-01, evaluate on September 2026 only. Features: lead time, rate type, channel, deposit, length of stay; no names, emails or free text. Start with a simple model, not a neural network. Report the share of no-shows found at the same false-alarm rate as our current rule (35%), and the training and September scores side by side.
Check before you accept
  • Training and September scores side by side; 97% vs 41% is .
  • The split is by date: ask Claude to print the date ranges.
  • No feature is known only after the stay, and no personal data is used.
Red flags
  • It reports only accuracy: with 6% no-shows, "everyone shows up" is 94% accurate and useless.
  • It splits randomly and reports a great score.
  • It claims the concierge "will learn" from guests' corrections.
09

Check yourself

2 min
Q1/3Reasoning
If 10,000 guests correct the hotel chatbot's wrong breakfast time this week, the underlying model's weights will have learned the right time by next week.
How confident are you?

Next episode: the old support-ticket classifier sends a long, angry message about a suite to the "anniversary gifts" team, and Lina explains why transformers read differently.

Finished?

Mark it complete to update your skill map.

Go deeper (optional)You don't need this to understand the lesson. Open it when a project needs the details: Technical deep dive, Visual diagram, Analogy, Check your understanding, Practice ladder, Explain it yourself.
10

Technical deep dive

One neuron learns about no-shows
Worked example

Lina sets up the no-show model (you do the split)

Build a no-show model for Hotel Ribeira from StayHub's past bookings, and prove it beats today's rule (35% of no-shows found) before the hotel overbooks on it.

  1. 1Frame the question

    Input: booking fields known at booking time (lead time, rate type, deposit, channel, past stays). Output: probability of no-show. Label: did the guest arrive?

    Why: Only use what you know at booking time. A field like "checked in" would leak the answer and make the model look perfect.

  2. 2Hold out a month

    Train on bookings up to August; keep September aside and never look at it while tuning. You do this split; Lina checks it's by date, not random.

    Why: Guest behaviour drifts with seasons. Testing on a later month mimics real use: predicting the future from the past.

  3. 3Train with the loop

    Start with a small model. Run predict → loss → nudge until the loss on the training data stops improving.

    python
    model.fit(X_train, y_train)            # training: weights change
    p = model.predict_proba(X_september)   # inference: weights frozen
    print(share_of_no_shows_found(p, y_september, flag_top=0.05))

    Why: A small model is fast to train, cheap to run and easier to debug than a giant one.

  4. 4Compare with the rule

    On September, flagging the riskiest 5% of bookings: the rule finds 35% of no-shows, the model 62%.

    Why: A model must beat the simple thing on unseen data, or it isn't worth its pipeline.

  5. 5Serve and watch it

    Save the weights; the booking service calls the model at checkout (< 10 ms). Each month, compare predictions with who actually came, and retrain.

    Why: Inference uses frozen weights, but the world keeps changing. Accuracy decays silently unless you measure it.

The whole thing in one line: Lina framed no-shows as a supervised problem, kept a later month aside, trained a small model, proved it found 62% of no-shows versus the rule's 35% on unseen data, and planned monthly checks and retraining.
TrainingInference
What happensPredict + loss + adjust the weightsPredict only, weights frozen
How oftenOnce, or on a schedule (nightly to yearly)Every request, all day
ComputeHuge for LLMs; small for our no-show modelMilliseconds for ours; a GPU slice per LLM call
Changes the model?Yes, that's the pointNo. Our prompts never teach the model
What to watchOverfitting, bad data, leaked answersLatency, cost, drift from the training data
Most product teams only ever do the right-hand column for LLMs, and both columns for their own small models.
11

Visual diagram

Click a component

Two loops with different owners, costs and speeds: the training loop (left) produces weights; the inference path (right) uses them.

12

Analogy

  • A sound engineer's mixing deskA million knobs on the deskMachine learningThe model's weights
  • A sound engineer's mixing deskA judge scoring how far off it soundsMachine learningThe loss function
  • A sound engineer's mixing deskTurning every knob a little in the better directionMachine learningGradient descent
  • A sound engineer's mixing deskPractising only on the same 20 songsMachine learningOverfitting
  • A sound engineer's mixing deskTaping the knobs and touring with itMachine learningInference with frozen weights

Where the analogy breaks: a sound engineer understands music. The training process understands nothing. It just follows the numbers downhill, which is why it can learn odd shortcuts from your data.

13

Check your understanding

Q1/3Reasoning
Match each hotel problem to the learning approach it most naturally uses:
Predict no-shows from past bookings marked showed/no-show
Group guests into segments without predefined categories
An agent adjusts nightly prices and is rewarded by revenue
Learn language by predicting the next word of raw text
How confident are you?
14

Practice ladder

Step 1 · Trace

Score two bookings by hand

Estimation Warm-up

The trained one-neuron model computes score = 1.0 × lead_months − 6.7 × non_refundable − 3.5, then turns the score into a probability with the sigmoid:

score−10−4−201.53
no-show probability0.000050.020.120.500.820.95

Trace both bookings: - A: booked 5 months ahead, refundable (non_refundable = 0) - B: booked 0.5 months ahead, non-refundable (non_refundable = 1)

Compute each score, read the probability, and say which one a careful hotel might overbook against.

Step 2 · Complete

Finish the training plan

Design Practice

Lina's plan for a no-show model for all Lisbon hotels has two gaps. Fill in steps 2 and 4.

  1. Frame: input = booking fields known at booking time; output = no-show probability; label = arrived or not.
  2. Split the data: ___
  3. Train a small model on the training part.
  4. Decide if it's good enough: ___
  5. Serve at checkout, compare predictions with real outcomes monthly, retrain.
Step 3 · Solve

Flag urgent reviews

Decision Practice

StayHub receives 40,000 guest reviews a month in 9 languages. Hotel managers want urgent ones (hygiene, safety, billing errors) flagged within an hour. Nobody has ever labelled reviews as urgent or not.

Choose between hand-written rules, training your own model, and prompting a pretrained LLM. Say what data you'd need, how you'd know it works, and what you'd do first.

Step 4 · Decide

Fine-tune the concierge on our policies?

Decision Stretch

Karim: "Instead of sending hotel facts in every concierge call, let's fine-tune the LLM on all our hotel policies. Then it just knows them, and the prompts are shorter."

Facts: StayHub has 9,000 hotels. Policies change daily (prices, breakfast hours, renovations). A fine-tuning run takes a day and costs a few thousand euros. Today, facts for one hotel add about 1,500 tokens per call.

Write a short decision: "We chose X over Y because…, accepting the risk of…".

15

Explain it yourself

Explain to a product manager how a neural network 'learns' to predict no-shows, and why the chatbot doesn't learn from guests' messages.

0 words