Transformations, Pipelines and Prediction
Follow the supplied split from raw records to an honest test result.
Lab 4 is supplied as a PDF instruction sheet. These five sections preserve the worked solution to Task 7 (pages 6–7). Open the PDF for all seven original tasks. Run the Python in your own notebook; this site does not execute it.
Lecture-to-lab connections 5 sections
Records, split and early activity →
The supplied split tells you which records teach the rules and which records only receive predictions. Keep those roles separate.
Lab 4 PDF pp. 6–7 · Task 7
Saved parameters and imputation →
The training rows supply every replacement and scaling value. Filling a gap lets the model run, but does not recover the true measurement.
Lab 4 PDF pp. 6–7 · Task 7
Six-position vectors →
The lab uses three scaled numbers followed by three programme indicators. This fixed layout tells the distance calculation what to compare.
Lab 4 PDF pp. 6–7 · Task 7
Distances and predictions →
Use all six feature positions to calculate distance to training students. Choose the smallest distance, then take that training student's label.
Lab 4 PDF pp. 6–7 · Task 7
Readable implementation →
The code should carry out the exact stated rules, including missing-value handling, feature order and tie-breaking. Explain these decisions rather than memorising lines.
Lab 4 PDF pp. 6–7 · Task 7
Before submitting
Follow the original PDF and current course submission instructions. Keep the training/test split fixed, show the fitted parameters and feature order, and report test performance separately from the new student prediction.
Source: data-science-fundamentals-week-4-lab-instructions.pdf. Original PDF instructions; worked explanations are study material.