Model building and training: neural networks, KNN and SVM.
ML4Schools supports tabular neural networks for classification and regression, plus KNN and SVM classifiers in lessons that offer them. Students work through browser controls to investigate what each modelling choice changes.
A category and a number are different tasks.
A classification task predicts a category from the input features. A regression task predicts a number. The dataset's target determines which task the tabular lab is working on.
For a classification neural network, the output represents the categories. For regression, the network ends in one linear output for the numeric target. The lesson fixes the input and output shapes so students can concentrate on the model between them.
Some activities supply a trained model for inspection. Others let students build and train their own. The lesson determines which controls, models and limits are available; this guide describes the supported capabilities rather than a feature checklist for every activity.
The architecture is part of the experiment.
In a student-training activity, students can start with a simple network, edit its hidden layers and train a run. Tabular networks use dense layers and optional dropout. Supported hidden-layer activations include ReLU, sigmoid and tanh.
| Choice | What changes | Question to investigate |
|---|---|---|
| Hidden layers and units | The number and size of the intermediate transformations. | Does a larger model improve validation results, or mainly fit the training examples? |
| Activation | The transformation a hidden unit applies to its input. | How does the model behave with a different non-linear transformation? |
| Dropout | Some activations are omitted during training according to a chosen rate. | How does changing regularisation affect training and validation behaviour? |
| Optimiser and learning rate | Adam or SGD and the size of the training updates. | Does the model learn steadily, change too slowly or become unstable? |
| Epochs | How many passes of training to attempt. | Does more training still improve validation performance? |
The lab checks layer shapes and keeps builds within classroom-sized limits. A lesson can narrow those limits. Adding complexity is a choice to test, not an automatic improvement.
Compare ways of learning a decision.
Where the activity offers them, students can compare a neural network with k-nearest neighbours (KNN) and a support vector machine (SVM). These tabular options are classifiers; the regression path uses a neural network.
| Model | Available choices | What its result means |
|---|---|---|
| KNN | Neighbour count, Euclidean or Manhattan distance, and equal or distance-weighted votes, within the lesson's choices. | The model keeps training examples and uses nearby examples to vote. It does not train neural-network weights or produce an epoch-by-epoch learning curve. |
| SVM | A linear or RBF kernel and a permitted margin-strictness setting. | The model fits a separating boundary. Its score ranks cases by the boundary; it is not a measured probability. |
Changing a KNN neighbour count asks a different question from adding a neural-network layer. A useful comparison keeps the task and evaluation examples consistent, while identifying exactly which setting changed.
Keep the result attached to the build.
Neural-network training shows training and validation curves. Classification uses accuracy curves; regression uses mean absolute error, with loss recorded alongside the error. KNN and SVM fits have a result rather than a neural-network epoch curve.
Students can compare recorded runs and inspect a chosen run. For a supported dense network, the inspection uses that run's trained weights. A KNN or SVM is described in terms of its actual model structure rather than being drawn as a neural network.
Training performance and validation performance answer different questions. Repeatedly choosing a model by its validation results also makes an independent test valuable. A good score alone does not establish suitability for another population or purpose.
Explain what changed and what stayed the same.
- Change one layer or training setting. What happened to training and validation results?
- Where a lesson offers KNN or SVM, compare the kinds of decision each model makes.
- For a numeric target, explain error in the target's units rather than calling it classification accuracy.
- State which data supports the judgement and which new situations remain untested.
Continue with model evaluation and explanations, or see the classroom question behind Tooth Detective. The named activity illustrates the learning topic; it does not imply that it offers every model listed here.
Model choices within a prepared learning sequence.
The ML4Schools proposition combines the controls described here with prepared tasks, datasets and class delivery. Students can investigate architecture, training and evaluation within a structured lesson. Free tools can also train real models; compare the complete teaching sequence and available controls in the course you are considering.
Read the sourced comparison with free AI teaching options and see when each approach may fit.