← Module 3: Software Automation
Inquiry Question 1: How do machine learning systems work?
Distinguish machine learning from classical programming, and define the roles of model, features, training data and predictions
A focused answer to the HSC Software Engineering Module 3 dot point on what machine learning is. Classical programming vs ML, the role of training data, features, model and predictions, the worked example, and the traps markers look for.
Have a quick question? Jump to the Q&A page
What this dot point is asking
NESA wants you to draw the fundamental distinction between writing rules by hand (classical programming) and having an algorithm learn rules from data (machine learning). You also need to know the standard ML vocabulary: model, features, training data, labels, predictions.
The answer
Classical programming
The developer writes the rules. The program takes inputs and applies the rules to produce outputs.
rules + data --> answers
Example: a thermostat. "If temperature > 25, turn on the AC." The developer decides the rule.
Machine learning
The developer provides examples (data plus the correct answers). The algorithm learns the rules.
data + answers --> model
Then in use:
model + new data --> predictions
Example: an image classifier. The developer collects 100,000 photos labelled "cat" or "dog", and trains a model to predict the label from the pixels.
The standard vocabulary
- Training data: the examples used to train the model. Typically a table where each row is one example.
- Features: the input columns. For email spam, features might be
subject_length,contains_url,sender_blacklisted. Features need to be numeric (or one-hot encoded categories) for most algorithms. - Label (also called target): the answer column for each training example. "spam" or "not spam".
- Model: the trained artefact. Internally, a set of learned parameters that map features to predictions.
- Prediction: the model's output for a new, unseen example.
- Training: the algorithm that fits the model's parameters to the training data.
- Inference: using the trained model to make predictions on new data.
Worked Python
A minimal end-to-end ML workflow with scikit-learn:
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
# Training data: 150 iris flowers, 4 features each, 3 species labels.
data = load_iris()
X = data.data # features: sepal/petal lengths and widths
y = data.target # label: species (0, 1, or 2)
# Split into training and test sets.
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
# Train.
model = LogisticRegression(max_iter=1000)
model.fit(X_train, y_train)
# Predict on unseen examples.
predictions = model.predict(X_test)
# Evaluate.
print(f"Accuracy: {accuracy_score(y_test, predictions):.2f}")
The developer wrote no rules about iris species. The model learned the boundaries from the training data.
When to use ML vs classical
ML is the right tool when:
- The rules are complex, change over time, or are hard to articulate (spam, image recognition, machine translation).
- Labelled data is available in volume.
- An approximate answer is acceptable (predictions are probabilistic, not exact).
Classical programming is the right tool when:
- The rules are well-understood and stable (calculating GST, sorting a list, parsing JSON).
- Errors are unacceptable (banking transactions, control systems).
- The dataset is small or unavailable.
ML is a tool, not a default. Most software is still classical because the rules are clear and exact answers are required.
The training/test split
You never evaluate a model on data it has already seen. Standard practice:
- 60-80 percent of the data is the training set.
- 10-20 percent is the validation set, used during development to tune hyperparameters.
- 10-20 percent is the test set, used once at the end to estimate real-world performance.
If the test accuracy is much lower than training accuracy, the model is overfitting - it memorised the training data instead of learning patterns that generalise.
Past exam questions, worked
Real questions from past NESA papers on this dot point, with our answer explainer.
2024 HSC4 marksDistinguish between classical programming and machine learning. Use the example of classifying email as spam or not spam.Show worked answer →
In classical programming the developer writes the rules. To classify spam, the developer might write code like: "if the subject contains 'viagra' OR the sender is on a blacklist OR there are too many exclamation marks, mark as spam". The program takes rules and data and produces answers.
In machine learning the developer provides examples and lets the algorithm find the rules. The developer collects thousands of labelled emails ("spam" or "not spam") - the training data. An algorithm (logistic regression, a naive Bayes classifier, a neural network) analyses the features (words in the subject, sender, capitalisation, links, attachments) and learns weights that best separate spam from non-spam. The program takes data and answers and produces a model that can predict new examples.
Spam classification works better with ML because:
- Spammers change tactics constantly. Hand-written rules go stale; ML retrained on recent data adapts.
- Many subtle signals (combinations of features) matter together. ML captures interactions classical rules miss.
- Labelling is cheap (users click "this is spam") and large datasets are available.
Markers reward the explicit contrast (classical: rules + data leads to answers; ML: data + answers leads to model), the spam-specific application, and at least one reason ML is preferred for this problem.
Related dot points
- Compare supervised, unsupervised and reinforcement learning, and identify a typical application of each
A focused answer to the HSC Software Engineering Module 3 dot point on learning paradigms. Supervised classification and regression, unsupervised clustering, reinforcement learning, applications of each, the worked example, and the traps markers look for.
- Describe the basic structure of a neural network, including neurons, layers, weights, activation functions and training by backpropagation
A focused answer to the HSC Software Engineering Module 3 dot point on neural networks. Neurons, layers, weights, activation functions, forward pass, backpropagation, the worked example, and the traps markers look for.
- Explain how the quality and representativeness of training data affect a model, including the risks of bias and overfitting
A focused answer to the HSC Software Engineering Module 3 dot point on training data. Sample bias, label bias, the train/test split, overfitting and underfitting, the worked example, and the traps markers look for.