# Boozy Brain

##### Artifical Intelligence enabled Cocktail Dispenser

Design Exploration 2018 | 4 months

Industrial Design, University of Technology Eindhoven, NL

Team: Haoyu Dong, Silvia Cazacu, Siebren de Vos

Mentor: Prof. Emilia Barakova

Skills: Designing with Algorithms, Machine Learning, Python, Arduino, Prototyping

Boozy Brain is an A.I. enabled cocktail dispenser that helps determine which cocktail recipe is likely to be positively received by the users. The project is based on the Naive Bayes Classification [1] algorithm and classifies the cocktail as either good or bad based on the data scraped from a popular cocktail recipe website [2]. This project is inspired by the works of Phillipe Remy and Yoni Levine.

####

Concept Overview

To determine whether a cocktail combination generated by the system to be considered likely to be positive or negative, we used the Sentiment Analysis approach. Sentiment analysis is the automated process of understanding an opinion about a given subject from written or spoken language [3].

###### Algorithm

The Boozy Brain uses a supervised learning algorithm based on the Naïve Bayes theorem. The data set for training and testing is scraped from a popular cocktail recipe website [2]; using the Beautiful soup library in python [4]. The extracted information including names of the cocktails, ingredients, rating value and rating count are stored into the file “recipes”.

Based on the dataset generated, the mean of the rating value can be calculated, which in our case is 3.37. Depending on whether the rating value of the recipe was higher or lower than the mean, the recipe was classified as positive or negative respectively. Each class was stored in one file.

Next, we used sentiment analysis to extract the positive and negative features from the two classes [3]. Take the positive class as the example: each recipe in the positive classed has been broken into words, which in our case are positive ingredients, to form the positive features [3]. Each word or ingredient has two frequency counts, one is the frequency among all the positive ingredients and the other one is the frequency it consists of a positive combination.

The probability of the combinations with specific ingredients to be positive could be derived based on the Naïve Bayes Theorem. The Naïve Bayes Theorem describes the probability of an event based on prior knowledge of conditions linked to that event’s occurrence [1].

Mathematically, it is stated as follows:

P(A | B) = ( P(B | A) * P(A) ) / P(B), where A and B are events and P(B) ≠ 0.

P(A | B) is a conditional probability: the likelihood of event A occurring given that B is true.

P(B | A) is also a conditional probability: the likelihood of event B occurring given that A is true.

P(A) and P(B) are the probabilities of observing A and B independently of each other; this is known as the marginal probability.

¾ of the features were used to train the Naive Bayes Classifier and ¼ of them were used to test the classifier and calculate the accuracy of the algorithm.

####

Implementation

After training and testing the algorithm, six chosen ingredients were input into the algorithm. Using the itertool module, possible combinations were generated. For the initial implementation, we limited the machine’s capability to mix 3 ingredients. After the user selects the desired cocktail combination, the trained algorithm determines the likelihood of this combination to be positively received by the user.

After seeing the likelihood of the combination on the screen, the user could decide to make the cocktail by confirming their choice on the interface. The base panel lights up indicating the drinks needed for the chosen combination and the user can fill their glass with the corresponding drinks.

####

Reflection

My vision in undertaking a project of this nature was in exploring the combination of Artificial Intelligence with Tangible products. With the rise in the application of AI for everyday use, the evolving paradigm of human technology interaction has piqued my interest. Mankind has distinguished itself from other living beings due to its intelligence. If intelligence is outsourced to machines, what is our role as humans? This project is an exploration in the direction of a harmonious and functional relationship between man and machine intelligence.

[1] Friedman, N., Geiger, D., & Goldszmidt, M. (1997). Bayesian network classifiers. Machine learning, 29(2- 3), 131-163.

[2] 1001 Cocktails. Retrieved December 08, 2018 from 1001cocktails.com

[3] Al-Amrani, Y., Lazaar, M., & Elkadiri, K. E. (2017, March). Sentiment Analysis using supervised classification algorithms. In Proceedings of the 2nd International Conference on Big Data, Cloud and Applications (p. 61). ACM.

[4] Beautiful Soup Library. Retrieved December 08, 2018 from https://www.crummy.com/software/BeautifulSoup/