5.3.1 · D1MLOps & Deployment

Foundations — ML project lifecycle

3,321 words15 min readBack to topic

This page assumes you have seen none of the notation in the parent note. We build every symbol from scratch, anchor it to a picture, and say why the lifecycle needs it. Read top to bottom — each block uses only symbols defined above it.


0. The one picture that holds everything

Before any symbol, look at the shape of the problem.

Figure — ML project lifecycle

The black curve is the world: the true relationship between an input and its correct answer. The red curve (this section's spotlight) is your model: a guess at that relationship built from a handful of past dots (training data). Notice the model hugs the dots it saw but drifts away from the true curve where it saw nothing. Every number in this topic is a way of measuring one of those gaps.


1. What is an "input" and an "output"? — the symbols and

Why the topic needs them: the entire Stage 2 (Data) is about pairing each with the right consistently. Without a symbol for "input" and "answer" we cannot talk about labelling, drift, or error at all.


2. What does "predict" mean? — the symbol and the function

The picture: the red curve in §0 is the function. Feed it an (a spot on the horizontal axis), read off the red height — that height is .

Why the hat matters: the topic constantly compares (what the model said) against (what was true). "Error" is literally how far is from . If you can't tell those two apart notationally, nothing in Stages 3–5 makes sense.


3. Random variables vs. their values — capital vs. little

One tiny convention prevents a lot of confusion later, so we fix it before distributions.

Picture: is the dice still spinning in the air; is the 4 it landed on. means "the chance the random variable takes the specific value ", often written in full as .

Why bother: every expectation below averages a random variable () but is computed from realizations ( in a dataset). Keeping capital = "the spinning thing" and little = "the landed value" makes the empirical formulas in §8 read correctly.


4. What is a "distribution"? — the symbol

Here is the single most important — and most skipped — idea in the whole parent note.

Figure — ML project lifecycle

Look at the figure: two bell-shaped humps. The red hump (this section's spotlight) is live traffic today; the black hump is training data from last year. They no longer sit on top of each other. That horizontal shift is data drift: changed.


5. The conditional and the joint

Picture: stand at one spot on the horizontal axis. Look straight up. describes how the true answers pile up above that single spot.

Why two different 's? Because two different things can rot a model:

  • changes → the inputs moved (=data drift).
  • changes → the inputs look the same but the right answer changed (=concept drift: a photo of a "phone" meant a landline in 1990, a smartphone today).

You cannot separate these two failure modes without two separate symbols. That is why the parent's Stage 5 definition uses both.


6. The expectation symbol — "average, weighted by how likely"

The scoping formula — the project's expected-value equation, written out in full at the end of this section — uses . Let's earn first.

Figure — ML project lifecycle

Picture (figure): a see-saw. Outcomes sit at their payoff positions along a plank; each is a weight whose size is its probability. The red marker (this section's spotlight) is , the balance point — heavier (more likely) outcomes pull the balance toward themselves.

The scoping formula (two outcomes, ):

  • = chance it works (feasibility); the fail probability is .
  • = payoff if it works. The failure payoff is taken as , so its term vanishes.
  • = money spent regardless of success, so they are subtracted flat.

That collapses to the parent's .


7. What "error" actually means — the loss function

Section 2 called error "how far is from ." Let's make that one honest symbol before we start comparing error numbers, because "distance" means different things for numbers vs. categories.


8. Population vs. empirical — how we actually compute an error rate

The formula in §7 integrates over the true , which we never fully know. In practice we only have a finite pile of examples, so we replace the integral by a plain average over the pile.


9. Error numbers — TrainErr, DevErr, HLP, Bayes

Figure — ML project lifecycle

The figure stacks the numbers on one axis so the two gaps are visible distances, with the red (this section's spotlight) as the true floor beneath HLP. The lower bracket (HLP→TrainErr) is avoidable bias; the upper bracket (TrainErr→DevErr) is variance.


10. Percent and the / symbols

Tiny but assumed:

  • means "less than or equal to" — a firm ordering.
  • ("curvy less-than") means "less than in the usual, well-behaved case, but not guaranteed" — it flags the caveat above.
  • A percent like means wrong guesses per ; as a fraction it's .

Why the topic bothers with the curvy symbol: it is a warning label that overfitting can break the ordering. Notation itself is carrying the caveat.


11. How it all feeds the topic

x input and y answer

y-hat the model guess

capital X random variable vs little x value

expectation E of X

loss and error rate

empirical TrainErr and DevErr

P of x input distribution

joint P of x and y

P of y given x

data drift and concept drift

scoping value formula

Bayes floor and HLP proxy

bias variance diagnosis

ML project lifecycle

Monitoring and loop back

Every arrow says "you need the left box before the right box makes sense." All roads converge on the ML project lifecycle — which then loops back through monitoring to Model monitoring and observability and Deployment strategies (shadow, canary, blue-green).


Equipment checklist

Cover the right side and answer out loud before revealing.

What is the difference between capital and little ?
Capital is the random variable (the "dice still spinning" — the whole uncertain quantity); little (or ) is one realized value it actually took (the "4 it landed on").
What does the hat in mean?
It marks a guess/estimate of the true answer , produced by the model — not the truth itself.
What picture goes with , and why is it a density?
A hump whose height over a value of says how often that input appears; because is continuous, probability is the area under a stretch and the whole area is . A horizontal shift of the hump is data drift.
How does the joint split into the two marginals?
By the chain rule — draw an input from , then draw its answer from .
What is the difference between and changing?
changing = inputs moved (data drift); changing = same input now has a different correct answer (concept drift).
What does the index range over in ?
The list of all possible outcomes; is the chance of outcome and its realized payoff.
Over which distribution is the population error rate averaged?
Over the joint — every test case is a pair (input, answer), so .
Write the empirical error formula for examples.
— score the loss on each example, add, divide by ; for 0-1 loss it's (number wrong)/(number tested).
How do TrainErr and DevErr differ in that formula?
Same average ; TrainErr uses the training pile, DevErr uses a held-out development pile.
State the floor ordering with Bayes and HLP.
— a human is just one predictor, so it can't beat the theoretical best.
Why is failure payoff in the scoping formula?
If the project fails we assume no payoff, so that outcome's term vanishes, leaving only success payoff minus fixed costs.
Write avoidable bias and variance in symbols.
avoidable bias ; variance .
Can TrainErr be below HLP? What does it signal?
Yes — an overfit model can memorize noise; it is an overfitting alarm, and "avoidable bias" becomes meaningless.
Which gap tells you to get more/cleaner data?
A large variance gap ().