🧭 Mentorship plan
Written from the value chain only: the original document was not available.
This mentorship plan guides students through building a real-time, AI-driven system for dynamic demand forecasting and perishable inventory optimization. Learners will develop components that detect market regime shifts and recommend optimal food preparation quantities, minimizing waste and stockouts in food service operations.
Pace rule: Each step starts with a question. The learner answers it in their own words, then does the task. A step's typical days are the time given. A learner who has not answered by then is not chased: the mentor moves on to learners who are moving, and the door stays open for when they return.
Who this is for
Final-year engineering or computer science students in Pakistan with basic programming skills, an interest in data science, and a desire to build practical, real-world applications.Starting point
Learners should be proficient in Python, understand basic data structures and algorithms, and have a foundational grasp of statistics. Prior exposure to machine learning concepts and cloud services is beneficial but not strictly required.Components
- Component name
- Dynamic Demand Regime Forecaster
- Skill areas
- AI
- Cloud computing
- Data engineering
- Why it matters
- This component is the brain of the system, responsible for detecting real-time shifts in market demand. By identifying 'Normal,' 'Elevated Risk,' or 'Shock' regimes, it allows the entire value chain to proactively adapt, making critical decisions about inventory and preparation that directly impact profitability and customer satisfaction.
- Ladder
Step Question Where to look Student task Mentor checks Typical days 1 What is a JSON endpoint, and how is data typically retrieved from it using Python's `requests` library? Python 'requests' library documentation Write a Python script to fetch dummy weather data (JSON) from a public API endpoint like Open-Meteo.com for Karachi, Pakistan. Extract and print the current temperature and weather description. Learner's explanation of JSON endpoints and the `requests` library. Output from script showing 'Temperature: 25.0 °C, Description: Clear sky' (or similar based on real-time data). 2 2 How are missing values and outliers commonly handled in time-series data before using it for forecasting or classification? Pandas documentation for `fillna()` and `rolling()` methods, or a data cleaning textbook chapter. Generate a synthetic daily sales dataset (CSV, 30 days) for a restaurant with 10% random missing values and 3-5 clear outliers. Apply a 7-day rolling mean imputation for missing values and flag outliers using a simple Z-score (values > 3 standard deviations from mean). Learner's explanation of handling missing values and outliers. A cleaned CSV file with no `NaN` values and a new column 'is_outlier' marked `True` for flagged points. (Pass if at least 80% of generated outliers are correctly flagged). 2 3 What are two common time-based features that can be extracted from a timestamp and how can they improve a demand forecasting model? Scikit-learn feature engineering documentation (e.g., `datetime` properties) or a time series analysis guide. Given a Pandas DataFrame with a 'timestamp' column (e.g., '2023-10-26 14:30:00'), add new columns for 'hour_of_day' (0-23) and 'day_of_week' (0-6, Monday=0). Learner's explanation of time-based features and their utility. A Pandas DataFrame showing correct numerical values for 'hour_of_day' and 'day_of_week' for 10 sample rows. (Pass if 100% accurate). 2 4 How can a simple threshold-based rule be used to identify a 'Shock' state in daily sales data, based on its deviation from a historical average? Statistical process control charts or anomaly detection methods based on standard deviation. Write a Python script that simulates 30 days of daily sales for a single menu item. Calculate a 7-day moving average and standard deviation. Implement a rule: if today's sales are 2.5 standard deviations above the moving average, classify it as 'Shock'; otherwise, 'Normal'. Print the classification for each of the last 7 days. Learner's explanation of thresholding for shock detection. Script output correctly classifying simulated sales days. (Pass if the script correctly flags the simulated shock days according to the rule). 3 5 Why is a classification model, such as Logistic Regression, often preferred over simple thresholding for identifying multiple distinct 'regimes' (e.g., Normal, Elevated Risk, Shock) using various input features? Scikit-learn Logistic Regression documentation, specifically its application in multi-class classification. Create a synthetic dataset (CSV, 100 rows) with features like 'sales_deviation_from_avg', 'event_flag' (0/1), 'weather_impact_score' (-1 to 1), and a target 'regime' (0=Normal, 1=Elevated Risk, 2=Shock). Train a Scikit-learn Logistic Regression model to classify regimes. Report the model's accuracy on a 20% hold-out test set. Learner's explanation comparing classification models to thresholding. Model accuracy score on test set (e.g., 75% or higher). 4 6 How can data from multiple external sources (e.g., news, events, weather) be combined with internal sales data to create a unified feature set for a real-time predictive model, ensuring proper time alignment? Pandas `merge` or `concat` documentation, focusing on time series alignment techniques. Create two mock Python functions acting as APIs: `get_mock_event_data(date)` returning a dictionary with `event_flag` (0/1) and `sentiment_score` for a given date, and `get_mock_weather_data(date)` returning `temperature_avg` and `is_rainy` (0/1). Write a script that calls these, combines their outputs with a mock daily sales dataset (including 'sales_deviation'), and aligns all data by date into a single Pandas DataFrame for the last 15 days. Learner's explanation of data combination and alignment. A Pandas DataFrame showing sales, event, and weather data correctly merged and aligned by date, with no missing values due to misalignment, for the specified period. 4 7 What are the primary benefits of using a serverless function (e.g., AWS Lambda, Azure Functions) for deploying a small, event-driven prediction model, particularly concerning cost and scalability for intermittent calls? AWS Lambda or Azure Functions introductory documentation (e.g., 'What is Lambda?' or 'Introduction to Azure Functions'). Deploy the simple regime detection script from Step 4 (or a simplified version of Step 5's model inference) as an AWS Lambda function or Azure Function. Configure it to be triggered by an HTTP POST request, accepting a simplified set of input features (e.g., 'current_sales_deviation', 'event_flag') and returning the predicted regime ('Normal'/'Shock'). Learner's explanation of serverless benefits. Successful invocation of the Lambda/Azure Function via a `curl` command or Python `requests` call, returning a correct regime prediction for a given input. (Pass if the function is deployable and returns a valid prediction for at least 3 test cases). 5 8 Why is continuous monitoring crucial for real-time predictive models, and what are two key types of metrics to track for a regime detection system? Concepts of MLOps, AIOps, or general data science monitoring best practices. Enhance the deployed serverless function (from Step 7) to include basic logging of each invocation: log the input features received, the predicted regime, and the timestamp. Store these logs in a simple text file or cloud-native logging service (e.g., CloudWatch, Application Insights). Expose the function as a public API endpoint if not already done. Learner's explanation of monitoring importance and key metrics (e.g., data drift, model accuracy, inference latency). Evidence of structured logs (e.g., JSON lines) recording inputs and outputs for at least 5 invocations. The API endpoint should be accessible and return valid responses. 5 9 Which trade-off would you prioritize between False Positives (predicting a shock when there isn't one, leading to over-preparation) and False Negatives (missing a shock, leading to stockouts) in the 'Regime-Aware Buffer' context, and why, considering costs in PKR? Machine learning textbook chapter on cost-sensitive learning or decision theory, emphasizing business impact. Refine the regime detection model from Step 5/6 (or create a new simple one if preferred) to achieve a specific business objective: minimize False Negatives by 15% even if False Positives increase by up to 5%, given that the cost of a stockout is Rs 500/unit and the cost of waste is Rs 100/unit. Explain your chosen approach (e.g., adjusting classification thresholds, using class weights). Learner's clear justification for their chosen trade-off, considering the PKR costs. A classification report (precision, recall, F1-score) on a test set demonstrating the achieved trade-off. (Pass if the model shows a quantifiable reduction in False Negatives and the associated increase in False Positives is within the specified bound, with a coherent explanation). 5 - Common mistakes
- Ignoring the impact of timezones and inconsistent data refresh rates when combining external data sources.
- Overfitting the regime detection model to historical data, making it brittle to new or novel shock events.
- Assuming all external signals have equal weight or a linear relationship with demand, leading to inaccurate regime classification.
- Not considering the latency of external data APIs, which can undermine the 'real-time' aspect of the forecaster.
- Failing to adequately preprocess external text data (e.g., news headlines, social media) before using it as features.
- Component name
- Asymmetric Cost Optimization & Buffer Recommendation Engine
- Skill areas
- AI
- Data engineering
- Business and operations
- Why it matters
- This component translates the regime forecast into tangible, actionable recommendations for kitchen staff, directly impacting the restaurant's bottom line. By optimally balancing the costs of waste and stockouts based on the current market regime, it ensures the right amount of food is prepared, leading to reduced waste, fewer lost sales, and improved operational efficiency.
- Ladder
Step Question Where to look Student task Mentor checks Typical days 1 What are the direct financial components that contribute to the 'Cost of Waste' for a perishable food item in a restaurant, and how are they typically measured in PKR? Basic restaurant accounting principles or food costing guides. For a 'Chicken Biryani' portion, list and quantify its 'Cost of Waste'. Assume: 150g chicken (Rs 600/kg), 100g rice (Rs 200/kg), spices (Rs 50/portion), oil (Rs 30/portion), labor (Rs 150/portion cooked), disposal cost (Rs 10/portion). Calculate the total Cost of Waste per portion in PKR. Learner's clear itemized breakdown of waste components and calculation. Total Cost of Waste: Rs 290 per portion. 2 2 What is a simple moving average (SMA) forecast, and what are its inputs and outputs? Wikipedia or any basic time series forecasting textbook section on moving averages. Given a list of 10 days of sales data for 'Chicken Biryani' (e.g., [80, 90, 75, 100, 110, 85, 95, 105, 92, 115]), calculate and print the 3-day simple moving average forecast for the 11th day. Learner's explanation of SMA inputs/outputs. Output: '3-day SMA forecast for day 11: 104 units'. 2 3 How can the direct financial 'Cost of Stockout' for a single menu item be estimated, considering only lost revenue (profit margin) and not intangible factors? Basic business economics or sales margin calculation guides. Given a 'Chicken Biryani' selling price of Rs 450 per portion and a gross profit margin of 60%, calculate the direct lost profit (Cost of Stockout) for one portion not sold due to stockout. Learner's explanation of lost revenue calculation. Output: 'Direct Cost of Stockout per portion: Rs 270'. 2 4 How does an asymmetric cost function influence the decision to prepare more or less buffer stock when the cost of a stockout is significantly higher than the cost of waste? Concepts of economic order quantity (EOQ) with penalty costs or safety stock calculations in supply chain management. Given a forecast of 100 units of 'Chicken Biryani', a Cost of Waste of Rs 290/unit, and a Cost of Stockout of Rs 270/unit. Assuming an 'uncertainty factor' where demand could be 10% higher than forecast 30% of the time. Calculate a recommended prep quantity that minimizes total expected cost (waste + stockout). Assume you are choosing between preparing 100, 105, or 110 units. Learner's explanation of asymmetric cost impact. A numerical recommended prep quantity (e.g., 105 or 110 units) with the calculated expected total costs for each option. (Pass if the chosen quantity correctly minimizes the expected cost based on calculations). 3 5 How would an 'Elevated Risk' or 'Shock' regime (from the Dynamic Demand Regime Forecaster) dynamically adjust the calculated buffer quantity, considering the increased uncertainty or potential for higher demand? Inventory management theory, safety stock calculation with dynamic demand variability parameters. Modify the script from Step 4. If the regime is 'Normal', use the 'uncertainty factor' of 10% demand exceedance for 30% of the time. If 'Elevated Risk', assume demand could be 15% higher 40% of the time; if 'Shock', assume demand could be 25% higher 50% of the time. Show the recommended prep quantity for each regime, keeping forecast at 100 units. Learner's explanation of dynamic buffer adjustment based on regimes. Three distinct numerical recommended prep quantities (e.g., 105, 110, 120 units) for Normal, Elevated Risk, and Shock regimes, demonstrating the dynamic adjustment with corresponding expected costs. (Pass if calculations are sound and recommendations differ meaningfully). 4 6 What are the critical data points that a Point-of-Sale (POS) system typically provides for inventory management and sales tracking, and how would these be consumed by a recommendation engine? Typical data models of POS systems (e.g., sales transaction tables, inventory movement records). Create a mock CSV file named `pos_sales_data.csv` for 7 days, including columns: `transaction_id`, `timestamp`, `item_id` (e.g., 'biryani_chicken', 'fries_large'), `quantity_sold`, `unit_price`, `location_id`. Write a Python script to ingest this CSV, aggregate daily sales (`quantity_sold`) for each `item_id`, and store it in a Pandas DataFrame. Learner's explanation of POS data consumption. A Pandas DataFrame showing daily total sales for each `item_id` for the 7 simulated days (e.g., 'biryani_chicken': Day1=50, Day2=60...). 3 7 How can a recommendation engine effectively communicate complex optimal prep quantities to a kitchen manager in a user-friendly and actionable format, including the rationale? Principles of UI/UX design for dashboards, data visualization best practices for operations. Create a simple text-based or HTML mockup (no backend required) of a daily prep recommendation dashboard for a kitchen manager. It should display recommended prep quantities for 3 menu items (e.g., 'Chicken Biryani', 'French Fries', 'Daal Chawal'). For each, show the recommended quantity, the previous day's actual sales, and a brief justification (e.g., 'Increased by 15% due to 'Elevated Risk' regime and high stockout cost'). A clear, well-formatted text file or HTML page displaying the mock dashboard. The recommendations should be easy to understand, and the justifications present for each item. (Pass if the mockup clearly presents the required information in an intuitive way). 4 8 Why is it important to track deviations from system recommendations, and what key metrics should be recorded to assess the impact of these deviations on waste and stockouts? Operational audit best practices, A/B testing principles for decision-making systems, or performance monitoring in operations. Extend your recommendation system (e.g., a Python script) to simulate 5 days of operations for 'Chicken Biryani'. For each day, provide a system recommendation (e.g., 100 units). Then, simulate a 'manager decision' (e.g., 90 units on Day 1, 110 units on Day 2). Simulate actual demand (e.g., 95 on Day 1, 105 on Day 2). For each day, record: System Recommendation, Manager Actual Prep, Actual Demand, Resulting Waste (units), Resulting Stockout (units), and their PKR costs. Learner's explanation of deviation tracking importance and metrics (e.g., waste cost, stockout cost, recommendation adherence rate). A log file or console output showing daily records of recommendations, actuals, demand, and calculated waste/stockout units and costs for 5 days. (Pass if calculations are accurate for at least 80% of days). 5 9 Which factors (e.g., food category, price point, shelf-life, demand elasticity) are most critical when deciding the optimal granularity for applying asymmetric cost functions (e.g., per dish vs. per ingredient), and why? Advanced inventory management, cost accounting in food service, or supply chain optimization literature. Develop a simple simulation that compares the total expected cost (waste + stockout) for 'Chicken Biryani' and 'French Fries' over a week. Scenario A: Apply asymmetric costs only to the final dish. Scenario B: Apply asymmetric costs to main ingredients (chicken for Biryani, potatoes for Fries) AND a smaller cost for the final assembly. Based on your simulation results and the characteristics of each dish (e.g., Chicken Biryani's long prep, Fries' short prep/short shelf-life post-prep), recommend which granularity is better for each, justifying your choice. A Python script outputting total expected costs for both dishes under both granularity scenarios. A concluding recommendation and justification for the optimal granularity for each dish, explicitly linking it to the dish characteristics. (Pass if the recommendation is logical and supported by the simulation and stated factors). 5 - Common mistakes
- Inaccurately quantifying the full 'Cost of Waste' (e.g., forgetting labor, energy, or disposal costs).
- Underestimating or completely omitting the intangible 'Cost of Stockout' (e.g., lost customer loyalty, brand reputation damage).
- Failing to account for practical kitchen constraints like prep time, storage capacity, or minimum batch sizes when generating recommendations.
- Generating recommendations that are mathematically optimal but operationally infeasible or too complex for kitchen staff to adopt.
- Not providing an audit trail for manager-overridden decisions, making it impossible to learn from deviations.
Mentor guidance
- Emphasize the 'why' behind each step. Encourage learners to articulate the business problem solved by each task.
- Stress the importance of clear, well-commented code and thorough testing, even for small tasks.
- For 'where_to_look', guide learners to focus on specific sections of documentation rather than generic searches.
- Encourage learners to use Pakistani context (PKR, local examples) in their explanations and calculations.
- Ensure learners are comfortable asking AI tools for *information* and *explanation*, but that the *task* is their own implementation and verification.
- Be flexible with tools for cloud deployment (AWS Lambda, Azure Functions, Google Cloud Functions are all acceptable) if one is more accessible.
- The 'typical_days' are estimates. If a learner takes longer but shows deep understanding, that's preferred over rushing.
- Focus on iterative progress: small, verifiable steps build confidence and consolidate learning more effectively than large, complex assignments.
Assumptions
- The detailed specification document for the value chain (including specific numbers, constraints, and target tests for each component) was not provided; therefore, plausible, illustrative numbers and scenarios consistent with the value chain description have been assumed.
- Learners have access to a personal computer with a working Python environment and internet connectivity.
- Learners have basic familiarity with using command-line interfaces for tasks like `curl` or cloud CLI tools.
- Mentors have sufficient technical expertise in data science, cloud computing, and business operations to guide and evaluate the tasks effectively.
Prepared by InnoQuest's AI from the uploaded document. Check every number before relying on it; assumptions are listed above.