Data preparation and preprocessing for machine learning.
The Data Playground helps students investigate whether a dataset is fit for a purpose. Students audit the data, choose preparation steps, explain their reasons and hand a reproducible preparation recipe to ML Lab.
Understand. Audit. Prepare. Check. Hand off.
The five-step workflow connects a modelling question to decisions about the data. It asks students to inspect the evidence before changing it and to check what their changes have done.
Tabular audits can identify missing values, repeated rows, unusual values, differences in scale and class imbalance. The lesson chooses which checks and preparation tools are relevant. An audit finding is a reason to investigate, not an instruction to delete the data automatically.
Each transformation has a reason and a cost.
The supported tabular tools include the operations below. An activity can offer a narrower selection and limit the columns or settings students may use.
| Operation | What it does | What students should question |
|---|---|---|
| Handle missing values | Fill blanks using a permitted strategy. | A filled value is an estimate, not a new measurement. |
| Remove duplicates | Keep one copy of repeated rows. | Is the repetition an error or a legitimate repeated observation? |
| Encode categories | Represent a categorical input numerically. | Does the representation introduce an ordering that the categories do not have? |
| Normalise or standardise | Bring numeric features onto a comparable scale. | How does the choice of scale affect distances or training? |
| Drop or derive a column | Remove an input or create a permitted calculation from existing columns. | Is information being lost, or a useful relationship being made explicit? |
| Balance classes | Adjust class representation using the permitted operation. | Does the changed training distribution still represent the intended use? |
The goal is an explained preparation decision. A deliberate decision to leave the data unchanged can also be valid; an untouched screen is not the same as a reasoned choice.
Carry the same recipe into the next lab.
The hand-off records the selected transformations as a preprocessing recipe. ML Lab can replay that recipe against the corresponding base dataset so the model experiment uses the preparation the student committed.
For operations that estimate parameters, the replay uses the recorded values rather than fitting them again during hand-off. This makes it possible to discuss exactly how the data was transformed instead of treating preparation as an invisible setup step.
A replayable recipe does not, on its own, prove that a train–test experiment is free of leakage. That also depends on which rows informed the preparation and how the activity partitions its data. Preparation provenance and evaluation cohorts must be considered together.
The same model can behave differently on different data.
Scale affects distance-based methods such as KNN. Missing values or mismatched records can change what the model is able to learn. Class imbalance can make a strong overall score hide poor performance for a smaller group.
Those connections give students questions to test with model-building and training experiments. A cleaner-looking table does not automatically produce a better or fairer model. The later evaluation still needs to check the result.
The Data Playground also supports image-pack preparation. Image preparation and the two image-training approaches are described in the image classification guide; the table operations above should not be assumed to apply to image pixels.
Keep the decision attached to the evidence.
- Which audit result matters for the question the model must answer?
- What did the transformation improve, and what information did it remove or alter?
- Can another person explain the preparation from the recorded recipe?
- What further check would show whether the preparation helped the model?
For a related classroom investigation, The Body Atlas explores cleaning and combining fictional records. It illustrates the data-quality questions rather than promising every preprocessing control listed in this guide.
Carry an explained data decision into the model experiment.
The ML4Schools workflow connects a preparation recipe to model training and later evaluation within the lesson. Its value is the supplied task and the relationship between those stages, alongside class delivery. Free resources can also teach data science; compare whether the full sequence you need is prepared and how students explain their decisions.
Read the sourced comparison with free AI teaching options and see when each approach may fit.