Inspiration

Food waste is a growing global issue, with millions of tons of food discarded every year. Restaurants, cafeterias, and food suppliers often struggle with managing inventory and predicting demand, leading to both excess waste and financial loss. The inspiration for FoodStack came from a desire to leverage data and machine learning to tackle this problem while promoting sustainability and reducing food waste.

What it does

FoodStack is a real-time food demand prediction system that helps restaurants, cafeterias, and food suppliers make smarter inventory and production decisions. By analyzing historical data such as day, hour, and popular dishes, it predicts future demand accurately, reducing overproduction and waste.

How we built it

Data Integration: Food sales data was collected and managed using MongoDB

Machine Learning: We implemented an online learning model using SGDRegressor for real-time model updates using Databricks. The model is designed to handle partial fits with new incoming data.

Data Preprocessing: A ColumnTransformer pipeline was built to handle data transformations, including one-hot encoding for categorical variables and scaling for numerical ones, ensuring consistency across dynamic datasets using Databricks.

Continuous Integration: A continuous integration pipeline was created to automate the model's retraining and updating process in response to new data, ensuring seamless integration into production environments using Databricks.

Challenges we ran into

Endpoint Integration: Establishing seamless connections between MongoDB and Databricks proved to be more time-consuming than anticipated, particularly when handling real-time updates and ensuring data synchronisation.

Developing the Logic for Continuous Integration: Building the logic for continuous integration (CI) involved creating a robust pipeline where the machine learning model could dynamically update itself with new incoming data using online learning (partial_fit). This required ensuring that the model could seamlessly integrate new data while retaining its previous knowledge. Updates did not disrupt ongoing predictions or compromise prediction accuracy.

Accomplishments that we're proud of

Continuous Integration with Online Learning: Successfully implemented a CI pipeline that updates the model in real-time using partial fits, ensuring the system adapts dynamically as new data becomes available. This enables continuous improvement of prediction accuracy without retraining the model from scratch.

Database Integration: Built an efficient pipeline to retrieve, process, and update data in MongoDB, ensuring predictions are stored and updated seamlessly in the predicted_data collection.

Real-Time Predictions: Designed a system that delivers accurate, real-time predictions while maintaining scalability and consistency with dynamically changing datasets.

What we learned

The importance of consistent preprocessing when working with dynamic and heterogeneous datasets.

Best practices for integrating machine learning models into real-time database systems like MongoDB.

The complexities of handling outliers and seasonality in demand forecasting, especially during peak hours and holidays.

How to align machine learning outputs with sustainability goals to drive measurable impact.

What's next for FoodStack

Handling Peak Hours and Outliers: Build a specialized model to predict demand surges during peak hours, holidays, and special events by incorporating external factors like weather and calendar events.

Advanced Waste Tracker: Develop a robust waste tracking system that quantifies the environmental impact (e.g., carbon footprint) of waste reduction efforts and provides actionable recommendations for further improvement.

Holidays and Seasonal Adjustments: Extend the model to account for seasonality and holiday-specific demand patterns that were not fully addressed during the hackathon.

Enhanced Sustainability Metrics: Integrate tools to track the broader environmental impact, such as water and energy savings from reduced waste.

Dashboard and User Interface: Create an intuitive dashboard for users to view real-time predictions, sustainability metrics, and actionable insights.

Scalability: Expand the system to support multi-location businesses and larger datasets while maintaining efficiency.

Integration with IoT: Explore the integration of IoT sensors to monitor real-time inventory and further improve prediction accuracy.

Built With

Share this project:

Updates