Can One k Always Maximize kNN Leave-One-Out Accuracy?

Read the full interview experience this question came from →

Quick Overview

Explain why kNN has no universally optimal leave-one-out k and choose neighbors with correct holdout, preprocessing, and evaluation.

Can One k Always Maximize kNN Leave-One-Out Accuracy?

Company: C3 AI

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Online Assessment

# Can One k Always Maximize kNN Leave-One-Out Accuracy? A question asks which value of k maximizes leave-one-out cross-validation accuracy for k-nearest-neighbor classification: 1, 3, 5, any k gives the same result, or none of the above. No dataset, distance metric, or labels are supplied. What can you conclude, and how would you choose k when data are available? ### What a Strong Answer Covers - Recognition that no universal k maximizes leave-one-out accuracy across datasets. - Correct exclusion of each held-out observation from its own neighbor set. - The bias-variance trade-off and leakage-safe preprocessing. ```hint The held-out point is absent The zero distance from a training observation to itself cannot give k=1 perfect leave-one-out accuracy. ``` ### Follow-up Questions - Why is training accuracy at k=1 different from leave-one-out accuracy? - How should feature scaling be fitted within the validation procedure?

Overview: Explain why kNN has no universally optimal leave-one-out k and choose neighbors with correct holdout, preprocessing, and evaluation.

Read the full C3 AI Data Scientist interview experience this question came from

C3 AI logo
C3 AI
Sep 15, 2026
mediumData ScientistOnline AssessmentMachine Learning
3
0

Can One k Always Maximize kNN Leave-One-Out Accuracy?

A question asks which value of k maximizes leave-one-out cross-validation accuracy for k-nearest-neighbor classification: 1, 3, 5, any k gives the same result, or none of the above. No dataset, distance metric, or labels are supplied. What can you conclude, and how would you choose k when data are available?

What a Strong Answer Covers Guidance

  • Recognition that no universal k maximizes leave-one-out accuracy across datasets.
  • Correct exclusion of each held-out observation from its own neighbor set.
  • The bias-variance trade-off and leakage-safe preprocessing.

Follow-up Questions Guidance

  • Why is training accuracy at k=1 different from leave-one-out accuracy?
  • How should feature scaling be fitted within the validation procedure?