Skip to content

Project exam · Data Science, Machine Learning and AI

Project exam: a crop adviser with k-nearest neighbours

Project examintermediate· about 1.25 hours· 6 steps· 75 min · pass 60%

The brief

In 75 minutes, build the model behind a farmers' helpline: read the field readings while skipping bad rows, scale the features, measure distance, predict a crop by k-nearest neighbours, score it on held-out farms and pick k by leave-one-out validation.

Why it matters

Agritech start-ups and state agriculture departments give crop and fertiliser advice from soil and weather readings, and k-NN is a common first model because it is simple to explain to a farmer: "farms most like yours grew this". The exam checks the skills a junior ML job needs: clean input, scaling, a correct model, and evaluation that does not cheat.

Skills you practise

  • reading CSV safely
  • min-max scaling
  • Euclidean distance
  • k-nearest neighbours
  • test accuracy
  • leave-one-out validation

What you will have at the end

adviser.py: a k-NN crop adviser that reads messy field data, scales it, predicts a crop and reports honest test and validation accuracy.

How it is marked (rubric, 100 points)
Correct modelEvery step passes: reading, scaling, distance, prediction with ties, test accuracy and leave-one-out.50
No leakageThe scaler and k are chosen from training data only; the test set is used just to report the final score.20
Clean functionsEach function does one job and reuses the earlier ones; no repeated code.20
Finished in timeAll six steps handed in within 75 minutes.10
  • 6tasks
  • 75 mintime limit
  • 60%to pass

Rules: a project exam

  • The exam opens full screen. Stay on this page until you hand it in.
  • Opening another tab or app, or leaving full screen, counts as one time away. After 3 times the exam ends.
  • No copy or paste during the exam.
  • No hints and no answers. You can run your code, but the checks run only when you hand in.
  • Every task is checked automatically when you hand in, or when the time is up.
  • You see which tasks passed at the end. You can take it again.
Not yet, go back