InterviewStack.io LogoInterviewStack.io

Data Preprocessing and Handling for AI Questions

Covers the end to end preparation of raw data for analysis and modeling in machine learning and artificial intelligence. Topics include data collection and ingestion, data quality assessment, detecting and handling missing values with deletion or various imputation strategies, identifying and treating outliers, removing duplicates, and standardizing formats such as dates and categorical labels. Includes data type conversions, categorical variable encoding, feature scaling and normalization, standardization to zero mean and unit variance, and guidance on when each is appropriate given model choice. Covers feature engineering and selection, addressing class imbalance with sampling and weighting methods, and domain specific preprocessing such as data augmentation for computer vision and text preprocessing for natural language processing. Emphasizes correct order of operations, reproducible pipelines, splitting data into training validation and test sets, cross validation practices, and documenting preprocessing decisions and their impact on model performance. Also explains which models are sensitive to feature scale, common pitfalls, and evaluation strategies to ensure preprocessing does not leak information.

HardTechnical
86 practiced
Hard: Case study — After merging two datasets for feature enrichment, downstream model accuracy dropped despite no change in model code. Describe a systematic investigation plan: which data checks to run, how to compare pre-merge and post-merge feature distributions, how to use unit tests and shadow runs to locate the issue, and how to communicate findings to stakeholders.
HardTechnical
67 practiced
Case study: A retail recommendation model starts returning worse results after adding a new preprocessing step that buckets prices into 10 bins. Walk through how you'd diagnose whether bucketing or a downstream change caused the regression. Include specific analyses, checks, and rollbacks you would perform.
MediumTechnical
87 practiced
You have a numeric feature with a heavy right skew and outliers. Explain when to use log transform, Box-Cox, or Yeo-Johnson transforms during preprocessing. For each transform, state constraints (e.g., input domain) and how you'd validate that applying the transform improved model performance.
EasyTechnical
64 practiced
Easy: For a numeric column with occasional extreme outliers and many zeros (zero-inflated), explain simple preprocessing options (e.g., winsorization, clipping, log(1+x), indicator for zero). Recommend a default approach for tree models and a default for linear/GLM models, with brief justification.
EasyTechnical
76 practiced
Implement in Python a function detect_outliers_iqr(df, column, k=1.5) that returns the indices of rows considered outliers using the IQR method (below Q1 - k*IQR or above Q3 + k*IQR). The function should handle NaNs gracefully and work for numeric columns stored as strings. Provide a simple example and mention limitations of IQR for skewed distributions.

Unlock Full Question Bank

Get access to hundreds of Data Preprocessing and Handling for AI interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.