BCA
Machine-learning evaluation
Study map: Original subject-specific business–computing teaching chapter
Machine-learning evaluation asks how a predictive procedure performs on relevant evidence and whether that performance supports a decision. A score may rank orders for manual review; the business action is whether to review them and what happens next. A high score is not an approval, an explanation or a proven probability. The distinction matters when people and service commitments are affected.
Foundation: evaluate the decision a score supports
Machine-learning evaluation asks how a predictive procedure performs on relevant evidence and whether that performance supports a decision. A score may rank orders for manual review; the business action is whether to review them and what happens next. A high score is not an approval, an explanation or a proven probability. The distinction matters when people and service commitments are affected.
Define the positive outcome. In the fixture, positive means a case genuinely needs review under an invented label. A true positive is correctly flagged, a false positive is unnecessarily flagged, a false negative is missed and a true negative is correctly left unflagged. The eight supplied scores and labels are synthetic. No model is trained, and the exercise does not estimate real-world performance.
Compare with a simple baseline. If only three of eight cases are positive, always predicting negative achieves five correct decisions, or 62.5% accuracy, while detecting none of the cases needing review. Accuracy alone can conceal the failure relevant to the business. Explain the outcome, measure and error consequence before choosing a more complex model.
Undergraduate: calculate confusion counts and metrics
At a threshold of 0.5, the exercise flags scores at least 0.5. It yields two true positives, two false positives, one false negative and three true negatives. Accuracy is five divided by eight, or 62.5%. Precision is two divided by four, or 50%. Recall is two divided by three, about 66.7%. Each denominator describes a different population.
Undefined metrics need honest handling. If no cases are flagged, precision has a zero denominator and is undefined; it is not automatically perfect. If there are no positive labels, recall is undefined. The lab returns a missing value for these cases so the learner must explain them. A dashboard that substitutes a flattering number hides the meaning of the result.
An invented cost of ten units per false positive and fifty per false negative gives loss twenty plus fifty, or seventy units at threshold 0.5. This cost table is a teaching assumption, not a monetary assessment of real people or errors. Review capacity also matters: a policy that flags more cases than staff can review needs an explicit prioritisation or capacity decision.
Precision uses predicted positives as its denominator: TP/(TP+FP). Recall uses actual positives as its denominator: TP/(TP+FN). Here four cases are flagged and three cases are truly positive. A zero denominator makes the corresponding metric undefined; report that boundary rather than assigning a perfect score.
Postgraduate: prevent leakage and separate selection from testing
Apply an outcome–split–metric–cost–capacity framework. Define the outcome, separate evidence for development and evaluation, choose measures reflecting the decision and inspect operational consequences. Information unavailable at decision time must not enter the prediction. A correction recorded after delivery is not a legitimate feature for predicting review need before approval.
Fit transformations and tune thresholds using appropriate development evidence, then evaluate a frozen procedure on untouched evidence. Repeatedly changing the threshold to improve the final test result turns the test into selection data. This workshop explores candidates on one synthetic fixture; it makes no claim of an independent generalisation test. State that boundary rather than presenting the lowest fixture loss as the best production policy.
Consider feedback and human judgement. Review actions can change observed outcomes, and labels may reflect inconsistent prior decisions. Inspect subgroup performance where appropriate and supported by enough evidence, without treating tiny differences as established discrimination or superiority. A score supports an accountable process; managers must validate the objective, error costs, capacity and correction rights.
Research: report uncertainty and operational effects
A research question may compare a review policy with a baseline on missed cases, unnecessary review and service delay. Define label quality, observation duration and eligible population. Use a design that prevents future information leakage and respects the effects on affected people. Performance estimates from small samples require uncertainty and careful interpretation.
Investigate calibration separately from classification. A score can rank well without representing a reliable probability. A threshold chosen for one workload can become inappropriate when prevalence or capacity changes. Monitor the relevant evidence and define who may revise the policy, with a reviewed version and a new evaluation.
Submit confusion calculations, baseline comparison, feature-time audit, threshold rationale and capacity memo. Explain who reviews, whom a missed case affects, whose labels are used, what the score means, when features are available and how errors are corrected. The lab verifies arithmetic under fixed synthetic scores; deployment, training, calibration and causal business benefit remain separate work.
Study questions and answers
Why can 62.5% accuracy be an inadequate baseline here?
Always negative correctly labels five of eight cases but finds none of the three positives. The measure misses the review objective. Indicative marking: Identify majority baseline 3; show five of eight correct 2; explain zero detected positives 3; tie limitation to review objective 2.
TP2, FP2, FN1, TN3: compute accuracy, precision, recall and loss FP10/FN50.
Accuracy=5/8=62.5%; precision=2/4=50%; recall=2/3≈66.7%; loss=2×10+1×50=70 units under the assumed costs. Indicative marking: Accuracy formula and 5/8 result 2; precision formula and 2/4 result 2; recall formula and 2/3 result 2; weighted loss 70 with assumed costs 2; interpret denominators and scope 2.
Why not repeatedly optimise on the final test set?
That turns test evidence into selection evidence and weakens the independent estimate. Select using development evidence, freeze the policy and then test. Indicative marking: Explain test contamination 4; distinguish development selection from frozen testing 4; state why independent estimate weakens 2.
What evaluation is missing from the score fixture?
It trains no model and has no independent generalisation test. Label quality, representative evidence, calibration, operational effects and capacity require separate investigation. Indicative marking: Recognise no model training or generalisation evidence 3; discuss labels and representativeness 3; calibration and operational capacity 2; justified further evaluation 2.
Extended practice questions
Why can 62.5% accuracy be an inadequate baseline here?
Always negative correctly labels five of eight cases but finds none of the three positives. The measure misses the review objective.
Marking guide: Identify majority baseline 3; show five of eight correct 2; explain zero detected positives 3; tie limitation to review objective 2.
Marks: 10
TP2, FP2, FN1, TN3: compute accuracy, precision, recall and loss FP10/FN50.
Accuracy=5/8=62.5%; precision=2/4=50%; recall=2/3≈66.7%; loss=2×10+1×50=70 units under the assumed costs.
Marking guide: Accuracy formula and 5/8 result 2; precision formula and 2/4 result 2; recall formula and 2/3 result 2; weighted loss 70 with assumed costs 2; interpret denominators and scope 2.
Marks: 10
Why not repeatedly optimise on the final test set?
That turns test evidence into selection evidence and weakens the independent estimate. Select using development evidence, freeze the policy and then test.
Marking guide: Explain test contamination 4; distinguish development selection from frozen testing 4; state why independent estimate weakens 2.
Marks: 10
What evaluation is missing from the score fixture?
It trains no model and has no independent generalisation test. Label quality, representative evidence, calibration, operational effects and capacity require separate investigation.
Marking guide: Recognise no model training or generalisation evidence 3; discuss labels and representativeness 3; calibration and operational capacity 2; justified further evaluation 2.
Marks: 10
A model has high overall accuracy but misses many costly problem cases. How should business evaluation change?
Inspect the confusion counts, class prevalence and the consequences of different errors instead of relying on accuracy alone. Compare a simple baseline and assess the operating threshold on evidence separated appropriately from training. A missed serious case may matter more than an unnecessary review, but the costs and available review capacity must be defined. Managers approve the action policy; technical staff explain the measured tradeoffs and limitations. Test whether the evaluation population resembles intended use. A high score cannot justify deployment if it hides the errors that undermine the actual business decision.
Marking guide: Confusion/prevalence/cost; baseline/threshold; held-out evidence; review capacity; intended population. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Compare precision and recall for a model flagging invoices for review.
Precision asks what share of flagged cases are actually positive under the evaluation labels. Recall asks what share of actual positive cases are flagged. Increasing the number reviewed may recover more positives while also creating more false alerts; the exact tradeoff depends on the scores and data. Define the positive label and check label reliability. Finance owns the review objective and error consequences, while analysts report both measures and the selected threshold. Neither measure directly establishes financial value, causal benefit or performance on every future invoice population.
Marking guide: Correct denominators; review tradeoff; label quality; threshold/roles; value and future limits. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Synthetic evaluation has 18 true positives, six false positives, twelve false negatives and 64 true negatives. Calculate precision, recall and accuracy.
Precision is 18/(18 + 6) = 75%. Recall is 18/(18 + 12) = 60%. Accuracy is (18 + 64)/(18 + 6 + 12 + 64) = 82%. The evaluation contains 100 cases with thirty actual positives. These measures use different denominators and do not determine an optimal action without error costs and review capacity. Confirm the label definition and how the sample was separated from training. A manager should understand why 82% accuracy can coexist with missing 40% of positive cases, rather than choosing the most favourable-looking percentage.
Marking guide: 75%/60%/82%; 100 cases/30 positives; denominators; 40% missed; cost/capacity. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Specify an evaluation protocol for a bounded classification lab.
Define the task, positive label, baseline and intended decision. Separate fitting from evaluation using a split appropriate to the data, including time or entity boundaries where relevant. Fit transformations only with the permitted training evidence and preserve the evaluation set for the stated comparison. Report confusion counts, relevant metrics, threshold and error consequences. Inspect a few failures without claiming they represent every cause. Use synthetic or appropriately authorised data. The lab validates the measured procedure under its assumptions; it does not certify future reliability, fairness or the business value of acting on its output.
Marking guide: Task/label/baseline; appropriate split/leakage; counts/threshold/cost; failures; bounded conclusion. Indicative allocation: reasoning 4; application or workings 3; assumptions and limits 3.
Marks: 10
Revision cards
Why separate training, validation and final test roles?
Training fits the model; validation supports development choices; a held-out test assesses the resulting choice under defined conditions. Repeatedly choosing based on test results leaks selection into that assessment. The split must also respect time, groups and the use case.
A model has high overall accuracy but misses many costly problem cases. How should business evaluation change?
Evaluate the costly error types, baseline, threshold and review capacity on suitable held-out evidence. Accuracy alone may conceal the failures that matter.
Compare precision and recall for a model flagging invoices for review.
Precision is true positives among flags; recall is true positives among actual positives. Report both with the label definition and review policy.
Synthetic evaluation has 18 true positives, six false positives, twelve false negatives and 64 true negatives. Calculate precision, recall and accuracy.
Precision 75%, recall 60%, accuracy 82%. Twelve of thirty actual positives are missed: 40%, despite the apparently strong accuracy.
Specify an evaluation protocol for a bounded classification lab.
Define task and baseline, separate fitting from evaluation, prevent leakage and report counts with error consequences. A lab score is not a future-performance guarantee.
How do precision and recall answer different questions?
Precision asks what fraction of predicted positives are true positives; recall asks what fraction of actual positives were found. Their denominators differ. Choose and interpret them with the business consequences of false alarms and missed cases.
Why can a random split mislead a forecasting evaluation?
It may allow information from later periods to influence a model assessed on earlier events. Use a design matching when information becomes available. Respecting time alone is insufficient if features still contain future outcomes or delayed records.
What does calibration add to classification evaluation?
It assesses whether predicted probabilities correspond appropriately to observed frequencies under the evaluation conditions. Ranking and calibration are distinct. A useful ordering of cases does not guarantee that a predicted probability is suitable for a cost-based decision.
Why evaluate relevant subgroups as well as the overall score?
An aggregate can conceal poor performance or severe errors for a smaller group. Use adequately supported comparisons and respect privacy. A noisy small-sample difference needs careful interpretation, but averaging it away does not resolve possible harm.
Practice task
Complete quality-workshop.html: form contract, accessibility walkthrough, permission table, cloud responsibility table, confusion counts and oversight memo.
Sources and further reading
- Dependable service and AI evaluation workshop
Type: Original local practice
Use: Connect accessible interaction, permission boundaries and synthetic review evaluation. - scikit-learn: metrics and scoring
Type: Free official learning/reference page
Use: Primary further reading; original cases and exercises authored separately.