Eight rows have inputs and labels . A lookup rule answers with the label stored for an input when that input is in its table, and otherwise copies the label of the nearest input in the table, measured along the line. The gaps between consecutive inputs increase, so no tie ever occurs.
Take the rule as fitted on all eight rows, then evaluate it by leave-one-out: hold out one row, fit the rule on the other seven, and predict the held-out row. Derive the leave-one-out error rate. Explain why the training error of the same fitted rule is zero, and say what the comparison shows about the two sections.
Worked solution
The training error is zero because each of the eight inputs is present in the table. On row the rule finds the stored label and returns it, so all eight predictions equal the recorded labels:
For leave-one-out, remove row and predict it from the remaining seven. The nearest remaining input is determined by the gaps. Write . At an interior row , the distance to the left neighbour is and the distance to the right neighbour is . The gaps are so and the left neighbour is strictly closer. Row 1 has no left neighbour, so its nearest remaining input is row 2. Therefore the leave-one-out prediction is for row 1 and for every other row:
Compare this with the recorded labels:
| row | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |---|---|---|---|---|---|---|---|---| | | 0 | 1 | 3 | 6 | 10 | 15 | 21 | 28 | | | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | | held-out prediction | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | | correct? | yes | yes | no | yes | no | no | yes | no |
Rows 3, 5, 6 and 8 are wrong, so the leave-one-out error rate is
The comparison is section 15.1's point in one table. One stored label per row drives the training error to zero, and the zero says only that the table can reproduce what it was given. Section 15.2's leave-one-out score asks a different question, because the held-out row is never in the table and the rule must fall back on a neighbour. The fallback recovers the label on the rows whose label agrees with the neighbour they copy, namely rows 1, 2, 4 and 7. The same fitted rule therefore scores 0 in training and 0.5 under leave-one-out. Leave-one-out is cross-validation with one row per fold; it costs eight fits and it estimates the procedure's error on unseen rows, not the memoriser's stored answers.