background-shape
feature-image

One of the most intrinsic emotions we experience is that of comedy or humor. Comedy is often a medium for us to escape real life and take a few moments to enjoy. At the same time, humor has also been a topic of discussion amongst philosophers for a really long time, with various theories of humor existing, ranging from Relief to Superiority. In this blog post, I hope to discuss the concept of humor from an AI perspective.

What count as Funny?

Humor is certainly something subjective and therefore it is difficult to define something as objectively funny. However there have been various theories that have tried to explain what constitutes as funny. The theory that I would like to discuss today is the one known as “The Incongruity Theory”, which rose around the 18th century and was the approach taken by many philosophers like ames Beattie, Immanuel Kant, Arthur Schopenhauer etc.

The Incongruity Theory explains humor as something that violates our mental patterns and expectations. Our brain can be compared to a complex machine which recognizes patterns and makes assumptions based on the information provided to it. Expectations are assumptions we make given the situation or information this is available to us. When we are presented with a fact that violates this, we find it funny.

Figure 1. Comic strip where the final window violates our assumption thus making it funny. Source: PBFComic.

Modern day stand up comedian also rely on the incongruity theory for their sets. A generally accepted template for jokes is “setup-punchline” format, where initially there’s a set up for the joke and then the punchline which justifies and rewards the setup. Here the set up is the establishing of the scene and the punchline often acts as the incongruity.

Setup, Punchline and AI

It isn’t hard to train a network to generate text with jokes as the corpora it is trained on. However the problem in such a scenario is that we are only finding sequences of words and the context of the joke is lost. We need an attention model to identify the correlation between phrases that occur in different parts of the joke. In a “setup-punchline” model, there is a certain association between the setup and punchline, which often are on the two different ends of the joke, thus long term relationships must be preserved.

In the github repository Deep Humor by Aditya Choudhary et al. they discuss a rather interesting pattern when it comes to short jokes. In the project they implement two networks, one for jokes generation and another for classification of jokes and non-jokes, through transformer architecture. In Figure 2, a noticeable trend that emerges in the joke sentences. A noticeable X pattern is evident in joke sentences, due to the setup-punchline format discussed before.

Figure 2. Attention Analysis on Joke and Non-Joke Sentences. Source: Deep Humor, Aditya et al.

Visual Humor

Not everything that we find amusing is in the setup-punchline format. Often humor needn’t be a clever joke but rather the action performed. We all watched Mr. Bean, Tom and Jerry or Charlie Chaplin at some point of our lives, and even though there are barely any dialogues, it still cracks us up. Visual Cues are often just as or more important than the conversation between characters, but defining these are even more difficult than short jokes.

On the topic of Visual Humor, a paper that I would like to mention is We Are Humor Beings: Understanding and Predicting Visual Humor by Chandrasekaran et al. In the paper, the author discusses a Machine Learning approach for classifying funny and unfunny images. The images have been generated through a clip art program with users creating scenes using the given options for human characters, animals, outdoor and indoor objects etc.

Figure 3. Images and their associated funniness score. Source: Chandrasekaran et al.

The objective of the experiment was to firstly classify the image as funny or unfunny, and then increase or decrease the funniness of the image. This is done by removing the obscurity or incongruity from the image and replacing it with something that’s realistic. The model was able to classify the images as funny and unfunny with great accuracy and the author describes that decreasing the funniness of an image was successful as around 95% of the audience rated the altered image as less funny compared to the real one. Making the image more funny however wasn’t as successful, but the approach certainly seems promising.

Conclusion

Humor is one of those human quality that we ourselves struggle to understand, and moreover it is something very subjective. While the discussed approaches can help explain and recreate some of things that amuses us, we are still leaving out a big chunk. For instance, humorous caption generation given a picture, memes etc. Further, computational humor in itself is a vastly unexplored topic and hopefully one day, this will give us a better understanding on why we laugh.

Reference