Business.
Easy to digest.

by Finiata Team

Blog by
Finiata Team

How a custom AI revolutionised Finiata’s weekly Pizza Order

Did you know that an adult makes about 35,000 decisions a day?

At Finiata, we push one crucial, life-changing decision on our Executive Assistant Lena every (Pizza-)Thursday: how many Pizzas should I order for the whole office? 

Making this decision is tougher than it sounds. The benefit of a home office or flexible working hours means we can take our work anywhere we are, so on some days the office is more empty than on others. Some of us are vegetarian, some are vegan, some have gluten and/or lactose intolerance. And what does the dog get?? 

After countless annoying surveys and unreliable answers, we decided to let our technical expertise work for us. In only 2 days we build a Machine Learning model, which predicts how many pizzas Lena has to order so that everyone is happy, no food gets wasted and even our office pup Kenzo gets his piece of crust! Who says work and fun can’t go hand in hand?

Finiata’s definition of being a tech company: using Artificial Intelligence to feed its employees.

Now, don’t shun at the sight of Machine Learning. When I was younger, my mum used to tell me not to open the freezer (scream, ice cream!) else I will get sucked into it and no one will be able to find me, ever again. Back then, it scared the hell out of me. These days, what scares people is Machine Learning, the seemingly untouchable. Today, we all know that freezers don’t eat people (maybe in horror movies), and neither does AI. It can, in fact, have great uses, from predicting the probability of our customer paying back a loan on time to feeding the employee that teaches it how to do it. I won’t be throwing jargon at you, so don’t worry!

Pattern recognition – How to teach a machine what humans eat?

Like a human, our AI needs to learn patterns to make accurate conclusions. It remembers certain things that repeat itself. Real-life examples for patterns could be for example that you know that the bus you’re taking to work tends to be 5 minutes late every day, so you don’t rush when going to the bus stop. Or that whenever you eat something with onions in it, you seem to enjoy it much less than dishes without onions in them. 

Our model uses this logic but instead focuses on other patterns, useful to its purpose of establishing how many pizzas we need to order. For example, it remembers this one colleague, who always works from home on Tuesday and Wednesday. Or that other colleague, who always eats big portion sizes for lunch every day. 

We are creatures of routine and Machine Learning strives on patterns. 

What we’ve essentially done is gathered all the information our colleague looked for when ordering for Pizza-Thursday and fed it into a custom Machine Learning Model as if she was the one taking the time to find these bits of data.

Problem approach – 3 Steps until AI Pizza

We approached the problem of our pizza order in three steps.

Firstly, we need to gather data about the needs and preferences of our employees.

Secondly, we need to find patterns, for example, how many employees will usually be at the office on a Thursday.

Thirdly, we need to make a conclusion on how many and what kind of pizzas need to be ordered. 

Step 1: Gather data

This step was the most time consuming for our colleague Lena. In order to get the most information, Lena had to manually go through multiple data sources. Every week she checked in our HR calendar, who is at the office, who is on vacation and who decided to take home office. She also evaluated a mini-survey we conducted every week on Slack. If you wanted to eat pizza, you were to click on a pizza emoji. Salad eaters had to click on a salad emoji. Unfortunately, the surveys were terribly unreliable, as not everyone answered in time. Also, we only asked whether someone wants pizza or salad, not how much pizza they would like to actually eat. We tried more complex surveys, but they would have a very low turnout and did not generate enough data. Individual dietary needs Lena just had to remember. 

In the end, Lena had to gather all this information and still ordered too many or too few pizzas. On one occasion, we even ordered 24 family-sized pizzas instead of 24 regular pizzas. We ended up eating pizza for lunch for 3 days. 

What made Lena’s life so hard:

  • Unreliable HR data
    • Not everyone logged home office in HR software
  • Unreliable survey data
    • some employees didn’t answer the survey in time
    • The survey was also too general, but any attempt at introducing a more sophisticated survey ended with a drop in participation
  • Irregular working times of some colleagues
    • Some employees were already gone at the time we got Pizza

We took the tasks and learnings from Lena and built a machine learning model that does a lot of what Lena already did, but more efficiently and fully automated.

First, our model extracts absences, birthdays, sick leaves and other HR relevant information from our HR Platform Personio. This way we determine who is out of the office and therefore does not need to have pizza ordered. You remember the problem that our calendar wasn’t always reliable, because employees did not reliably log every day of a home office in Personio? To counter this weakness, we trained our model to take the past 7 weeks of absences into account. Based on how often the employee was out in these past 7 weeks, our AI makes a prediction on how likely they will be out on the day the pizza is due to be ordered. We also added the variable of how often each employee tends to work from home each week, to make an even more precise prediction whether they will be out during Pizza-Time. 

To top everything off, we sent around a one time survey on each employee preference, taking into account their dietary needs as well as preferred portion sizes. 

Step 2: Find Patterns

Collecting Data is a crucial step in getting any prediction right, but it’s not enough to just collect it. Before we can make a decision, we need to recognize patterns in the data we have gathered. Lena used mainly her gut feeling and intuition to recognise how many people will be at the office for our Pizza-Party and how much each person is going to eat. Our “gut feeling” might be handy for simple decisions, for example, whether you should go out for partying after work or whether you should choose sushi over burgers for lunch. What is a gut feeling, if not a decision you arrived at thanks to your mind analyzing the situation subconsciously? However, the more complex a decision is, the less you can trust that gut feeling. We learned that for a Pizza order for one whole office, a gut feeling is not sufficient. 

So we let our AI rank the importance of every piece of information it collects. Some pieces of data are more predictive than others. Putting these in a ranking allows the model to determine the probability of the employees present at the office more accurately. 

Step 3: Making a conclusion

With all the necessary information collected and ranked, we are now finally able to make a conclusion. Lena would’ve now manually counted the number of pizzas we should order and probably added some estimation based on her trusted gut feeling. In the end, Lena spent a few hours on a pizza order that was either too big, too small or not diverse enough. There would always be some salads left and some of us left hungry, despite Lena doing her best job.

Enter our pizza model. Within seconds our model has calculated and put out the probability of how many and which people will be present at the office. It multiplies the predicted number of people with the portion sizes determined in the one-time survey we conducted and adds dietary restrictions, such as gluten or lactose intolerances as well as other preferences, such as vegetarian or vegan, to the outcome. We are left with a perfectly measured order for Lena to put into Lieferando. An hour later, everyone is happy, including Kenzo!

Validating our AI – Did it work?

It’s easy for us to say that the model has revolutionised our pizza orders forever. We could’ve ended up with 24 family-sized pizzas again and just not tell you. That’s where validation comes into play. 

We observe two outputs of our model and validate how precise the model predicts them. 

The outputs are the number of employees the AI predicts and the amount of leftover pizza after our lunch. 

Validation 1 – Number of employees: 

We have observed that our model predicts the number of employees with a precision of 0.8333. That means that for every 10 employees the model predicted to be present at the office, 8.3 are actually participating in the lunch. Or rather 8 people and one small dog accounting for the 0.3 people left.

Validation 2 – Amount of leftover pizza: 

We have made some great progress here. On our first run with the model, we ended up with 4 leftover pizzas (booh!). How could we go so wrong? 

We decided to be more generous in rounding up probabilities calculated by our model. We treated every probability higher than 0.75 (or 75%) as a 1 (or 100%). So, if the model said that it’s 75% likely that our vegan colleague Tim will be at the office that day, we assumed he will be, even though there’s still a 1 in 4 chance that he will actually enjoy working from his own couch that day. 

For the next test, we decided to not mess with rounding up any numbers and instead multiplied the plain probabilities, just as we got them from the model, with the pizza portion sizes declared in our survey. Et voilà, no food was wasted. But more importantly, not one of our coworkers went back to work hungry!

Real-life problem solving is in our blood

Real-life problem solving is the core of our company. As a business loan provider, we solve our customers’ real-life cash flow problems every single day. Why stop there? Problem-solving is in our blood, and our Pizza AI proves it. If you would like to become part of a team that solves real-life problems every day, feel free to visit our career pages at https://www.finiata.com/careers/

Author: Chen Pei Tan

Edited by: Monika Butterweck

Subscribe to our newsletter and never miss a post

We promise we won’t spam you. You can unsubscribe anytime.

Subscribe to our newsletter

We promise we won’t spam you. You can unsubscribe anytime.