The runtime and memory constraints are what really got me.
Start by clarifying the business objective and constraints, then outline a modular pipeline that addresses each requirement while optimizing for speed and memory. Emphasize trade-offs and justify choices with respect to the 5-minute and 4GB limits.
Pro tip: Use efficient data types (e.g., category for strings, float32 for numerics) and consider chunked processing or out-of-core libraries like Dask or Polars if pandas struggles. Also, leverage approximate algorithms (e.g., histogram-based gradient boosting) to speed up training.
Ask clarifying questions about the definition of 'at-risk', the desired output format, and any specific reason code requirements. Confirm the environment (e.g., available libraries, single machine) and the evaluation metric.
Propose reading the CSV in chunks or using a memory-efficient library like Polars. Outline validation checks for missing values, data types, and consistency (e.g., delivered date >= ship date).
Describe creating features such as transit time, delay, carrier performance, and scan event aggregations. Define the label (e.g., delivered late) and handle class imbalance if necessary.
Choose a fast, scalable model like LightGBM or XGBoost with cross-validation. Apply probability calibration (e.g., isotonic regression) and use SHAP or feature importances for explanation.
Generate the CSV with top at-risk shipments and reason codes. Discuss optimizations like parallel processing, efficient data structures, and monitoring memory usage to meet the constraints.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.