Do Russians ever smile?
Analyzing human emotions on Instagram
Ever since I moved to London, I hear that Russian people don’t smile. And I thought that I have started noticing it too, especially when I travel back to my motherland. Russia has adopted many attributes of the Western culture in recent years, but one character trait still seems to make Russians differ from most other nations: they are permanently “stone-faced”. There has even been some scientific research that explains this phenomena. Then there is a nation that is perceived to be on the other end of the “emotional spectrum” — Americans. There is a presumption that Americans tend to over-exaggerate their emotions. And of course Americans are famous for their perfect smiles.
Being a data geek, I wanted to test these stereotypes and see if I can prove or disprove them with data. Thanks to the recent advancements in AI and machine learning, we have access to automated face recognition technologies, which among other things can detect human emotions. With a large enough dataset of people’s faces from around the world I could test if Russians are indeed not as smiley as other cultures. One great resource for getting publicly available photos is Instagram, where millions of images and videos are being posted daily. We don’t know nationalities of Instagram users, but for the purpose of this exercise I used the location of where a picture was taken. Since I was specifically interested in pictures with faces, I decided to search for posts with the hashtag #selfie. There might be some bias in this data — a “selfie” is not a normal picture. People in selfies often pose, pout, look very serious, and so on. Still, I thought that with enough data I could start seeing differences in how people express themselves, even if the distinctions are very subtle.
In order to make sure that my findings are statistically valid I have excluded countries with smaller sample sizes. Out of the top 17 countries by the count of selfies posted on Instagram, Russia and Ukraine came as two countries with the lowest percentage of people smiling. Being Russian I was not very impressed with the outcome. But there you go — the reputation of Eastern Europeans as cold and glum is confirmed.
Looking at the “happiest” countries, we can see that Indonesia and Turkey are in the lead, followed by Australia and Italy. It seems that countries that have more sun also have more smiling people. But more data would be needed to test this hypothesis.
United States were only slightly ahead of Great Britain. Maybe the contrast between the US and the rest of the world is not as great as we think.
What about other emotions?
There are 7 different emotions that can be picked up by the AI that I was using, not including “neutral” which simply shows absence of any other emotion. Happiness, of course, is the most frequently observed one. It happens so often that I had to temporarily exclude it from my analysis, otherwise the number of happy people would dwarf people showing any other feelings. This left me with 6 other emotions: sadness, surprise, contempt, anger, disgust and fear. What I wanted to see is how these other feelings are expressed by people from different countries. It was interesting to see that without “happiness” the picture changes completely: Japan appears to be the most “emotional” country with “sadness” or “surprise” being demonstrated by nearly 3% of all people. Korea is the top country in terms of the number of people that appear to be sad.
Another noticeable “outliers” are France where almost 2.4% of all people express contempt and Ukraine where no one ever gets surprised.
After getting the answer to my most burning inquiry, I was keen to explore the data a bit more. My next question was — what is it that makes us happy?
Do we smile more as we get older?
I was curious to know how our emotions change with age. It is worth mentioning that I don’t know the actual age of anyone on Instagram. The age is “guessed” by the AI based on the picture. It turns out that we smile a lot between the age of 8 and 10, but then our happiness goes downhill as we go into our teenage years. Or maybe we just try to “look cool” which means not expressing too much emotion in front of a camera. Between the age of 25 and 40 we learn to smile again.
What about gender?
Another angle I really wanted to explore was gender difference. Women take more selfies which resulted in slight imbalance in my data: 61% of people appearing in the dataset are women.
What is interesting is that although women appear in selfies more often then men, women seem to be appear more in selfies in their early 20s, while men are more active between the age of 25 and 35. Perhaps men just don’t want to grow up?
Of course I wanted to know if women smile more (I would intuitively assume that they do). It turns out that this is the case: 51% of women appear with a smile compared to 39% of men. What was more interesting to see was how women’s and men’s “happiness” changes with age.
It looks like there is not that much difference between boys and girls, but as people get older, we start seeing a striking contrast between women and men. Men do not change that much as they get older while women start smiling a lot more as they age. By the time women turn 40, 9 out of 10 of them would smile in front of a camera. It seems that women’s smiling coincides with posting fewer selfies on Instagram.
Does being in a relationship make us smile more?
What about being in a relationship? Does that make us happy? Intuitively we would say yes, but let’s look at our data to see if we can find some evidence. For the simplicity of the analysis I am going to assume that when two (and only two) people of different genders appear in a picture — they are in some kind of a relationship. Thanks to the AI we can detect people’s gender with a high degree of accuracy. After we split all pictures into two categories: “couple” and “not couple”, we can look at the average percent of people smiling in each one of the two groups. I have decided to keep countries to have more context in the visualization.
It looks like people in relationships are indeed much more happy than when they are not. Or at least this is how they appear.
But wait! Why are we only looking at couples? Do people simply behave differently when they are not alone? As it turns out, people smile more in all selfies where there is more than one person; it does not matter whether the other person is a partner or not. A “group” selfie is very different to “single” selfie. People smile more in a company with more people. Remember “the most famous selfie” from the Oscars ceremony in 2014?
I have used a number of different tools when I did this research. One of the tools is Tableau. Tableau can connect to many data sources, including web based APIs. There is a Web Data Connector for Instagram, which was developed by my colleague Geraldine Zanolli (you would need Tableau Desktop in order to use it). I was able to get the data that I need using this Web Data Connector that plugs straight into the Instagram’s API.
My other challenge was to find an automated service that can read human emotions. Two companies that offer “emotion recognition” APIs are Google and Microsoft. Google offers it as part of the Google’s Cloud Vision API and Microsoft offers something called “Face API” (I find the name quite amusing). Both can detect a range of emotions and some other attributes like age, gender, make up, facial hair, and so on. Both Cloud Vision API and Face API have web forms for uploading pictures, so you can test them with your own photos. Next time, before you play poker, you can practice your poker face and see if any of your emotions can be picked up by AI.
After collecting some Instagram data, I had to deal with the problem of data quality. Both Microsoft and Google charge for API requests after you go over a certain free monthly limit. I wanted to make sure that I only send pictures that actually contain people’s faces. It turns out that about half of all pictures posted with the #selfie tag on Instagram do not contain faces at all. There are many pictures of pets and various random things and objects. It would have been nice to add pictures of pets to my research, but at this point we do not have technology that can “read” an animal’s emotions (or at least I am not familiar with it). For that reason I simply excluded any pictures that did not have human faces from my analysis. A quick and dirty way to do this is to use the face_recognition library. I noticed that the library failed to detect partially obscured faces or faces that are turned sideways; but I concluded it was good enough for my analysis.
Some additional processing was required to map the location of each picture to a country. Instagram only returns location name and latitude and longitude of each photo. I used the reverse_geocoder library which is a great tool for mapping locations with known geographical coordinates to countries.
After adding geographical data and filtering out “wrong” pictures I was able to build a dashboard that I used to visually explore the dataset before I moved on to the next step of the analysis.
The rest of the analysis was trivial. Slightly more complex questions can be answered with the help of Level of Detail expressions in Tableau. For instance to identify pictures with couples I used the following expression:
The expression returns positive value if there are exactly two people in the picture and if their genders are different.
The resulting dataset consisted of 5,783 selfies and 8,348 people (some pictures have more than one person). The data was collected on the 5th of April, 2018.