Features and targets
Learn the reasoning. Try the task. Compare your answer.
Prepared for DataCareerHub · Curriculum version 2026-10-15.1
By the end of this lesson
- Apply features and targets to the fictional case.
- Record the rule, evidence and validation result.
- Explain a limitation and a defensible next step.
Fictional learning case · Local practice files · No personal data.
Understand the method
Features and targets
Features are inputs available when a prediction is made; the target is the outcome to be predicted. Identifiers can memorise entities rather than generalise. Date fields can encode drift or be useful for splitting without belonging in the model. Start with a feature allowlist and explicitly exclude fields that reveal the target or occur after prediction.
Work through the case
The separate pilot_parcels.csv contains 60 synthetic parcels. Use distance_km, load_ratio and zone as predictors. actual_hours is the regression target; late is its thresholded classification target. Both are outcomes, never inputs for the other task in this experiment. post_delivery_rating is especially tempting because it correlates with delay, but it arrives after delivery.
A method you can reproduce
Build X from the three allowed fields and y from the chosen target. Record missing numeric values rather than deleting those rows without measuring coverage. Preprocessing parameters must be fitted on training rows only. The reference uses training medians for missing values and training mean/standard deviation for scaling; category levels are also learned on training rows. New categories receive an explicit unknown-category count.
Check your reasoning
Excluding the target column by name is insufficient if a proxy still reveals it. A feature audit needs field meaning and timing. The reference code’s explicit FEATURES list makes the selection inspectable but cannot replace business review in a real project.
Further reading: NumPy least squares, Preventing leakage, Cross-validation. These official references support the methods; the case and exercises are authored for DataCareerHub.
Practical exercise
List allowed and excluded pilot fields. Explain why dispatch_date is used for ordering but not included as a predictor. Identify two leakage paths.
Write your answer in learner_worksheet.txt and retain the evidence file. Attempt this before opening the solution.
Open the worked solution
Allowed fields are distance_km, load_ratio and zone. Exclude identifiers and all post-dispatch outcome fields. dispatch_date orders observations for evaluation. actual_hours reveals late directly; post_delivery_rating is future information. Fitting a median on all 60 rows is another leakage path even if the target is excluded.
Independent extension: change one relevant input in a separate copy. Predict the result first, rerun the checks and explain any difference. Keep the supplied source unchanged.
One more question.
How these learning materials are prepared and maintained · Report a correction: support@datacareerhub.io
Read and practice without an account. Sign in with an existing account to save lesson completion.
Next lesson →This is a fictional learning case. Results do not establish real-world performance or causal effects. Portfolio practice is not a claim of client work or an accredited qualification. Explore practical lessons, worked examples and projects. Follow a published path, practise the method and build work you can explain.