← Coding labs/

Fix Feature Engineering Bug

Debuggingeasy~20 min
Objective

Fix three data engineering bugs that cause model performance to degrade in production.

Background

Your model performs well in offline evaluation but fails in production. After investigation, you discover the feature engineering pipeline has three bugs: target leakage in feature construction, incorrect datetime feature extraction, and missing null value handling that causes downstream NaN errors.

Requirements
  1. 1.Remove target leakage: the label column must not be used as a feature
  2. 2.Fix datetime feature extraction to use day_of_week instead of raw day
  3. 3.Add null handling for numeric columns before feature computation
Evaluation (100 points)
No target leakage
The label column must not appear in the feature matrix
30pt
Correct day-of-week extraction
Datetime features should use dayofweek (0-6) not day (1-31)
25pt
Null values handled
handle_nulls should fill or drop NaN values
25pt
Derived features handle division edge cases
price_per_unit should not produce NaN/Inf from null inputs
20pt
Hints
Select a file to start editing
Terminal
$
AI Assistant50K tokens left

Ask me about the code, bugs, or concepts.
I'll guide you in plain English, no code output.
Budget: 50K tokens per lab