# The Chef's Choice: System for Allergen and Style Classification in Recipes
## 4 Data Acquisition
### Kaggle Dataset  
The Kaggle dataset is kept simple as only a few columns exist: \"id\", \"cuisine\", and \"ingredients\". A few example entries can be seen in Table 1. The \"id\" column will not be used as there is no valuable information for training a classifier. Upon further inspection, the \"ingredients\" column has already been preprocessed beforehand, as no cooking terms or measurement terms appear in the text.  
Analysing the class distribution (Figure 1) reveals that the \"Italian\" cuisine has more entries than all other classes, and the general distribution between classes with a low amount of samples and classes with a high sample count appears to be quite unbalanced. Furthermore, two other classes, \"Mexican\" and \"southern us\", also have quite a large amount of entries. The classes with the least entries are \"Brazilian\", \"Jamaican\", and \"Russian\". This distribution could hint at a class imbalance problem that might interfere with the classifier training later on. However, as the other classes are more balanced, the class imbalance could be a problem that does not need to be addressed. More importantly, the majority of classes show quite a low sample count, ranging from roughly 1000 to 3000. Depending on the classifier used, the amount of data might not be enough to train an accurate classifier.  
Looking at the top 40 words for the \"Brazilian\" cuisine in Figure 2 reinforces the assumption that the provided dataset has already been preprocessed, and numbers and other characters have already been filtered out. When comparing the top 40 ingredients between the \"Brazilian\" and the \"Chinese\" class (Figures 2 and 3), different ingredients as well as the ranking of ingredients differs. The assumption for the cuisine classification problem is that there are enough distinctions in the ingredient usage between different styles that the cuisine can be inferred from the ingredients of the recipe. The initial analysis of Figures 2 and 3 seems to confirm the initial hypothesis. The ingredient \"onion\" appears in both cuisines, but in the \"Brazilian\" cuisine class, the ingredient ranks third while it ranks twentieth in the other class. Other ingredients like \"line\" are not even in the top twenty ingredients of the other class.  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Id** & **Cuisine** & **Ingredients** \\ \hline
0 & Spanish & mussel, black pepper, garlic, safron thread, olive oil, stew tomato, arborio rice... \\
1 & Mexican & tomato, red onion, paprika, salt, corn tortilla, cilantro, cemini, broth, pepper... \\
2 & French & chicken broth, truffle, pimento, green pepper, olive, turkey, egg yolk,... \\
3 & Chinese & ginger, sesame oil, pea, cooked rice, bell pepper, peanut oil, egg, garlic,... \\ \hline \hline \end{tabular}
\end{table}
Table 1: Labelled Recipe Data Example.  
In addition to the differences in ingredient usage, both classes also have a high amount of ingredients that consist of more than one word like \"olive oil\". Instead of using single words to identify the relevancy to a certain cuisine class, a better option could be to create a sequence of words which is then used as a feature. Ingredients with more than two words are rarer compared to ingredients with single or double words, so the focus lies on the former combinations. Also important to note here is the difference in ingredient occurrence between the two classes. While \"garlic\" occurs around 180 times in the \"Brazilian\" class, the same ingredient appears over 1400 times in the \"Chinese\" cuisine class even though both are in the top five most used ingredients. This could be due to different ingredient diversity between classes or due to the fact that the \"Brazilian\" class has fewer samples than the \"Chinese\" class. Figure 1 seems to support the latter assumption.  
Figure 1: Class distribution for the Kaggle recipe train set.  
Figure 2: Top 20 ingredients for the Brazilian cuisine class.