Case History Palmabit

Our Stories

The challenge of Pastificio Trafilata: forecasting sales in the near future

The challenge of Pastificio Trafilata: forecasting sales in the near future

The main problem addressed in this project was the development of a reliable sales forecasting model for the Trafilata pasta factory. This model needed to be able to analyze historical sales data from the past three years and use it to predict future sales trends. This is not a simple task, as sales can be influenced by a number of factors, many of which can change over time. Therefore, the model needed to be flexible and adaptable to account for these variations. Additionally, the model had to be implemented in a way that could be easily integrated into the company's existing operational processes.

Our solution: artificial intelligence for sales forecasting

Our solution was the implementation of a predictive artificial intelligence model. This model was trained using the company's historical sales data from the past three years, allowing it to identify trends and patterns in sales. The model was then optimized through a training and validation process to ensure its reliability and accuracy.

The result is a web service, in the form of an API, that the company can easily integrate into its operational processes. This service allows the company to obtain accurate forecasts of future sales based on the predictive artificial intelligence model.

This tool not only improves the company's ability to predict its sales but also facilitates business planning and optimization. In fact, thanks to these forecasts, the company can anticipate customer demand, manage inventory more effectively, and optimize production.

Outline of activities performed:

  1. Data Collection: Acquire historical data relevant to the problem being solved.
  2. Data Exploration:
    • Analyze the data to identify trends, patterns, and relationships.
    • Handle any missing values or outliers.
  3. Data Preparation:
    • Transform and prepare the data for input into the model.
    • Encoding categorical variables, normalizing data.
  4. Data Splitting: into training and test sets to evaluate the model's performance.
  5. Model Selection.
  6. Model Training:
    • Use a training set to teach the model the relationships between variables.
    • Optimize the model's parameters to improve its performance.
  7. Model Validation: Use the test set to evaluate the model's performance on unseen data.
  8. Prototype Creation: Develop a working prototype of the predictive model.
  9. Model Deployment: Create an API to make the model accessible by third-party services.

Technologies used

For predicting the sales of Trafilata pasta factory, AI was used with Python as the programming language. Tools used include Pandas for data manipulation, Scikit-learn for machine learning models, Matplotlib for plotting, Google Colab as the environment, and Prophet for time series analysis.

The model deployment process involved several key steps to ensure a secure, reliable, and scalable execution environment. Here is a detailed description of the steps followed:

  1. Creating the Docker Image: Initially, we developed a Docker image that encapsulates the application. This step is crucial because it allows encapsulating the application's execution environment along with all its dependencies into a single, portable unit. The Docker image was designed to be lightweight and optimized, ensuring fast startup times and efficient resource management.
  2. Uploading to AWS Elastic Container Registry (ECR): After creating the Docker image, we uploaded it to AWS ECR, a managed Docker registry service that facilitates the storage, management, and deployment of Docker images. AWS ECR offers robust security features, including integration with IAM for access control, making the management of our images more secure.
  3. Deployment on Amazon Elastic Container Service (ECS): The final step involved using Amazon ECS, a highly scalable container management service that allows running and managing distributed applications on container architecture. We configured ECS to automatically orchestrate the deployment of containers based on the Docker images previously uploaded to ECR. This includes defining tasks, services, and using clusters to control and scale application instances according to demand.

Thanks to this structured approach, we benefited from greater operational efficiency and better application availability. The combination of Docker, AWS ECR, and ECS facilitated the management of the deployment lifecycle, from building the image to releasing it in production, ensuring horizontal scalability for variable workloads and flexibility to quickly adapt to the evolving needs of our project.

The product we created

Our product, a web API, integrates easily into business processes to provide precise sales forecasts through a predictive artificial intelligence model. The API is intuitive, customizable, and enhances sales forecasting, production optimization, and inventory management.

Here is an example of a chart created to estimate sales forecasts for a specific type of pasta on a monthly scale.

The data shows actual sales with the black dot, the estimated sales average with the blue line, and the margin of error with the blue shade.

The numbers above describe the accuracy of the estimate, in detail:

  • Mean Absolute Error: MAE is the average of the absolute value of errors between predicted and actual values. It is a way to measure how good a model's predictions are. For example, an MAE of 5 indicates that on average, the predicted values deviate from the actual values by 5;
  • Root Mean Squared Error: RMSE is similar to MAE but gives more weight to larger errors. It is calculated by finding the mean of the squares of the errors and then taking the square root of this mean;
  • Mean Absolute Percentage Error: MAPE is the average of the absolute value of the percentage error. It is like MAE but measured in percentage.

Sales chart

Specifically for the chart above, we have an MAE of 70. This indicates that the average error committed during the process is 70. In practical terms, it means that every month, if the predicted value is 100, we expect the actual value to be in the range of 30 to 170. This range is obtained by subtracting and adding the MAE to the predicted value (100-70 and 100+70).

Next, we have RMSE. It works similarly to MAE, but it calculates the square root of the mean squared error, which means smaller values have less weight.

Finally, we have MAPE. In this case, its value of 0.56 indicates that on average, the prediction error is 56%. This means that if the forecast was 100, the actual value could vary by 56% on average, either up or down.

Discover how we can help your business too

Artificial intelligence has the potential to revolutionize every aspect of business, including improving sales forecasts. As demonstrated by the case of Trafilata pasta factory, a predictive artificial intelligence model can provide valuable insights and help optimize business operations.

If you are interested in seeing how your company can benefit from artificial intelligence, we are here to help. Contact us to discuss a personalized case study. Send us an email or use the form below.

Get in touch:



Not sure where to start? Talk to us.
If you need to design and build a prototype, take your project from concept to fruition.
Contact us today for your free consultation.


hello@palmabit.com


Via Monsignor Oscar Romero 5
25018, Montichiari (BS)

Via Francesco Olgiati 26,
20143 Milano


100/100
100/100
100/100
5000/5000
I have read the policy regarding processing of personal data pursuant to articles 13 and 14 of Regulation (EU) 2016/679 (GDPR) * I allow Palmabit SRL to perform re-marketing via Facebook Pixel ™ and Google AdWords ™ described in the policy Privacy policy I wish to receive updates and news via email. No more than ten emails per year. NO SPAM, guaranteed.