You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ML-For-Beginners/4-Classification/1-Introduction/solution/notebook.ipynb

664 lines
277 KiB

{
"cells": [
{
"source": [
"# Delicious Asian and Indian Cuisines \n"
],
"cell_type": "markdown",
"metadata": {}
},
{
"source": [
"Install Imblearn which will enable SMOTE. This is a Scikit-learn package that helps handle imbalanced data when performing classification. (https://imbalanced-learn.org/stable/)"
],
3 years ago
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Requirement already satisfied: imblearn in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.0)\n",
"Requirement already satisfied: imbalanced-learn in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from imblearn) (0.8.0)\n",
3 years ago
"Requirement already satisfied: numpy>=1.13.3 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from imbalanced-learn->imblearn) (1.19.2)\n",
"Requirement already satisfied: scipy>=0.19.1 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from imbalanced-learn->imblearn) (1.4.1)\n",
"Requirement already satisfied: scikit-learn>=0.24 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from imbalanced-learn->imblearn) (0.24.2)\n",
"Requirement already satisfied: joblib>=0.11 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from imbalanced-learn->imblearn) (0.16.0)\n",
"Requirement already satisfied: threadpoolctl>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from scikit-learn>=0.24->imbalanced-learn->imblearn) (2.1.0)\n",
"\u001b[33mWARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.\n",
"You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -m pip install --upgrade pip' command.\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install imblearn"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib as mpl\n",
"import numpy as np\n",
"from imblearn.over_sampling import SMOTE"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('../../data/cuisines.csv')"
]
},
{
"source": [
"This dataset includes 385 columns indicating all kinds of ingredients in various cuisines from a given set of cuisines."
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" Unnamed: 0 cuisine almond angelica anise anise_seed apple \\\n",
"0 65 indian 0 0 0 0 0 \n",
"1 66 indian 1 0 0 0 0 \n",
"2 67 indian 0 0 0 0 0 \n",
"3 68 indian 0 0 0 0 0 \n",
"4 69 indian 0 0 0 0 0 \n",
"\n",
" apple_brandy apricot armagnac ... whiskey white_bread white_wine \\\n",
"0 0 0 0 ... 0 0 0 \n",
"1 0 0 0 ... 0 0 0 \n",
"2 0 0 0 ... 0 0 0 \n",
"3 0 0 0 ... 0 0 0 \n",
"4 0 0 0 ... 0 0 0 \n",
"\n",
" whole_grain_wheat_flour wine wood yam yeast yogurt zucchini \n",
"0 0 0 0 0 0 0 0 \n",
"1 0 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 1 0 \n",
"\n",
"[5 rows x 385 columns]"
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>Unnamed: 0</th>\n <th>cuisine</th>\n <th>almond</th>\n <th>angelica</th>\n <th>anise</th>\n <th>anise_seed</th>\n <th>apple</th>\n <th>apple_brandy</th>\n <th>apricot</th>\n <th>armagnac</th>\n <th>...</th>\n <th>whiskey</th>\n <th>white_bread</th>\n <th>white_wine</th>\n <th>whole_grain_wheat_flour</th>\n <th>wine</th>\n <th>wood</th>\n <th>yam</th>\n <th>yeast</th>\n <th>yogurt</th>\n <th>zucchini</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>65</td>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>1</th>\n <td>66</td>\n <td>indian</td>\n <td>1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2</th>\n <td>67</td>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>68</td>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>4</th>\n <td>69</td>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n<p>5 rows × 385 columns</p>\n</div>"
},
"metadata": {},
"execution_count": 4
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 2448 entries, 0 to 2447\nColumns: 385 entries, Unnamed: 0 to zucchini\ndtypes: int64(384), object(1)\nmemory usage: 7.2+ MB\n"
]
}
],
"source": [
"df.info()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"korean 799\n",
"indian 598\n",
"chinese 442\n",
"japanese 320\n",
"thai 289\n",
"Name: cuisine, dtype: int64"
]
},
"metadata": {},
"execution_count": 6
}
],
"source": [
"df.cuisine.value_counts()"
]
},
{
"source": [
"Show the cuisines in a bar graph"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f9d18799710>"
]
},
"metadata": {},
"execution_count": 7
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x288 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 401.435938 248.518125\" width=\"401.435938pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 248.518125 \nL 401.435938 248.518125 \nL 401.435938 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 59.435938 224.64 \nL 394.235938 224.64 \nL 394.235938 7.2 \nL 59.435938 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p1be3a3a042)\" d=\"M 59.435938 213.768 \nL 378.29308 213.768 \nL 378.29308 192.024 \nL 59.435938 192.024 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p1be3a3a042)\" d=\"M 59.435938 170.28 \nL 298.079957 170.28 \nL 298.079957 148.536 \nL 59.435938 148.536 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p1be3a3a042)\" d=\"M 59.435938 126.792 \nL 235.824995 126.792 \nL 235.824995 105.048 \nL 59.435938 105.048 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p1be3a3a042)\" d=\"M 59.435938 83.304 \nL 187.138423 83.304 \nL 187.138423 61.56 \nL 59.435938 61.56 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p1be3a3a042)\" d=\"M 59.435938 39.816 \nL 174.767244 39.816 \nL 174.767244 18.072 \nL 59.435938 18.072 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"m4bcc0da96b\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"59.435938\" xlink:href=\"#m4bcc0da96b\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 31.78125 74.21875 \nz\n\" id=\"DejaVuSans-48\"/>\n </defs>\n <g transform=\"translate(56.254688 239.238437)scale(0.1 -0.1)\">\n <use xlink:href=\"#DejaVuSans-48\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_2\">\n <g id=\"line2d_2\">\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"99.342964\" xlink:href=\"#m4bcc0da96b\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_2\">\n <!-- 100 -->\n <defs>\n <path d=\"M 12.40625 8.296875 \nL 28.515625 8.296875 \nL 28.515625 63.921875 \nL 10.984375 60.40625 \nL 10.984375 69.390625 \nL 28.421875 72.90625 \nL 38.28125 72.90625 \nL 38.28125 8.296875 \nL 54.390625 8.296875 \nL 54.390625 0 \nL 12.40625 0 \nz\n\" id=\"DejaVuSans-49\"/>\n </defs>\n <g transform=\"translate(89.799214 239.238437)scale(0.1 -0.1)\">\n <use xlink:href=\"#DejaVuSans-49\"/>\n <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\n <use x=\"127.246094\" xlink:href=\"#DejaVuSans-48\"/>\n </g>\n </g>\n </g>\n <g id=\"xtick_3\">\n <g id=\"line2d_3\">\n
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAD4CAYAAAAtrdtxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAASY0lEQVR4nO3df7TldV3v8eerGZkRRoeAiXtE5UgNIkUCjlwQIzAiC7NscdcSbcmsfkxl5SXX0juuyzK9d3UvlXnpplajma0kMtCUhluImNcr8msGBmb4pZaTQCFQOYom0fi+f+zPkd14hpnzOWefvYfzfKy113z35/vde7/22fvMa3++3733SVUhSVKPbxt3AEnSgcsSkSR1s0QkSd0sEUlSN0tEktRt+bgDLKYjjjiipqenxx1Dkg4oW7dufbiq1sy2bkmVyPT0NFu2bBl3DEk6oCT5u72tc3eWJKmbJSJJ6maJSJK6WSKSpG6WiCSpmyUiSepmiUiSulkikqRulogkqduS+sT69vt3Mb3xqnHH0ALZefG5444gLXnORCRJ3SwRSVI3S0SS1M0SkSR1s0QkSd0sEUlSN0tEktRtIkokyaFJXtuWz0yyeY6X/29Jzh5NOknS3kxEiQCHAq/tvXBVvbmqPraAeSRJ+2FSSuRi4DuTbAN+E1iV5Iokdye5NEkAkrw5yc1JdiTZNDT+viTnjTG/JC1Jk1IiG4G/qaoTgTcAJwEXAscDx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krotH3eAxbT9/l1Mb7xq3DEkaVHtvPjckV23MxFJUjdLRJLUzRKRJHWzRCRJ3SwRSVI3S0SS1M0SkSR1W9ASSTKdZMdCXqckaXJNxEwkyZL60KMkPVm
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"df.cuisine.value_counts().plot.barh()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"thai df: (289, 385)\njapanese df: (320, 385)\nchinese df: (442, 385)\nindian df: (598, 385)\nkorean df: (799, 385)\n"
]
}
],
"source": [
"\n",
"thai_df = df[(df.cuisine == \"thai\")]\n",
"japanese_df = df[(df.cuisine == \"japanese\")]\n",
"chinese_df = df[(df.cuisine == \"chinese\")]\n",
"indian_df = df[(df.cuisine == \"indian\")]\n",
"korean_df = df[(df.cuisine == \"korean\")]\n",
"\n",
"print(f'thai df: {thai_df.shape}')\n",
"print(f'japanese df: {japanese_df.shape}')\n",
"print(f'chinese df: {chinese_df.shape}')\n",
"print(f'indian df: {indian_df.shape}')\n",
"print(f'korean df: {korean_df.shape}')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What are the top ingredients by class"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
3 years ago
"def create_ingredient_df(df):\n",
" # transpose df, drop cuisine and unnamed rows, sum the row to get total for ingredient and add value header to new df\n",
" ingredient_df = df.T.drop(['cuisine','Unnamed: 0']).sum(axis=1).to_frame('value')\n",
" # drop ingredients that have a 0 sum\n",
" ingredient_df = ingredient_df[(ingredient_df.T != 0).any()]\n",
" # sort df\n",
" ingredient_df = ingredient_df.sort_values(by='value', ascending=False, inplace=False)\n",
" return ingredient_df\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f9d5917db00>"
]
},
"metadata": {},
"execution_count": 10
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x288 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 422.776562 248.518125\" width=\"422.776562pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 248.518125 \nL 422.776562 248.518125 \nL 422.776562 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 80.776563 224.64 \nL 415.576563 224.64 \nL 415.576563 7.2 \nL 80.776563 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 219.204 \nL 399.633705 219.204 \nL 399.633705 208.332 \nL 80.776563 208.332 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 197.46 \nL 362.771608 197.46 \nL 362.771608 186.588 \nL 80.776563 186.588 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 175.716 \nL 331.438825 175.716 \nL 331.438825 164.844 \nL 80.776563 164.844 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 153.972 \nL 303.792252 153.972 \nL 303.792252 143.1 \nL 80.776563 143.1 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 132.228 \nL 290.890518 132.228 \nL 290.890518 121.356 \nL 80.776563 121.356 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 110.484 \nL 285.361203 110.484 \nL 285.361203 99.612 \nL 80.776563 99.612 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 88.74 \nL 276.145679 88.74 \nL 276.145679 77.868 \nL 80.776563 77.868 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 66.996 \nL 274.302574 66.996 \nL 274.302574 56.124 \nL 80.776563 56.124 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 45.252 \nL 268.773259 45.252 \nL 268.773259 34.38 \nL 80.776563 34.38 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#pe0c3fae6cb)\" d=\"M 80.776563 23.508 \nL 259.557735 23.508 \nL 259.557735 12.636 \nL 80.776563 12.636 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"m33607e4c56\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"80.776563\" xlink:href=\"#m33607e4c56\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 31.78125 74.21875 \nz\n\" id=\"DejaVuSans-48\"/>\n </defs>\n <g transform=\"translate(77.595
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaYAAAD4CAYAAACngkIwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAeAklEQVR4nO3de7RVdb338fcHRFAhTPBCeNnogzckQJcdb11ES01QSxGLUtNHjl1EM2twhmbUo+PY5dhN07DHII+nuKSPFKe0FPEasTcCG1TUEk8QCmjuJIRg+33+WL+ti82+AWvvORfr8xpjjT3Xb/7mnN85x2J/+M0595qKCMzMzPKiW9YFmJmZlXIwmZlZrjiYzMwsVxxMZmaWKw4mMzPLlV2yLmBn0L9//6ipqcm6DDOzitG/f3/uv//++yPi9ObzHExlUFNTQ21tbdZlmJlVFEn9W2r3qTwzM8sVB5OZmeWKg8nMzHLF15jMzLrApk2bWLFiBRs2bMi6lC7Xq1cv9t9/f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4RtIHJB0LnAsMA84ASh/+NBm4IiKOAa4BfhQRTwCzgC9HxPCI+BNwT0QcGxHDgGeAS0vWUZO2eSZwu6RezWq9FngoIt4HnEwx8PZoZb8+D0REDAU+AUxtYX1tiojJEVGIiEL33ftuy6JmZtaGNm8Xj4inJO0j6T3A3sDfgKHARyg+Fh2gN8Wg6gPcFxEbgA2SfgUgqTdwAsVHoTetumcrmzxK0g3Anmm995fMmx4RbwHPS/ozcHizZT8CnNU0SgN6AQdSDLjmTgJ+mPbxWUkvAYe2dSz
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"thai_ingredient_df = create_ingredient_df(thai_df)\r\n",
"thai_ingredient_df.head(10).plot.barh()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f9d389634a8>"
]
},
"metadata": {},
"execution_count": 11
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x288 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 422.776562 248.518125\" width=\"422.776562pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 248.518125 \nL 422.776562 248.518125 \nL 422.776562 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 80.776563 224.64 \nL 415.576563 224.64 \nL 415.576563 7.2 \nL 80.776563 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 219.204 \nL 399.633705 219.204 \nL 399.633705 208.332 \nL 80.776563 208.332 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 197.46 \nL 329.555212 197.46 \nL 329.555212 186.588 \nL 80.776563 186.588 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 175.716 \nL 287.508117 175.716 \nL 287.508117 164.844 \nL 80.776563 164.844 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 153.972 \nL 276.996343 153.972 \nL 276.996343 143.1 \nL 80.776563 143.1 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 132.228 \nL 236.701209 132.228 \nL 236.701209 121.356 \nL 80.776563 121.356 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 110.484 \nL 234.949247 110.484 \nL 234.949247 99.612 \nL 80.776563 99.612 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 88.74 \nL 229.69336 88.74 \nL 229.69336 77.868 \nL 80.776563 77.868 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 66.996 \nL 224.437473 66.996 \nL 224.437473 56.124 \nL 80.776563 56.124 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 45.252 \nL 205.165887 45.252 \nL 205.165887 34.38 \nL 80.776563 34.38 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p34667a1d0a)\" d=\"M 80.776563 23.508 \nL 192.902151 23.508 \nL 192.902151 12.636 \nL 80.776563 12.636 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"ma2c21c9e07\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"80.776563\" xlink:href=\"#ma2c21c9e07\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 31.78125 74.21875 \nz\n\" id=\"DejaVuSans-48\"/>\n </defs>\n <g transform=\"translate(77.59531
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaYAAAD4CAY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gbIXLMTOzLlBNDz+YmVkNcDCZmVmhOJjMzKxQHExmZlYoDiYzMysUB5OZmRWKg8nMzArFwWRmZoVSVb9gW1RNK5qpmzIr7zKsB1l2zYl5l2CWG/eYzMysUHpcMEmqk7Q4TX9C0q/T9CmSpuRbnZmZbU7NXMqLiHuAe/Kuw8zMOla4HpOkbSXNkrRQ0mJJEyQdJOnx1PaUpAGpZ/SopHnp69DN7HeSpBvSdJ2kByUtkjRb0h6pfaqk69NnvSDpjO44ZjMz+4ci9piOA16OiBMBJA0E5gMT0mCB2wFvA68BR0fEOknDgNuATcb1aMf3yYbNmCbpPOB64LS0bAhwODCcrIc1s60dSJoMTAbovd3gLT9KMzNrU+F6TGQj0x4t6VpJR5CNpbQyIuYCRMQbEfEu0Af4kaQmYAZw4BZ8xiHAz9P0T8mCqMUvI+K9iHgG+HB7O4iIhoioj4j63tsM3IKPNjOzjhSuxxQRSyWNA04ArgYebGfVr5ANsT6aLGDXVaiEd8qmVaF9mplZJxWuxyRpV2BtRPwMuA74KDBE0kFp+QBJWwEDyXpS7wHnAL234GMeB85O0xOBRytVv5mZfTCF6zEBo4DrJL0HrAe+RNZz+b6kD5HdXzoK+AFwh6TPA/cCb23BZ1wE3CLpa8Aq4AsVrN/MzD4ARUTeNVS9vkOGxZBz/yPvMqwH8ZsfrBZIaoyITR5aK2KPqeqMGjqQkv8hMTOriMLdYzIzs9rmYDIzs0JxMJmZWaE4mMzMrFAcTGZmVigOJjMzKxQHk5m
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"japanese_ingredient_df = create_ingredient_df(japanese_df)\r\n",
"japanese_ingredient_df.head(10).plot.barh()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f9d18817f98>"
]
},
"metadata": {},
"execution_count": 12
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x288 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 422.776562 248.518125\" width=\"422.776562pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 248.518125 \nL 422.776562 248.518125 \nL 422.776562 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 80.776563 224.64 \nL 415.576563 224.64 \nL 415.576563 7.2 \nL 80.776563 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 219.204 \nL 399.633705 219.204 \nL 399.633705 208.332 \nL 80.776563 208.332 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 197.46 \nL 329.12734 197.46 \nL 329.12734 186.588 \nL 80.776563 186.588 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 175.716 \nL 327.022673 175.716 \nL 327.022673 164.844 \nL 80.776563 164.844 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 153.972 \nL 304.923663 153.972 \nL 304.923663 143.1 \nL 80.776563 143.1 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 132.228 \nL 264.934978 132.228 \nL 264.934978 121.356 \nL 80.776563 121.356 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 110.484 \nL 255.463974 110.484 \nL 255.463974 99.612 \nL 80.776563 99.612 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 88.74 \nL 253.359306 88.74 \nL 253.359306 77.868 \nL 80.776563 77.868 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 66.996 \nL 213.370622 66.996 \nL 213.370622 56.124 \nL 80.776563 56.124 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 45.252 \nL 204.951951 45.252 \nL 204.951951 34.38 \nL 80.776563 34.38 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p44e792b113)\" d=\"M 80.776563 23.508 \nL 202.847284 23.508 \nL 202.847284 12.636 \nL 80.776563 12.636 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"ma3185ec0d8\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"80.776563\" xlink:href=\"#ma3185ec0d8\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 31.78125 74.21875 \nz\n\" id=\"DejaVuSans-48\"/>\n </defs>\n <g transform=\"translate(77.59531
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaYAAAD4CAYAAACngkIwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAfeElEQVR4nO3deZwV1Z338c8XbCEKYlSMiEurISECsl1NULO5xD2aCYgT4hLzkkcn4pgEnyGPJoMTM+OSbTRGJRmFUUcF1GjCqHGUuBL1NggNKmgiPmGJ4tZiEILwmz/qtN603U033O5bl/6+X69+dd1Tp079Thfxl3Oqbh1FBGZmZnnRrdIBmJmZlXJiMjOzXHFiMjOzXHFiMjOzXHFiMjOzXNmm0gFsDXbZZZeora2tdBhmZlWlrq7u1Yjo27TciakMamtrKRaLlQ7DzKyqSHqpuXJP5ZmZWa44MZmZWa44MZmZWa74HpOZWSdYv349y5YtY+3atZUOpdP17NmTPfbYg5qamjbVd2Iqg/rlDdROmlXpMKyDLb30uEqHYFVs2bJl9O7dm9raWiRVOpxOExG89tprLFu2jH322adNx3gqz8ysE6xdu5add965SyU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PA3UNhdIREyJiEJEFLpv16csnTMzsyobMUXEEkkjgGOBSyQ9ULpf0j7ARODAiHhD0lSgZ0mVv7ThNOtKtjdQZX8jM7NqV1UjJkm7A2si4ibgCmAEsBronarsQJZ8GiR9BDimuXYiYjWwTNJJqd0e5Xqyz8zMtky1jQaGAFdI2gisB84BRgH
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"chinese_ingredient_df = create_ingredient_df(chinese_df)\r\n",
"chinese_ingredient_df.head(10).plot.barh()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f9d1880a550>"
]
},
"metadata": {},
"execution_count": 13
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x288 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 422.776562 248.518125\" width=\"422.776562pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 248.518125 \nL 422.776562 248.518125 \nL 422.776562 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 80.776563 224.64 \nL 415.576563 224.64 \nL 415.576563 7.2 \nL 80.776563 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 219.204 \nL 399.633705 219.204 \nL 399.633705 208.332 \nL 80.776563 208.332 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 197.46 \nL 349.287841 197.46 \nL 349.287841 186.588 \nL 80.776563 186.588 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 175.716 \nL 343.988276 175.716 \nL 343.988276 164.844 \nL 80.776563 164.844 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 153.972 \nL 333.389147 153.972 \nL 333.389147 143.1 \nL 80.776563 143.1 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 132.228 \nL 331.622625 132.228 \nL 331.622625 121.356 \nL 80.776563 121.356 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 110.484 \nL 324.556539 110.484 \nL 324.556539 99.612 \nL 80.776563 99.612 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 88.74 \nL 301.591758 88.74 \nL 301.591758 77.868 \nL 80.776563 77.868 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 66.996 \nL 300.708498 66.996 \nL 300.708498 56.124 \nL 80.776563 56.124 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 45.252 \nL 244.179807 45.252 \nL 244.179807 34.38 \nL 80.776563 34.38 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#p9c50223dce)\" d=\"M 80.776563 23.508 \nL 232.697417 23.508 \nL 232.697417 12.636 \nL 80.776563 12.636 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"m8ead303ccb\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"80.776563\" xlink:href=\"#m8ead303ccb\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 31.78125 74.21875 \nz\n\" id=\"DejaVuSans-48\"/>\n </defs>\n <g transform=\"translate(77.595
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAaYAAAD4CAYAAACngkIwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6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CzStbPAtYCQ4HDgVHAGEnHSjoMOBMYCXwEKJ38aQpwSUSMAS4HfhwRvwdmA1dExKiI+CNwZ0QcFhEjgaXABSVt1KRjngLcIKlvs1ivBO6PiMOBD5IlvJ1aOa+LgYiIEcD/BW5pob02SZqYEmVd4xsN7e9gZmYd0ubj4hExX9Lukv4PMBD4GzACOAmYn6pVkyWqfsCsiNhANr35rwAkVQNHATPS9OUAfVo55MGSrgF2Tu3eU7JtekS8BTwn6QVgWLN9TwI+1jRKA/oCe5MluOaOIZuinYj4g6QXgf3b6ovmImIKWcKlz6ChxZ0G2MyswnTk75hmAGOB95KNoPYB/isiflpaSdJlrezfC3g1IkZ14FhTgTMiYoGk84DjSrY1/+XffF3AmRGxrAPHMTOzgurIww/TgLPJktMMslHM+WkkhKTBknYHHgNOS/dvqoFTASLi78BySeNSfUkamdp+jWyk1aQfsFpSFXBOszjGSeolaT9gX6B5AroHuERpWCbp0DbO6ZGm9iXtTzayckIzMyuAdhNTRCwhSxirImJ1RNwL/C/wuKRFwEygX0TMJbtntBD4DbAIaLr5cg5wgaQFwBKg6cGEO4Ar0gMI+wFfBZ4kS3J/aBbKn4CnUtsXpUuGpb4OVAELJS1J6635MdArxT8NOC8
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"indian_ingredient_df = create_ingredient_df(indian_df)\r\n",
"indian_ingredient_df.head(10).plot.barh()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f9d1896ce80>"
]
},
"metadata": {},
"execution_count": 14
},
{
"output_type": "display_data",
"data": {
"text/plain": "<Figure size 432x288 with 1 Axes>",
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<!-- Created with matplotlib (https://matplotlib.org/) -->\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 466.64375 248.518125\" width=\"466.64375pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <defs>\n <style type=\"text/css\">\n*{stroke-linecap:butt;stroke-linejoin:round;white-space:pre;}\n </style>\n </defs>\n <g id=\"figure_1\">\n <g id=\"patch_1\">\n <path d=\"M 0 248.518125 \nL 466.64375 248.518125 \nL 466.64375 0 \nL 0 0 \nz\n\" style=\"fill:none;\"/>\n </g>\n <g id=\"axes_1\">\n <g id=\"patch_2\">\n <path d=\"M 124.64375 224.64 \nL 459.44375 224.64 \nL 459.44375 7.2 \nL 124.64375 7.2 \nz\n\" style=\"fill:#ffffff;\"/>\n </g>\n <g id=\"patch_3\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 219.204 \nL 443.500893 219.204 \nL 443.500893 208.332 \nL 124.64375 208.332 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_4\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 197.46 \nL 407.697019 197.46 \nL 407.697019 186.588 \nL 124.64375 186.588 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_5\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 175.716 \nL 403.64375 175.716 \nL 403.64375 164.844 \nL 124.64375 164.844 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_6\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 153.972 \nL 390.808399 153.972 \nL 390.808399 143.1 \nL 124.64375 143.1 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_7\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 132.228 \nL 358.382249 132.228 \nL 358.382249 121.356 \nL 124.64375 121.356 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_8\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 110.484 \nL 318.525106 110.484 \nL 318.525106 99.612 \nL 124.64375 99.612 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_9\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 88.74 \nL 310.418568 88.74 \nL 310.418568 77.868 \nL 124.64375 77.868 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_10\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 66.996 \nL 290.152225 66.996 \nL 290.152225 56.124 \nL 124.64375 56.124 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_11\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 45.252 \nL 284.072321 45.252 \nL 284.072321 34.38 \nL 124.64375 34.38 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"patch_12\">\n <path clip-path=\"url(#pb424dddb00)\" d=\"M 124.64375 23.508 \nL 277.316873 23.508 \nL 277.316873 12.636 \nL 124.64375 12.636 \nz\n\" style=\"fill:#1f77b4;\"/>\n </g>\n <g id=\"matplotlib.axis_1\">\n <g id=\"xtick_1\">\n <g id=\"line2d_1\">\n <defs>\n <path d=\"M 0 0 \nL 0 3.5 \n\" id=\"m1dd0ffa143\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n </defs>\n <g>\n <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"124.64375\" xlink:href=\"#m1dd0ffa143\" y=\"224.64\"/>\n </g>\n </g>\n <g id=\"text_1\">\n <!-- 0 -->\n <defs>\n <path d=\"M 31.78125 66.40625 \nQ 24.171875 66.40625 20.328125 58.90625 \nQ 16.5 51.421875 16.5 36.375 \nQ 16.5 21.390625 20.328125 13.890625 \nQ 24.171875 6.390625 31.78125 6.390625 \nQ 39.453125 6.390625 43.28125 13.890625 \nQ 47.125 21.390625 47.125 36.375 \nQ 47.125 51.421875 43.28125 58.90625 \nQ 39.453125 66.40625 31.78125 66.40625 \nz\nM 31.78125 74.21875 \nQ 44.046875 74.21875 50.515625 64.515625 \nQ 56.984375 54.828125 56.984375 36.375 \nQ 56.984375 17.96875 50.515625 8.265625 \nQ 44.046875 -1.421875 31.78125 -1.421875 \nQ 19.53125 -1.421875 13.0625 8.265625 \nQ 6.59375 17.96875 6.59375 36.375 \nQ 6.59375 54.828125 13.0625 64.515625 \nQ 19.53125 74.21875 31.78125 74.21875 \nz\n\" id=\"DejaVuSans-48\"/>\n </defs>\n <g transform=\"translate(121.4625 239.2
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAdIAAAD4CAYAAABYIGfSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3de5xXVb3/8dcbHCEFp1SyCbQho0hAQAYTNPV4KfOSdhTpRF7SXxz9HbFOWnHSftFJfz/NfuZdo1JILQXKS3KCTPBOyowIwyWsRI8gKd5GkSCEz/ljr5Ev48www56ZLzPf9/PxmMfs79prr/XZCx58WGvv796KCMzMzGz7dCt2AGZmZp2ZE6mZmVkOTqRmZmY5OJGamZnl4ERqZmaWw07FDsA61p577hmVlZXFDsPMrFOpqal5JSL6NLbPibTEVFZWUl1dXewwzMw6FUnPN7XPS7tmZmY5OJGamZnl4ERqZmaWg6+RmpnZe2zcuJGVK1eyfv36YofSoXr27Em/fv0oKytr8TFOpCWmdlUdlRNnFjsM68Keu+y4YodgbWDlypX07t2byspKJBU7nA4REbz66qusXLmS/v37t/g4L+2amdl7rF+/nj322KNkkiiAJPbYY49Wz8KdSDuYpJMk7deCelMkndJI+eGS7muf6MzMtiilJFpve87ZibTjnQRsM5GamVnn4GukDUi6DHghIq5PnycBawEBpwI9gLsi4ntp/3eBLwNrgBeAmoj4ka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Z1vSV20OblB8dUTcUox4zMysbXW6RBoRtUBTd/jucCJiW99/NTOzTsxLu2ZmZjk4kZq
},
"metadata": {
"needs_background": "light"
}
}
],
"source": [
"korean_ingredient_df = create_ingredient_df(korean_df)\r\n",
"korean_ingredient_df.head(10).plot.barh()"
]
},
{
"source": [
"Drop very common ingredients (common to all cuisines)"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" almond angelica anise anise_seed apple apple_brandy apricot \\\n",
"0 0 0 0 0 0 0 0 \n",
"1 1 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 0 0 \n",
"\n",
" armagnac artemisia artichoke ... whiskey white_bread white_wine \\\n",
"0 0 0 0 ... 0 0 0 \n",
"1 0 0 0 ... 0 0 0 \n",
"2 0 0 0 ... 0 0 0 \n",
"3 0 0 0 ... 0 0 0 \n",
"4 0 0 0 ... 0 0 0 \n",
"\n",
" whole_grain_wheat_flour wine wood yam yeast yogurt zucchini \n",
"0 0 0 0 0 0 0 0 \n",
"1 0 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 1 0 \n",
"\n",
"[5 rows x 380 columns]"
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>almond</th>\n <th>angelica</th>\n <th>anise</th>\n <th>anise_seed</th>\n <th>apple</th>\n <th>apple_brandy</th>\n <th>apricot</th>\n <th>armagnac</th>\n <th>artemisia</th>\n <th>artichoke</th>\n <th>...</th>\n <th>whiskey</th>\n <th>white_bread</th>\n <th>white_wine</th>\n <th>whole_grain_wheat_flour</th>\n <th>wine</th>\n <th>wood</th>\n <th>yam</th>\n <th>yeast</th>\n <th>yogurt</th>\n <th>zucchini</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>4</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n<p>5 rows × 380 columns</p>\n</div>"
},
"metadata": {},
"execution_count": 15
}
],
"source": [
"feature_df= df.drop(['cuisine','Unnamed: 0','rice','garlic','ginger'], axis=1)\n",
"labels_df = df.cuisine #.unique()\n",
"feature_df.head()\n"
]
},
{
"source": [
3 years ago
"Balance data with SMOTE oversampling to the highest class. Read more here: https://imbalanced-learn.org/dev/references/generated/imblearn.over_sampling.SMOTE.html"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"oversample = SMOTE()\n",
"transformed_feature_df, transformed_label_df = oversample.fit_resample(feature_df, labels_df)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"new label count: korean 799\nchinese 799\njapanese 799\nindian 799\nthai 799\nName: cuisine, dtype: int64\nold label count: korean 799\nindian 598\nchinese 442\njapanese 320\nthai 289\nName: cuisine, dtype: int64\n"
]
}
],
"source": [
"print(f'new label count: {transformed_label_df.value_counts()}')\r\n",
"print(f'old label count: {df.cuisine.value_counts()}')"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" almond angelica anise anise_seed apple apple_brandy apricot \\\n",
"0 0 0 0 0 0 0 0 \n",
"1 1 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 0 0 \n",
"\n",
" armagnac artemisia artichoke ... whiskey white_bread white_wine \\\n",
"0 0 0 0 ... 0 0 0 \n",
"1 0 0 0 ... 0 0 0 \n",
"2 0 0 0 ... 0 0 0 \n",
"3 0 0 0 ... 0 0 0 \n",
"4 0 0 0 ... 0 0 0 \n",
"\n",
" whole_grain_wheat_flour wine wood yam yeast yogurt zucchini \n",
"0 0 0 0 0 0 0 0 \n",
"1 0 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 1 0 \n",
"\n",
"[5 rows x 380 columns]"
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>almond</th>\n <th>angelica</th>\n <th>anise</th>\n <th>anise_seed</th>\n <th>apple</th>\n <th>apple_brandy</th>\n <th>apricot</th>\n <th>armagnac</th>\n <th>artemisia</th>\n <th>artichoke</th>\n <th>...</th>\n <th>whiskey</th>\n <th>white_bread</th>\n <th>white_wine</th>\n <th>whole_grain_wheat_flour</th>\n <th>wine</th>\n <th>wood</th>\n <th>yam</th>\n <th>yeast</th>\n <th>yogurt</th>\n <th>zucchini</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>4</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n<p>5 rows × 380 columns</p>\n</div>"
},
"metadata": {},
"execution_count": 18
}
],
"source": [
"transformed_feature_df.head()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" cuisine almond angelica anise anise_seed apple apple_brandy \\\n",
"0 indian 0 0 0 0 0 0 \n",
"1 indian 1 0 0 0 0 0 \n",
"2 indian 0 0 0 0 0 0 \n",
"3 indian 0 0 0 0 0 0 \n",
"4 indian 0 0 0 0 0 0 \n",
"... ... ... ... ... ... ... ... \n",
"3990 thai 0 0 0 0 0 0 \n",
"3991 thai 0 0 0 0 0 0 \n",
"3992 thai 0 0 0 0 0 0 \n",
"3993 thai 0 0 0 0 0 0 \n",
"3994 thai 0 0 0 0 0 0 \n",
"\n",
" apricot armagnac artemisia ... whiskey white_bread white_wine \\\n",
"0 0 0 0 ... 0 0 0 \n",
"1 0 0 0 ... 0 0 0 \n",
"2 0 0 0 ... 0 0 0 \n",
"3 0 0 0 ... 0 0 0 \n",
"4 0 0 0 ... 0 0 0 \n",
"... ... ... ... ... ... ... ... \n",
"3990 0 0 0 ... 0 0 0 \n",
3 years ago
"3991 0 0 0 ... 0 0 0 \n",
"3992 0 0 0 ... 0 0 0 \n",
"3993 0 0 0 ... 0 0 0 \n",
"3994 0 0 0 ... 0 0 0 \n",
"\n",
" whole_grain_wheat_flour wine wood yam yeast yogurt zucchini \n",
"0 0 0 0 0 0 0 0 \n",
"1 0 0 0 0 0 0 0 \n",
"2 0 0 0 0 0 0 0 \n",
"3 0 0 0 0 0 0 0 \n",
"4 0 0 0 0 0 1 0 \n",
"... ... ... ... ... ... ... ... \n",
"3990 0 0 0 0 0 0 0 \n",
"3991 0 0 0 0 0 0 0 \n",
"3992 0 0 0 0 0 0 0 \n",
"3993 0 0 0 0 0 0 0 \n",
"3994 0 0 0 0 0 0 0 \n",
"\n",
"[3995 rows x 381 columns]"
],
3 years ago
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>cuisine</th>\n <th>almond</th>\n <th>angelica</th>\n <th>anise</th>\n <th>anise_seed</th>\n <th>apple</th>\n <th>apple_brandy</th>\n <th>apricot</th>\n <th>armagnac</th>\n <th>artemisia</th>\n <th>...</th>\n <th>whiskey</th>\n <th>white_bread</th>\n <th>white_wine</th>\n <th>whole_grain_wheat_flour</th>\n <th>wine</th>\n <th>wood</th>\n <th>yam</th>\n <th>yeast</th>\n <th>yogurt</th>\n <th>zucchini</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>1</th>\n <td>indian</td>\n <td>1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2</th>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>4</th>\n <td>indian</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n <td>0</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>3990</th>\n <td>thai</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>...</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3991</th>\n <td>thai</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\
},
"metadata": {},
"execution_count": 19
}
],
"source": [
"# export transformed data to new df for classification\n",
"transformed_df = pd.concat([transformed_label_df,transformed_feature_df],axis=1, join='outer')\n",
"transformed_df"
]
3 years ago
},
{
"cell_type": "code",
"execution_count": 20,
3 years ago
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 3995 entries, 0 to 3994\nColumns: 381 entries, cuisine to zucchini\ndtypes: int64(380), object(1)\nmemory usage: 11.6+ MB\n"
]
}
],
"source": [
"transformed_df.info()"
]
},
{
"source": [
"Save the file for future use"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 21,
3 years ago
"metadata": {},
"outputs": [],
"source": [
"transformed_df.to_csv(\"../../data/cleaned_cuisine.csv\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3.7.0 64-bit ('3.7')"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
},
"metadata": {
"interpreter": {
"hash": "70b38d7a306a849643e446cd70466270a13445e5987dfa1344ef2b127438fa4d"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}