Build a model.
Back up your claims.
Train a small classifier, test the model you chose, and explain what the results do—and do not—show. Everything runs in this browser.
Can one straight boundary solve this?
Imagine sorting points on a map into two classes. Opposite signs—such as (0.7, −0.7)—usually mean class 1. Matching signs usually mean class 0. One straight decision boundary cannot separate this XOR pattern. A hidden layer can transform the coordinates into a more useful representation.
Some labels in the supplied data are randomly flipped. Your task is to learn a useful pattern and report honest evidence, not force every dot to be correct.
Start with the project lab ↓Your training score improves after a change, but your validation score gets worse. What should you do before opening the test set?
Train. Compare. Choose.
- Try 0 hidden layers as a baseline. Train 500 epochs and keep the validation candidate.
- Try one hidden layer with eight neurons. Train 500 epochs, then another 500 if useful. Keep the candidate and compare validation loss, mistakes, and parameter count.
- Optionally add labeled training points or a small weight penalty. Change one factor at a time and explain any tradeoff.
- Restore the candidate you choose, freeze it, and evaluate once on the test set.
- Inspect errors and write all five sections of the model card. Export the report.
Loading the local classifier project…
Three datasets, three different jobs
The training examples determine the gradients that change weights. The validation examples help you compare settings or decide when to stop. The test examples provide an independent check of the final frozen model, as long as you have not used their outcomes to choose it.
All three supplied splits are generated from separate fixed random streams. They sample the same synthetic XOR task with an 8% chance of a label flip per example. They are small samples, so their observed noise and accuracy differ. Adding points changes only the training set. A held-out result here says nothing by itself about photos, language, medical decisions, or any other real-world task.
Follow the actual learning computation
Each neuron multiplies inputs by weights and adds a bias. Hidden layers use tanh, which smoothly maps a score between −1 and 1 and introduces nonlinearity. The final neuron uses sigmoid to produce a number between 0 and 1. We predict class 1 when that value is at least 0.5.
Training minimizes mean cross-entropy, plus an optional weight penalty. Backpropagation calculates sensitivities; gradient descent updates all parameters simultaneously. One epoch here is one full-batch update using every training example. Validation and test data never enter those updates. The network trace uses the current learned weights and the selected example; its animation does not change parameters.
Two useful measurements can disagree
Accuracy counts how many predictions cross the 0.5 threshold on the correct side. Cross-entropy also considers how much probability the model assigned to the observed label. A confidently wrong prediction can greatly increase loss without changing the number of mistakes. Compare both measures, and inspect individual errors.
The confusion matrix separates the two kinds of mistakes: observed 0 predicted as 1, and observed 1 predicted as 0. In another task those errors might have different consequences. In this project, neither class represents a real person or a consequential decision.
Honest reporting is part of the model
Saved candidates keep their settings, training additions, weights, and validation results. The same validation set is reused, so extensive experimentation can also overfit your choices to validation. The first untouched test evaluation is a useful final check, not a guarantee.
If you resume training after seeing the test, the project preserves that history and labels later test evaluations as practice. A model card should state the intended use, the data, the selection process, the results, and the limitations. Completion requires a trained, frozen model and text in each card section; it does not automatically grade the writing or certify the model’s quality.
You inspected the test results, resumed tuning, and now see a higher test score on those same examples. What can your report claim?
A classifier you can explain.
You have connected architecture, training, validation, testing, and documentation in one experiment. Keep the report with your saved work. Build AI Systems extends these ideas to systems that take actions and learn from outcomes.
Builds on ebook lessons 1–4, lesson 8, and lesson 11.