TEA BOT

tea toddling and machine learning / TEAi

BY SARAH FABER

 

I took a class this semester on computational models of human decision making, and it was awesome. I learned about algorithms, and how information is taken in and updated to help us decide *stuff*. The final project was to develop code that could produce data and learn from itself (given parameters I set...the computers aren't going to kill us all).
(Yet).

I would happily outsource most, if not all, of my decisions to computers (for more on this, ask me about my 'death-cursed murder house' index from the last time I moved. See also my spouse's 'spousal angst' index), and wanted to see if I could train a model to predict me. For this, I needed a behaviour that was habitual, where the choices had stable values, and where I choose to exploit familiarity rather than explore new options. For example, think about going to a bakery. They have a whole case full of delicious options, including strawberry tarts (your favourite. Ok...my favourite). They also have Dobos torte, something you’ve heard about on the Great British Bake Off, but haven’t ever tried. You know you’d enjoy the strawberry tart, but the Dobos torte is a mystery. It might be the best thing you’ve ever eaten. It might be vastly inferior to the strawberry tart. WHAT DO YOU DO? This is a classic (and delicious) example of an explore/exploit problem in decision-making, and the plan (or policy) that helps us make these decisions is influenced by environment, personality, time, etc. My personal solution to the bakery problem is to get both, eat both, then roll home; but this isn’t always possible (think about deciding between apartments, or choosing how to spend a limited amount of time).
 
For my assignment, I wanted to eliminate as much of this guesswork as possible. I also wanted something that occurred regularly, so I went with tea. I drink a lot of tea. 

blog15 image1.png

When I am asked how I take my tea, I say, ‘seriously’

I collected my tea choices at three time points over a two-week period and used it as training data for my Tea Bot:

blog15 image2.png

Each tea/tea refusal (n=6) was coded with a value of 1 every time I selected it, and I tried to train my Tea Bot to recommend my next choice after studying the training data I gave it (this is called a six-armed bandit for the nerds). With only 42 data points (3 choices per day * 14 days), performance was poor, and it vacillated between random selection and defaulting to Yorkshire tea (the most popular) depending on the parameters I gave it with an average accuracy of 8%. This was sub-optimal.

blog15 image3.png

Note: sometimes, sub-optimal tea is better than no tea. But only sometimes.
 

Looking at the data, I (and perhaps you!) could see a clear pattern. In the mornings, I drink an unflavoured black tea. In the afternoons, I'm a little more adventurous, and in the evenings, what I drink depends on whether or not I have to get up early the next day. I decided to add day and time as context parameters to my Tea Bot. I also made it interactive, because I think making computers talk is hilarious. Once the Tea Bot knows what day and time it is, it selects the relevant cases from the training dataset and calculates the probability of me selecting each of the six options based on what I did at the same day/time in the past.

This is what it looks like in MatLab

This is what it looks like in MatLab

It selects the tea with the highest probability and recommends that (this is called a greedy policy - it always chooses to exploit rather than explore). If multiple teas are tied, it randomly selects one to offer. From here, I can either accept its recommendation, or refuse and choose something else. In either case, the Tea Bot adds a new row to the training dataset that records the day, time, and my choice. It can then use this choice in the future.

I recorded my tea consumption for an additional ten days, and tested the Tea Bot's accuracy after I made my decisions (this cuts down on the likelihood of me siding with the Tea Bot over my own brain and artificially improving the Bot’s accuracy).

It was 76.7% accurate. This is amazing. And also hilarious. But is it useful?

If you're reading this on the internet (rather than the McIntosh Lab’s hand-lettered periodical), you're part of a much more sophisticated version of this bot that takes your searches, clicks, likes, etc. and tries to anticipate what you're going to do next based on what you already did.

So where does the Tea Bot fit in? In healthcare, wearables (things that track an individual's data...think about a fitness tracker) are growing in popularity. These track biomarkers (for example, heart rate) and compare the wearer’s data to population norms, or to norms based on that individual's past data. These tools track automatic responses and can prompt you to take/avoid an action, but what about habitual behaviours, like hobbies (or tea drinking)?

My background is in Alzheimer's disease, and keeping mentally active is super important. Unfortunately, individuals with Alzheimer’s often present with a lack of motivation or an inability to "get going" with previously enjoyed activities. Something like the Tea Bot could be used to recommend activities based on the individual's history. They, or someone who knows them well, could provide a typical schedule, which could act as the training data for a simple bot. 

blog15 image6.png

It’s early days in researching wearables for individuals with Alzheimer’s, but the possibilities are interesting and exciting. As for the Tea Bot, I’m considering rewriting the policy to be a little more adventurous. I have a very full tea cupboard and would be amused to see if the Bot finds me any new favourites. Tea is, after all, always a good idea.

 

.


McLab Icon_C8A698 mini.png