Validation evaluates a trained model on examples held apart from the data used to adjust its parameters. For classification, it measures how well the network handles unseen samples. section 7.6
A practical validation procedure is:
- Reserve part of the shuffled dataset before training. section 7.6
- Train repeatedly on only the training subset. section 7.6
- Run validate on the held-out inputs, compare interpreted outputs with expected labels, and report correct predictions and percentage. section 7.6
Iris and wine classification
An iris network trains on 140 samples and validates on the final 10, producing 9 correct predictions, or 90%. A wine network trains on 150 samples and validates on 28, producing 27 correct predictions, or 96.43%. section 7.6
// test over the last 10 of the irises in the data set
let irisTesters = Array(irisParameters[140..<150])
let irisTestersCorrects = Array(irisSpecies[140..<150])
let irisResults = irisNetwork.validate(inputs: irisTesters, expecteds:
irisTestersCorrects, interpretOutput: irisInterpretOutput)
print("\(irisResults.correct) correct of \(irisResults.total) =
\(irisResults.percentage * 100)%")
Inspect the complete iris validation call, including held-out slices, expected labels, output interpretation, and accuracy reporting. section 7.6





























