← Data Science learning path0%
04
Week 4 · 43 slides + Lab 4
From Clean Data to Useful Predictions
Transformations, feature engineering, pipelines, prediction and data leakage.
Not started yet
Start Quiz mastery0%
What you’ll take away
- What are we predicting, for whom, and when?
- Representation changes distance.
- Fit once on training; reuse the rule.
- A fixed ruler can measure beyond its endpoints.
- Logs compress gaps, not the order.
- Names are not ranks.
- Every feature needs a recipe.
- Could we really know this at the cutoff?
- Keep the boundary around learning.
- Split → fit training → reuse → evaluate.
- Same order. Same fitted rules.
- A performance number needs a denominator.
Lecture topics
Define the prediction problem; Nearest-student reasoning by hand; Standardisation, fit and transform; Min-max scaling; Log transformation and trees; Encoding categories and unknown values; Engineer features with a source, unit and window; Event time and availability time; Three leakage routes; Pipelines preserve the fitted procedure; A five-position vector by hand; Error, accuracy and model complexity
Builds on 3. Data Cleaning and Quality
Lessons
- Define the prediction problemA prediction is a guess about a target using information available at a stated decision time. Define the task before choosing a model.6 min
- Nearest-student reasoning by handA nearest-neighbour rule compares a new record with training records and uses the closest one's known label. How values are represented affects “closest”.6 min
- Standardisation, fit and transformStandardisation puts numeric features into reference-SD units. Learn its parameters from training data and keep them fixed for later records.6 min
- Min-max scalingMin–max scaling uses the training minimum and maximum as a fixed ruler. A future value can fall outside that ruler.6 min
- Log transformation and treesA log transform compresses large positive differences while keeping the order. In this course, log1p(x) means ln(1+x) for nonnegative counts.6 min
- Encoding categories and unknown valuesProgramme names are labels, not a ranking. One-hot encoding uses one indicator position for each saved category.6 min
- Engineer features with a source, unit and windowA feature is useful only when you can explain how it was made, what it measures, and whether it was available in time.6 min
- Event time and availability timeThe date an event happened and the date you could use its information are not always the same. Prediction must follow availability time.6 min
- Three leakage routesLeakage lets a model use information it should not have. It can make test results look better than real future performance.6 min
- Pipelines preserve the fitted procedureA pipeline keeps preprocessing and prediction steps together so the same fitted rules are used on later records.7 min
- A five-position vector by handA vector is an ordered list of numbers. Each position must have the same meaning for every student.6 min
- Error, accuracy and model complexityError is the share of evaluated cases predicted incorrectly. A strong result on training cases or a tiny test set does not guarantee good future predictions.6 min
Practise this week · Lab 4: Transformations, Pipelines and Prediction5 guided sections · Follow the supplied split from raw records to an honest test result.
Key terms
- Target
- What you want to predict.
- Feature
- An input used to predict.
- Cutoff
- The latest information the system may use.
- Euclidean distance
- Square root of the sum of squared coordinate differences.
- Neighbour
- A compared training record.
- Fit
- Learn parameters from training data.
- Transform
- Apply the saved parameters.
- Standardise
- Subtract mean, divide by SD.
- Min–max rule
- (value−training minimum)/(training maximum−training minimum).
- Monotone
- Preserves the order of values.
- Threshold tree
- Makes splits such as “value ≤ a cutoff”.
- One-hot
- A vector of category indicators.
- Unknown category
- A value not in the fitted category list.
- Feature engineering
- Creating inputs from recorded information.
- Time window
- The exact period included in a calculation.
- Event time
- When something happened.
- Availability time
- When the system could access its recorded information.
- Future leakage
- Later information in early prediction.
- Target leakage
- The answer enters inputs.
- Test leakage
- Held-out data influence fitting or choices.
- Pipeline
- Ordered processing steps.
- Imputation
- Filling missing values using a stated rule.
- Validation
- Data used to choose settings.
- Coordinate
- One position in a vector.
- Saved parameters
- The training values used to transform later records.
- Error
- Wrong/evaluated.
- Overfitting
- Learning details that do not carry well to new data.
- Training
- Learns the procedure.
- Test
- Checks predictions against known outcomes.
- New
- Receives a prediction without a known outcome.
- Training median
- The middle observed training value.
- Population-style SD
- The specified scaler convention using n.
- Feature order
- The meaning assigned to each position.
- One-hot positions
- CS, Economics and Psychology.
- Nearest neighbour
- The training record with the smallest distance under the saved representation.
- argmin
- Position of the smallest value.
- Provenance flag
- A marker showing where a value came from.
Practice this topic72 questions · earn XP and build your streak