While I browsed our school’s job board for an intern position, my mouse hovered over “Noom.” I wasn’t sure it was for me; isn’t weight loss just a matter of eating less, exercising more, and maybe using sketchy pills? I wanted to work on innovative projects and solve challenging technical problems, and a weight loss app couldn’t possible have those, right?
That was before I got to chat with Artem, Noom’s co-founder, who introduced me to the challenges Noom is trying to solve and its aim to improve personal wellness through technological innovations. I’m so grateful he convinced me to come onboard, because I had an amazing 4 months at Noom with with some of the most friendly and talented co-workers I’ve ever worked with. Thanks to them, I was able to work on innovative, fascinating projects that benefitted millions of users. My favourite of these is the “food oracle” feature for the Noom app.
One interesting thing I learned about weight loss was that it’s less about the diet plan, and more about helping people change their eating habits. To change their habits, people first need to become more conscious of what they eat on a daily basis. An effective way to do this is logging meals, which is why one of Noom’s focuses is making food logging as easy as possible.
The importance of food logging is the motivation behind the feature I worked on, “food oracle.” Food oracle is a clever idea that my mentor, Mark, came up with during a company-wide hackathon. This is the idea: Some food combinations are often consumed together, so what if we used this information to predict what a user is going to log before they even start typing? For example, if someone had a hamburger, there’s a good chance they also had fries. If we can have fries come up automatically in the search results, people can log their meals much more rapidly.
The first step in creating Food Oracle was figuring out the details of the algorithm. Mark already had the core idea: whenever a set of food items are logged together in one meal, the association strength between every food pair in the set will be increased, and in a later meal, the food predictions will be ranked by the sum of their association strength with foods already in the meal. That was the basic idea, but there were still many unanswered questions. For example, how do we account for the difference in food combinations between different people, countries, and mealtimes, and how do we combine the predictions with normal search results (which are ordered by frequency)?
I started tackling these questions by first pulling the relevant data (4GB of food logging history from the past 4 months) and implementing Mark’s algorithm. His algorithm was simple yet effective, and I was able to implement it in Python using basic hash maps and tuples. I then implemented an algorithm evaluation process which would run the algorithm on a training set and then see how well it predicts meals in a test set. Over the next couple of weeks, I experimented with variations of the algorithm and different ways to rank results. While I did this, Mark would periodically check on my progress and provide guidance. Sometimes, even Artem would drop by to see the latest results and throw a few ideas at me.
In the end, I had this:
The x-axis shows how many meals a user has logged, while the y-axis shows what percentage of foods in a meal were in the top 5 predictions by the oracle. All of this is without the user typing anything on the keyboard. This means a user can log almost 50% of their foods without typing! You can also see that over time, the oracle learns about what a particular individual typically eats together in the same meal, making it more accurate the longer a Noomer sticks around.
The next step was to actually implement this in the app. Implementing the algorithm was rather straightforward. The tricky parts were making sure the association scores are updated at appropriate times and the algorithms optimized for performance. I also had to do some refactoring here and there, but at last, my code was pushed to the production branch!
We tested the feature in a few usability studies, where we invited users to the office and watched them use our app. A few users were impressed by the predictions, and many were happily using it even without realizing what it was doing. I also did a short demo during our weekly TGIF, and I was happy to see that everyone was excited about the feature.
After a week of waiting for Apple’s approval, the oracle was live on the App store! Our marketing team also published a post on it. Now, if you log “bread” on Noom, “butter” will magically show up!