AIML Rounds

QUIZ

Data and features

5 questions on Data and features, from 4 lessons. Pick an answer in your head, then open it.

On the roadmap for: ML Engineering, Data Science.

  1. Question 1 of 5

    You encode a high-cardinality feature (e.g. 400 pincodes) by each pincode's average target value. What's the risk, and the fix?

    1. A. Too many new columns: one for each of the 400 pincodes in the data
    2. B. It only works for tree models, not linear ones
    3. C. None: target encoding is always safe to use
    4. D. Leakage from each row's own label; compute it out-of-fold
    View answer

    ✓ D. Leakage from each row's own label; compute it out-of-fold

    Out-of-fold target encoding uses only other rows' labels, so the model can't read its own answer.

    Lesson: Encoding Categorical Features

  2. Question 2 of 5

    Some values are missing, and whether a value is missing may itself mean something. What should you do?

    1. A. Drop every row that has a missing value
    2. B. Fill it with zero and add nothing else
    3. C. Impute it and add a 'was missing' indicator
    4. D. Remove the feature from the model entirely
    View answer

    ✓ C. Impute it and add a 'was missing' indicator

    Missingness is often informative, like slow kitchens not reporting prep time; the indicator lets the model use it.

    Lesson: Missing Values & Feature Scaling

  3. Question 3 of 5

    Which model is largely unaffected by feature scaling?

    1. A. Decision trees and tree ensembles
    2. B. k-nearest neighbours
    3. C. Logistic regression with L2 regularisation
    4. D. Neural networks
    View answer

    ✓ A. Decision trees and tree ensembles

    Trees split on thresholds, so rescaling a feature doesn't change the splits. Distance-based and gradient-trained models need scaling.

    Lesson: Missing Values & Feature Scaling

  4. Question 4 of 5

    You build a 'customer's average order value' feature to predict churn. How do you avoid leaking the future?

    1. A. Use only data available before the prediction time
    2. B. Use all of the customer's orders, past and future
    3. C. Use the test set's averages so it matches evaluation
    4. D. It can't leak, because it's only an average
    View answer

    ✓ A. Use only data available before the prediction time

    Point-in-time correct features match what the model will actually see in production.

    Lesson: Feature Engineering

  5. Question 5 of 5

    Where must feature selection happen when you cross-validate?

    1. A. Inside each training fold, as part of the pipeline
    2. B. Once on the whole dataset, before cross-validation
    3. C. After choosing the final model
    4. D. Only on the test set, after training
    View answer

    ✓ A. Inside each training fold, as part of the pipeline

    Selecting features with all the labels first leaks validation information and inflates the score.

    Lesson: Feature Selection