Start by clarifying the dataset's structure, target variable, and business context to prioritize preparation steps. Then systematically handle data quality issues (missing values, outliers, duplicates), engineer relevant features, and scale/normalize as needed, while documenting each decision and its rationale. Validate the impact of each step through quick experiments or cross-validation to ensure improvements.
Pro tip: Always split your data into train/validation/test sets before any preprocessing to avoid data leakage, and use pipelines to encapsulate all steps for reproducibility. This demonstrates production-ready thinking and prevents subtle bugs.
Explore the dataset (shape, types, distributions, missingness) and clarify the prediction task, evaluation metric, and any domain constraints. This guides which preparation steps are most critical.
Handle missing values (impute or drop), remove duplicates, fix inconsistencies, and treat outliers appropriately. Encode categorical variables and parse dates if needed.
Create new features based on domain knowledge, interactions, or transformations (e.g., log, polynomial). Select relevant features using statistical methods or model-based importance to reduce noise.
Apply scaling (e.g., StandardScaler, MinMaxScaler) or normalization to numerical features as required by the model. Consider power transformations for skewed data.
Use cross-validation to evaluate the impact of preprocessing steps on model performance. Iterate by adding or removing steps based on validation results, ensuring no data leakage.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.
First, read the code carefully to understand its intended purpose and data flow. Then, systematically check each component (data handling, model, loss, optimization) for common ML bugs, and finally verify the fix by reasoning about expected behavior or running a quick test.
Pro tip: Always consider the broader ML context: bugs often stem from data leakage, incorrect tensor shapes, or improper loss functions. Mentioning how you would prevent such bugs in production (e.g., unit tests, data validation) shows maturity.
Identify what the code is supposed to do (e.g., train a classifier, preprocess data) and the expected inputs/outputs. This helps spot logical inconsistencies.
Look for issues like incorrect normalization, data leakage, missing values, or wrong tensor shapes. Ensure data splits are correct and no test data leaks into training.
Verify layer dimensions, activation functions, and weight initialization. Check for mismatches between input and output dimensions or inappropriate activations.
Ensure the loss function matches the task (e.g., cross-entropy for classification) and that the optimizer is correctly configured with appropriate learning rate and parameters.
Check for bugs in the training loop (e.g., missing zero_grad, incorrect backprop) and evaluation metrics. Ensure model is set to train/eval mode appropriately.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.