Level 15 · HeroLesson 15.2 60 min read 10 question quiz 10 marks of written practice

Capstone: Build, Test and Explain Your Own AI

Your mission

Fourteen levels have taken you from the history of AI to transformers, generative models, agents and the engineering of real systems. The capstone puts it together: design, build, test and explain an AI system of your own, the way a professional would.

You will produce:

  1. A working model, in Python, that does something useful or interesting.
  2. An evaluation: how well it works, compared with a baseline, with its mistakes analysed.
  3. A model card: what it is for, how it was built, how well it works and for whom, and its limitations.
  4. A short presentation or demo for someone else.

The certificate for this course unlocks when you score at least 70% on every lesson's quiz. The capstone is how you prove the skills to yourself, and to anyone you show it to.

Choose a project

Pick a project you care about, small enough to finish. Some ideas, with the levels they draw on:

ProjectWhat it doesBuilds on
Message classifierSorts messages into spam and genuine, or by topicLevels 3, 4 and 5
Digit recogniserReads handwritten digits from a small drawn gridLevels 6, 7 and 8
Review sentimentDecides whether a review is positive or negativeLevels 4 and 9
Book or film recommenderSuggests items from what similar people likedLevels 4 and 9
Game-playing agentLearns to play a simple game you designLevel 13
Notes assistantAnswers questions about your own notes with retrievalLevels 9 and 11
Image filter explorerDesigns kernels that find features in picturesLevel 8
Fairness auditMeasures how a model or dataset treats different groupsLevels 3, 4 and 15

A good first project has data you can get or make yourself, a clear way to measure success, and a simple baseline to beat.

Plan it on a canvas

Before writing code, fill in a project canvas. It takes ten minutes and saves days.

A project canvasA grid of nine boxes. 1 Problem: what decision or task, and why does it matter? 2 Users: who uses it, and who else is affected? 3 Data: where from, labelled how, how much, any personal data? 4 Success: which metric, and what does a baseline score? 5 Model: the simplest that could work, then what next? 6 Risks: who could be harmed, is it fair for every group? 7 Evaluation: validation and test sets, which errors matter most? 8 Demo: how will you show it, what goes in the model card? 9 Timeline: eight milestones with dates.A project canvas: plan the whole project on one page1. ProblemWhat decision or task?Why does it matter?2. UsersWho uses it?Who else is affected?3. DataWhere from? Labelled how?How much? Any personal data?4. SuccessWhich metric?What does a baseline score?5. ModelThe simplest that could work,then what next?6. RisksWho could be harmed?Fair for every group?7. EvaluationValidation and test sets?Which errors matter most?8. DemoHow will you show it?What goes in the model card?9. TimelineEight milestones,with dates
Fill in every box before writing code. Box 4 matters most.

The most important box is success: decide now how you will measure whether the model works, and what the baseline scores, so you cannot fool yourself later.

Eight milestones

The capstone roadmapA winding grey road from left to right with eight numbered milestones: 1 define, 2 data, 3 baseline, 4 first model, 5 evaluate, 6 improve, 7 check responsibly, 8 present, ending at a golden trophy.Eight milestones from an idea to a finished AI project1define2data3baseline4first model5evaluate6improve7check8present
Get to milestone 4 quickly with something simple, then spend your time on 5 and 6.
  1. Define: the problem, the users and the success measure.
  2. Data: collect or create it, label it, split it into training, validation and test sets, and look at it.
  3. Baseline: the simplest possible approach, such as always predicting the most common class.
  4. First model: the simplest model that could work. Get it running end to end before improving anything.
  5. Evaluate: measure it on the validation set, with a confusion matrix, not only accuracy.
  6. Improve: look at the mistakes, form a hypothesis, change one thing, and measure again. Keep a log.
  7. Check responsibly: who could be harmed, does it work equally well for different users, what personal data does it touch?
  8. Present: test once on the test set, write the model card, and show it to someone.

Worked project: a spam classifier from scratch

Here is a complete small project, every step in plain Python: data, features, a logistic regression model trained by gradient descent, evaluation on unseen messages, and an explanation of what it learned.

Python
import math, random

# 1. Data: messages labelled 1 for spam and 0 for genuine ("ham")
messages = [
    ("win a free phone now claim your prize", 1), ("you have won cash text claim now", 1),
    ("urgent your account is locked click the link", 1), ("free entry to win a holiday reply yes", 1),
    ("cheap loans approved today no checks", 1), ("claim your free gift card now", 1),
    ("congratulations you won a prize call now", 1), ("limited offer win cash click here", 1),
    ("your parcel is waiting pay the fee at this link", 1), ("earn money fast from home click now", 1),
    ("final notice claim your refund now", 1), ("free ringtones text win to claim", 1),
    ("are we still meeting at four", 0), ("can you send me the homework for maths", 0),
    ("dinner is at seven see you then", 0), ("thanks for the help with the project", 0),
    ("what time does the match start", 0), ("i left my coat at your house", 0),
    ("happy birthday hope you have a great day", 0), ("can you pick up milk on the way home", 0),
    ("the bus is late i will be ten minutes", 0), ("did you finish reading the book", 0),
    ("see you at football practice tomorrow", 0), ("mum says dinner is ready", 0),
    ("free tickets for the school play this friday", 0), ("call me when you get this", 0),
]
random.seed(7)
random.shuffle(messages)
train, test = messages[:20], messages[20:]

# 2. Features: which words appear (a bag of words)
vocab = sorted({w for text, _ in train for w in text.split()})
def features(text):
    words = set(text.split())
    return [1.0 if w in words else 0.0 for w in vocab]

# 3. Model: logistic regression, trained by gradient descent
w = [0.0] * len(vocab)
b = 0.0
def predict(text):
    z = b + sum(wi * xi for wi, xi in zip(w, features(text)))
    return 1 / (1 + math.exp(-z))

for epoch in range(300):
    for text, label in train:
        x = features(text)
        error = predict(text) - label                 # gradient of the cross-entropy loss
        w = [wi - 0.1 * error * xi for wi, xi in zip(w, x)]
        b -= 0.1 * error

# 4. Evaluate on messages the model has never seen
tp = fp = fn = tn = 0
for text, label in test:
    guess = 1 if predict(text) >= 0.5 else 0
    tp += guess == 1 and label == 1
    fp += guess == 1 and label == 0
    fn += guess == 0 and label == 1
    tn += guess == 0 and label == 0
    flag = "" if guess == label else "   <- wrong"
    print(f"{predict(text):.2f}  {'spam' if guess else 'ham ':4}  {text}{flag}")
print(f"test accuracy {(tp + tn) / len(test):.0%}: caught {tp} spam, missed {fn}, false alarms {fp}")

# 5. Explain: the words the model learned to trust most
ranked = sorted(zip(w, vocab))
print("most spammy words:", ", ".join(v for _, v in ranked[-6:][::-1]))
print("most genuine words:", ", ".join(v for _, v in ranked[:6]))

Error analysis

The model missed "cheap loans approved today no checks". Why? None of those words appeared in a spam message in its training set, so it had no evidence either way. That one mistake suggests the most useful next step: more varied training data, not a bigger model. It also shows the limits of so small a test set: six messages cannot tell you the real accuracy to within more than a few tens of per cent.

Its model card

SectionEntry
PurposeFlag likely spam text messages for a person to check. Not for deleting messages automatically.
Data26 short English messages written for this exercise: 12 spam, 14 genuine.
ModelLogistic regression on which words appear (bag of words), trained by gradient descent.
Performance5 of 6 test messages correct (83%); the test set is far too small for a reliable figure.
LimitationsKnows only words it has seen; misses spam that uses new words; English only; easily fooled by misspellings.
RisksFalse alarms could hide genuine messages, so a person should review flagged ones.

Check it responsibly

Before anyone relies on your project, work through these questions, and write the answers into your model card:

  • Who will use it, and who will it affect who is not using it?
  • What happens when it is wrong, in each direction? Which mistake is worse?
  • Does it work equally well for different groups of people, accents, languages or devices?
  • What personal data does it collect, keep or learn from, and is all of it needed?
  • Could someone misuse it, or attack it with crafted inputs?
  • Can you explain an individual decision to the person it affects?
  • Is there a person who can override it?

Present it

A good presentation of an AI project answers five questions in order:

  1. What problem, and for whom?
  2. What did you build, in one picture?
  3. How well does it work, compared with the baseline, and where does it fail? Show real mistakes.
  4. What would you do next, and why?
  5. What should people be careful about, from your model card?

Share your code with a short README explaining how to run it. A project that someone else can run and understand is worth far more than a slightly more accurate one that nobody can.

Everything you have learned

The course mapA winding path through fifteen numbered circles, coloured by stage. Beginner: 1 the story of AI, 2 what AI is, 3 data. Explorer: 4 classic machine learning, 5 gradient descent. Builder: 6 the neuron, 7 neural networks. Practitioner: 8 seeing with CNNs, 9 language as numbers. Advanced: 10 attention, 11 large language models, 12 generative AI. Expert: 13 reinforcement learning and agents, 14 AI engineering. Hero: 15 responsible AI and the capstone. The path ends at a golden trophy: the certificate.Your journey: fifteen levels from zero to hero1The story of AIBEGINNER2What AI is3Data4Classic MLEXPLORER5Gradient descent6The neuronBUILDER7Neural networks8Seeing: CNNsPRACTITIONER9Language as numbers10AttentionADVANCED11LLMs12Generative AI13RL and agentsEXPERT14AI engineering15Responsible AI andcapstoneHEROyour certificate
Every level built on the one before. Look how far you have come.

From here, the paths divide:

  • Machine learning engineer: build and run models in products. Next: a deep learning library such as PyTorch, cloud GPUs, and Level 14's engineering in practice.
  • Researcher: invent new methods. Next: the mathematics underneath, linear algebra, probability and calculus, and reading papers.
  • AI product designer: decide what AI should do for people. Next: user research and design, and Level 15's questions.
  • Policy and law: shape how society governs AI. Next: law, ethics and economics, with the technical understanding you now have.

Whichever path you take: keep building small things, read widely, test everything, and stay curious about both what AI can do and what it should do.

Level check

  • Choose a project with available data, a success measure and a baseline
  • Fill in a project canvas
  • Follow the eight milestones from definition to presentation
  • Build, train and evaluate a model from scratch, with a confusion matrix
  • Analyse errors and choose the most useful next step
  • Carry out a responsible AI check
  • Write a model card
  • Present a project clearly, including its limitations

Key terms you must be able to define

Capstone project
A final project that brings together everything a course has taught.
Project canvas
A one-page plan of a project's problem, users, data, success measure, model, risks and demo.
Baseline
The simplest approach a model must beat to be worth building.
End to end
A version of the whole system that runs from raw input to final output, however simple.
Error analysis
Studying a model's mistakes to find patterns and decide what to improve.
Ablation
Removing one part of a system to measure how much it contributes.
Model card
A short document describing a model's purpose, data, performance, limitations and risks.
README
A file explaining what a project is and how to run it.
Reproducible
Able to be run again by someone else to get the same results.

Flashcards

DefineCapstone project
AnswerA final project that brings together everything a course has taught.
DefineProject canvas
AnswerA one-page plan of a project's problem, users, data, success measure, model, risks and demo.
DefineBaseline
AnswerThe simplest approach a model must beat to be worth building.
DefineEnd to end
AnswerA version of the whole system that runs from raw input to final output, however simple.
DefineError analysis
AnswerStudying a model's mistakes to find patterns and decide what to improve.
DefineAblation
AnswerRemoving one part of a system to measure how much it contributes.
DefineModel card
AnswerA short document describing a model's purpose, data, performance, limitations and risks.
DefineREADME
AnswerA file explaining what a project is and how to run it.

Go further: notes for future AI engineers

Ablations: what really matters?

Once your model works, remove one ingredient at a time, a feature, a layer, a cleaning step, and measure how much worse it gets. These ablation studies show which parts of a system earn their place. Researchers include them in almost every paper, because they turn "it works" into "it works because of this".

From toy to real

The worked project's 26 messages make the ideas clear but are far too few for a real filter. A real version would use thousands of labelled messages, split by date so the test set comes after the training data, handle misspellings and links, and be evaluated on the cost of each kind of error. The structure, though, would be exactly the same: data, features, model, evaluation, error analysis, model card.

Misconceptions to avoid

Avoid these
  • Choosing a project with no available data. Check the data exists before anything else.
  • Building a complex model before a baseline. Without one, you cannot tell whether the model helps.
  • Tuning on the test set. Use the validation set to choose, and the test set once at the end.
  • Reporting only accuracy. Show the confusion matrix and real mistakes.
  • Hiding the limitations. A model card that lists them honestly makes a project more credible, not less.
Fun fact

The first spam filters that learned from examples, in the late 1990s, used the same idea as this lesson's worked project: count which words appear in spam and which in genuine messages, and let the evidence add up.

Knowledge check

0 of 10 answered
1What should a good first capstone project have?
2Why build a baseline before the real model?
3When should the test set be used?
4The spam model missed "cheap loans approved today no checks". What is the most useful next step?
5Why is a test set of six messages a problem?
6What is error analysis?
7Which belongs in a model card?
8What does "end to end" mean when building a first model?
9What does an ablation study measure?
10Which question belongs in a responsible AI check?
Score 0 / 10

Check you could explain this

10 marks
1Plan a capstone project that builds a model to sort customer emails into "complaint", "question" and "praise". Describe the main stages.6 marks
Describe

Mark scheme0 / 6
  • LDefine the problem, users and a success measure (e.g. accuracy/F1 per class, compared with a baseline)
  • LCollect and label example emails, checking label quality
  • LSplit into training, validation and test sets
  • LBuild a baseline (e.g. most common class or keyword rules)
  • LTrain a model (e.g. bag of words with logistic regression) end to end
  • LEvaluate with a confusion matrix and analyse errors; improve
  • LResponsible check and model card; present
Model answer

First I would define the problem: sorting emails so staff can answer complaints quickly, measured by the precision and recall for each class compared with a baseline that always predicts the most common class. Next I would collect several hundred real or realistic emails, label them carefully, and split them into training, validation and test sets. I would build the baseline, then a simple model, such as logistic regression on a bag of words, running end to end. I would evaluate it on the validation set with a confusion matrix, study the misclassified emails to decide what to improve, and change one thing at a time. Finally I would check privacy, since emails contain personal data, test the final model once on the test set, write a model card listing its limitations, and present it.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.

Think this answer or mark scheme is wrong? Report it

2Explain why error analysis and a model card make an AI project more trustworthy.4 marks
Explain

Mark scheme0 / 4
  • LError analysis reveals patterns in the model's mistakes
  • LIt shows what to improve, e.g. more varied data rather than a bigger model
  • LA model card documents purpose, data, performance and limitations
  • LSo users know when not to rely on it and can use it safely / honesty builds trust
Model answer

Error analysis looks closely at the model's actual mistakes, revealing patterns such as missing spam that uses words never seen in training, which shows what would really improve it, more varied data rather than a bigger model, and shows the builder understands its behaviour. A model card records the model's purpose, what it must not be used for, its data, its performance overall and for different groups, and its limitations and risks. Together they let users know when the model can be relied on and when it cannot, which makes it safer to use, and honesty about weaknesses makes the whole project more credible.

The marker looks for key phrases. If you said it another way and it is still right, give yourself the mark.

Think this answer or mark scheme is wrong? Report it

Machine mark 0 / 10