← Learning Hub
Advanced

Project: Predicting Daily Orders

Let's build a complete small project: predict how many orders a shop will get each day, so it can plan stock and staff. We'll make realistic data, prepare features, compare two models, and explain the winner.

This project follows the full ML workflow on a realistic business problem: create features, split data, compare models against a baseline, and explain the result. In real projects, the explanation and the honesty about limits are as important as the accuracy number.

Example
You can edit this code.

What we learned

  • The simple linear model is about as good as the forest here, and much easier to explain: sales add about 90 orders, festivals about 60, weekends about 40
  • Features from the date (weekday, festival season) matter more than fancy models
  • Always compare against a simple baseline before choosing a complex model

Take it further

  • Use your real order history from a CSV (see the Data Analysis course)
  • Add features: holidays, weather, ad spend, last week's orders
  • Test on the latest months instead of a random split - that's closer to real forecasting
  • Save the model with joblib.dump(model, "orders.joblib") and serve it from an API (see Node.js or Spring Boot)
This data is made up for learning, so the model finds exactly the pattern we put in. Real data is noisier - expect bigger errors and keep checking.
Key points
  • Compare complex models against a simple baseline.
  • Good features often matter more than the model.
  • Test on the most recent data for forecasting.

📝 Test yourself

1. Why compare with a simple model first?
2. For forecasting, which test split is closer to real life?
3. Fill in the function that saves a trained model to a file:
joblib.(model, "orders.joblib")