bayes_project/naive_bayes.ipynb

315 lines
350 KiB
Plaintext
Raw Normal View History

2021-05-31 20:53:39 +02:00
{
"cells": [
{
"cell_type": "code",
2021-05-31 21:00:36 +02:00
"execution_count": 1,
2021-05-31 20:53:39 +02:00
"id": "relevant-beverage",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd \n",
"import numpy as np\n",
"from sklearn.model_selection import train_test_split\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# Wizualizacja\n",
"def autolabel(rects, values ,ax):\n",
" # Attach some text labels.\n",
" for (rect, value) in zip(rects, values):\n",
" ax.text(rect.get_x() + rect.get_width() / 2.,\n",
" rect.get_y() + rect.get_height() / 2.,\n",
" '%.3f'%value,\n",
" ha = 'center',\n",
" va = 'center',\n",
" fontsize= 15,\n",
" color ='black') \n",
"def plot_priori(labels, posteriori, name): \n",
" keys =[ r\"$\\bf{\" + (x.split('.',1)[0]).replace('_', ' ')+ \"}$\" + '\\n' + x.split('.',1)[1] for i in range(1) for j in range(len(labels[i])) for x in labels[i][j].keys()]\n",
" aprori = [list(x) for i in range(1) for j in range(len(labels[i])) for x in labels[i][j].values()]\n",
" yes_aprori = np.array(aprori)[:,0]\n",
" no_aprori = np.array(aprori)[:,1]\n",
" \n",
" width = 0.55\n",
"\n",
" fig = plt.figure(figsize=(25,10))\n",
" \n",
" ax1 = fig.add_subplot(121)\n",
" rec1 = ax1.bar(keys,yes_aprori,width, color ='lime', label= 'Positive stroke')\n",
" rec2 = ax1.bar(keys,no_aprori,width, color ='crimson', bottom = yes_aprori, label= 'Negative stroke')\n",
" ax1.set_yticks(np.arange(0, 1.1,0.1))\n",
" ax1.set_ylabel('Probability',fontsize=18)\n",
" ax1.set_xlabel('\\nFeatures',fontsize=18)\n",
" ax1.tick_params(axis='x', which='major', labelsize=12)\n",
" autolabel(rec1,yes_aprori, ax1)\n",
" autolabel(rec2,no_aprori, ax1)\n",
" ax1.legend(fontsize=15)\n",
" \n",
" ax2 = fig.add_subplot(122)\n",
" rec3 = ax2.bar(0, posteriori[1],capsize=1 ,color=['crimson'], label='Negative stroke')\n",
" rec4 = ax2.bar(1, posteriori[0], color=['lime'],label='Positive stroke')\n",
" ax2.set_ylabel('Probability',fontsize=18)\n",
" ax2.set_xlabel('\\nClasses',fontsize=18)\n",
" ax2.set_xticks([0,1])\n",
" ax2.set_yticks(np.arange(0, 1.1,0.1))\n",
" ax2.tick_params(axis='x', which='major', labelsize=15)\n",
" autolabel(rec3,[posteriori[1]], ax2)\n",
" autolabel(rec4,[posteriori[0]], ax2)\n",
" ax2.legend(fontsize=15)\n",
" \n",
"# plt.show()\n",
" plt.savefig(name + \".png\", dpi=100)\n",
"\n",
"\n",
"# Wczytanie i normalizacja danych\n",
"def NormalizeData(data):\n",
" for col in data.columns:\n",
" if data[col].dtype == object: \n",
" data[col] = data[col].str.lower()\n",
" if col == 'smoking_status':\n",
" data[col] = data[col].str.replace(\" \", \"_\")\n",
" if col == 'stroke':\n",
" data[col] = data[col].replace({1: 'yes'})\n",
" data[col] = data[col].replace({0: 'no'})\n",
" if col == 'hypertension':\n",
" data[col] = data[col].replace({1: 'yes'})\n",
" data[col] = data[col].replace({0: 'no'})\n",
" if col == 'heart_disease':\n",
" data[col] = data[col].replace({1: 'yes'})\n",
" data[col] = data[col].replace({0: 'no'})\n",
" if col == 'bmi':\n",
" bins = [19,25,30,35,40,90]\n",
" labels=['correct','overweight','obesity_1','obesity_2','extreme']\n",
" data[col] = pd.cut(data[col], bins, labels = labels,include_lowest = True)\n",
" if col == 'age':\n",
" bins = [0, 30, 40, 50, 60, 70, 80, 90]\n",
" labels = ['0-29', '30-39', '40-49', '50-59', '60-69', '70-79', '80-89',]\n",
" data[col] = pd.cut(data[col], bins, labels = labels,include_lowest = True)\n",
" if col == 'avg_glucose_level':\n",
" bins = [50,90,130,170,210,250,290]\n",
" labels = ['50-90', '90-130','130-170','170-210','210-250','250-290']\n",
" data[col] = pd.cut(data[col], bins, labels = labels,include_lowest = True)\n",
" data = data.dropna()\n",
" return data\n",
"\n",
"def count_a_priori_prob(dataset):\n",
" is_stroke_amount = len(dataset[dataset.stroke == 'yes'])\n",
" no_stroke_amount = len(dataset[dataset.stroke == 'no'])\n",
" data_length = len(dataset.stroke)\n",
" return {'yes': float(is_stroke_amount)/float(data_length), 'no': float(no_stroke_amount)/float(data_length)}\n",
"\n",
"def separate_labels_from_properties(X_train):\n",
"\n",
" labels = X_train.columns\n",
" labels_values = {}\n",
" for label in labels:\n",
" labels_values[label] = set(X_train[label])\n",
" \n",
" to_return = []\n",
" for x in labels:\n",
" to_return.append({x: labels_values[x]})\n",
"\n",
" return to_return\n",
"\n",
"data = pd.read_csv(\"healthcare-dataset-stroke-data.csv\")\n",
"data = NormalizeData(data)\n",
"\n",
"\n",
"# Rozdzielenie etykiet i cech\n",
"data = data[['gender', 'age', 'bmi','smoking_status','hypertension','heart_disease','avg_glucose_level','stroke']]\n",
"data = data[data.gender != 'other']\n",
"\n",
"\n",
"# Dane wejściowe - zbiór danych, wektor etykiet, wektor prawdopodobieństw a priori dla klas.\n",
"# Wygenerowanie wektora prawdopodobieństw a priori dla klas.\n",
"a_priori_prob = count_a_priori_prob(data)\n",
"labels = separate_labels_from_properties(data.iloc[:,:-1])\n",
"\n",
"class NaiveBayes():\n",
" def __init__(self, dataset, a_priori_prob):\n",
" self.dataset = dataset\n",
" self.a_priori_prob = a_priori_prob\n",
" self.a_priori_features = {}\n",
" \n",
" def fit(self):\n",
" # init dict\n",
" for feature in list(set(data.iloc[:,:-1])):\n",
" self.a_priori_features[feature] = {}\n",
" \n",
" \n",
" for feature in list(set(data.iloc[:,:-1])):\n",
" for feature_value in np.unique(self.dataset[feature]):\n",
" # Oblicz ilość występowania danej cechy w zbiorze danych np. heart_disease.yes\n",
"\n",
" amount_label_value_yes_class = len(self.dataset.loc[(self.dataset['stroke'] == 'yes') & (self.dataset[feature] == feature_value)])\n",
" amount_label_value_no_class = len(self.dataset.loc[(self.dataset['stroke'] == 'no') & (self.dataset[feature] == feature_value)])\n",
" amount_yes_class = len(self.dataset.loc[(self.dataset['stroke'] == 'yes')])\n",
" amount_no_class = len(self.dataset.loc[(self.dataset['stroke'] == 'no')]) \n",
" # Obliczenie P(heart_disease.yes|'stroke'|), P(heart_disease.yes|'no stroke') itd. dla kazdej cechy.\n",
" # Zapisujemy do listy w formacie (cecha.wartość: prob stroke, cecha.wartość: prob no stroke)\n",
" self.a_priori_features[feature][feature_value + '.' + 'yes'] = amount_label_value_yes_class/amount_yes_class\n",
" self.a_priori_features[feature][feature_value + '.' + 'no'] = amount_label_value_no_class/amount_no_class\n",
" \n",
" def count_bayes(self,labels):\n",
" label_probs_return = []\n",
" posteriori_return = []\n",
" final_probs = {'top_yes': 0.0, 'top_no': 0.0, 'total': 0.0}\n",
" \n",
" # self.labels - Wartości etykiet które nas interesują, opcjonalnie podane sa wszystkie.\n",
" # [{'gender': {'female', 'male', 'other'}}, {'age': {'50-59', '40-49', '60-69', '70+', '18-29', '30-39'}}, {'ever_married': {'no', 'yes'}}, {'Residence_type': {'rural', 'urban'}}, {'bmi': {'high', 'mid', 'low'}}, {'smoking_status': {'unknown', 'smokes', 'never_smoked', 'formerly_smoked'}}, {'work_type': {'self_employed', 'private', 'never_worked', 'govt_job'}}, {'hypertension': {'no', 'yes'}}, {'heart_disease': {'no', 'yes'}}]\n",
" # Dla kazdej z klas - 'yes', 'no'\n",
" for idx, cls in enumerate(list(set(self.dataset['stroke']))):\n",
" label_probs = []\n",
" for label in labels:\n",
" label_name = list(label.keys())[0]\n",
" for label_value in label[label_name]:\n",
" # Oblicz ilość występowania danej cechy w zbiorze danych np. heart_disease.yes\n",
" label_probs.append({str(label_name + \".\" + label_value):(self.a_priori_features[label_name][label_value + '.' + 'yes'], self.a_priori_features[label_name][label_value + '.' + 'no'])})\n",
"\n",
" label_probs_return.append(label_probs)\n",
" # Obliczanie licznika wzoru Bayesa (mnozymy wartosci prob cech z prawdop apriori danej klasy):\n",
" top = 1\n",
" for label_prob in label_probs:\n",
" top *= list(label_prob.values())[0][idx]\n",
" top *= self.a_priori_prob[cls]\n",
"\n",
" final_probs[cls] = top\n",
" final_probs['total'] += top\n",
" \n",
" posteriori_return.append(final_probs['yes']/final_probs['total'])\n",
" posteriori_return.append(final_probs['no']/final_probs['total'])\n",
" return posteriori_return, label_probs_return\n",
"\n",
"labels = [{'age': {'70-79'}},{'hypertension': {'yes'}},{'heart_disease': {'yes'}},{'bmi': {'correct'}},{'gender': {'male'}},{'smoking_status': {'smokes'}}]\n",
"naive_bayes = NaiveBayes(data, a_priori_prob)\n",
"naive_bayes.fit()"
]
},
{
"cell_type": "code",
2021-05-31 21:00:36 +02:00
"execution_count": 2,
2021-05-31 20:53:39 +02:00
"id": "conscious-character",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACkV0lEQVR4nOzdd3yX1f3//8fJIAMIMsKQIQiICxdIrUWlgBUEUesA/dXZiv0U6ce9lVFHFWod1Srtl6LVVnBUseBsnS0W8KOt4kBAZThAUUCSQMb5/ZGQZkIIGe/A495bbsl1rnOd9+t6F26ePDnvc4UYI5IkSZIkSZIkJYqkxi5AkiRJkiRJkqSyDK4lSZIkSZIkSQnF4FqSJEmSJEmSlFAMriVJkiRJkiRJCcXgWpIkSZIkSZKUUAyuJUmSJEmSJEkJxeBakiRJUp0IIUwPIawOIbxTzfkQQrgzhLAkhPCfEMIhDV2jJEmSmgaDa0mSJEl1ZQYwbCvnhwO9S77GAr9tgJokSZLUBBlcS5IkSaoTMcZXgLVb6XI88EAs9jqwWwihU8NUJ0mSpKYkpbELqGvt2rWL3bt3b+wyJEmSVMfeeOONL2OM2Y1dh3ZIZ2BFmeOVJW2fVewYQhhL8apsmjdv3m/vvf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zk0GDBrFw4cJy18yePZt+/frRvHlzWrduzXe+8x1efvnl0vNltwoZNGgQb7zxBvfff3/pFiUzZswAym+lMWPGDJo1a1ZpNcaiRYsIIfDCCy+Utj355JP079+f9PR0OnbsyOWXX05+fv5W7/O1117jiCOOICsri6ysLA466CAeeeSR0jq++uorJk2aVFrjltXXIQRuu+02LrzwQrKzs+nbt2+N36eKVq1axd57783QoUPJyckB4NVXX+Woo44iMzOTtm3bct5557Fhw4atjiNJkiSVFULgmmuuYfbs2bz99ttb7bt8+XLGjBlDmzZtyMzM5JhjjuGDDz6o1Gf48OFkZGTQo0cPZsyYUWnbkffff58xY8bQtWtXMjMz2W+//bj99tspKioC4KWXXuK4444DoEePHoQQ6N69O1B5K40ePXpw2WWXVar1lFNOYeDAgaXHa9euZezYsXTo0IH09HQOP/xw/vWvf231fvPz87n00kvp1q0baWlp7L777px44ols3ryZGTNmMH78+NL3MIRQeo8TJ06kXbt2vPbaaxx66KGkp6eX/v4wa9Ys+vbtS1paGl27duWaa66hoKBgq3VMmTKF9PR0Zs+eDUBeXh6XX345Xbt2JS0tjQMPPJC5c+dudYwdYXAtSZKanC2BdceOHQE44YQTePbZZ5k6dSozZ86kqKiI73//+yxZsgSApUuXcvLJJzN48GCeeuopHnroIUaOHMnatWurHP+ee+5h77335thjjy3domTEiBGV+p1wwgmEEPjLX/5Srn3mzJl06NCB73//+0DxJPGHP/whAwYMYPbs2UyYMIFp06Zx1VVXVXuP69evZ+TIkey555489thjPProo5xxxhmlIflf/vIXWrVqxY9//OPSGg855JDS66dMmcJnn33GH//4R+68884avU9Vvc9HHnkkPXv25K9//SuZmZn84x//YOjQoXTs2JFHH32U22+/nblz53LOOedUey+SJElSVU455RR69+7NjTfeWG2ftWvXMnDgQD744APuvfdeZs2axcaNGxk6dCi5ublA8criUaNG8d577zF9+nRuu+027rzzzkoB8apVq+jTpw/33HMPc+fO5bzzzmPChAnccsstABxyyCFMnToVgMcff5x58+ZVmutvceqpp5aGwlt8++23zJk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sft2bMnLVq04PTTT+fJJ5+stB3JtlQM5mvyPm3xwQc
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACbzUlEQVR4nOzdeZyVZd348c81+wzMsG8OIIiI62MKohkusYQs7gtk5VZipfQzU3NLwTITydLUkHqUfKxErRQF11KTxBDTckdARFEUEdlmYZbr98eZmWZjGIZh5gx83s/rvJj7uq/7Ot/7SI/f+Xqd7x1ijEiSJEmSJEmSlCxSWjsASZIkSZIkSZKqs3AtSZIkSZIkSUoqFq4lSZIkSZIkSUnFwrUkSZIkSZIkKalYuJYkSZIkSZIkJRUL15IkSZIkSZKkpNJqhesQwp0hhE9CCK9t4XwIIdwSQlgSQvhPCOHglo5RkiRJUuOZ40uSJKm5tOaO61nAMQ2cHwMMrHhNAn7dAjFJkiRJarpZmONLkiSpGbRa4TrG+HfgswamHA/cHRNeADqGEHq1THSSJEmStpU5viRJkppLWmsH0IB84P1qxx9UjH1Ue2IIYRKJHRu0a9du8N57790iAUqSJKnlvPTSS5/GGLu1dhzaLub4kiRJqtJQjp/MhetGizHOBGYCDBkyJC5atKiVI5IkSVJzCyG819oxqOWY40uSJO38GsrxW7PH9dasBPpUO+5dMSZJkiSpbTLHlyRJUqMkc+F6DnBGxZPHDwPWxRjrfIVQkiRJUpthji9JkqRGabVWISGEPwJHA11DCB8A1wDpADHGGcA8YCywBCgAzm6dSCVJkiQ1hjm+JEmSmkurFa5jjF/dyvkInN9C4UiSJEnaTub4kiRJai7J3CpEkiRJkiRJkrQLsnAtSZIkSZIkSUoqrdYqRJIktYz169fzySefUFJS0tqhSFuUnp5O9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4sSJdO7cmZycHEaPHs3bb79dZ86YMWPIzs6mf//+zJo1q07bkbfeeouJEyfSp08fcnJy2G+//fjlL39JeXk5AM888wzHHnssAP379yeEQL9+/YC6rTT69+/PJZdcUifWU089lWHDhlUdf/bZZ0yaNIkePXqQlZXF4Ycfzj//+c8G77ekpISLL76Yvn37kpmZyW677caJJ57I5s2bmTVrFpMnT676DEMIVfc4ZcoUunbtyvz58znkkEPIysqq+v3hvvvu44ADDiAzM5M+ffpw5ZVXUlpa2mAcN954I1lZWcyZMweAoqIiLr30Uvr06UNmZiYHHngg8+bNa3CN7WHhWpIktTmVBeuePXsCcMIJJ/D4448zffp0Zs+eTXl5OV/+8pdZsmQJAEuXLuWUU05h+PDhPPzww/z+979n/PjxfPbZZ/Wuf/vtt7P33nszduzYqhYl48aNqzPvhBNOIITAX/7ylxrjs2fPpkePHnz5y18GEkniSSedxNChQ5kzZw7XXHMNM2fO5PLLL9/iPa5fv57x48ezxx578Kc//YkHHniAb3zjG1VF8r/85S906NCBb37zm1UxHnzwwVXX33jjjXz00Uf83//9H7fcckujPqf6PucjjzySAQMG8Mgjj5CTk8M//vEPRo4cSc+ePXnggQf45S9/ybx58zj77LO3eC+SJElSfU499VQGDhzIddddt8U5n332GcOGDePtt99mxowZ3HfffWzatImRI0dSWFgIJHYWH3fccbz55pvceeed3HTTTdxyyy11CsQrV65k0KBB3H777cybN49zzz2Xa665hhtuuAGAgw8+mOnTpwPw5z//mQULFtTJ9SuddtppVUXhShs3bmTu3LlMnDgRgOLiYkaOHMlTTz3FjTfeyIMPPki3bt0YOXIkq1at2uI9X3/99fz+97/nxz/+MU8++SS//OUv6dChA2VlZYwbN44f/OAHAFW/B9x+++1V1xYUFHDmmWfyrW99i8cee4yhQ4fyxBNPMGHCBA4++GAeeughJk+ezPTp07ngggu2GMO1117LNddcw5w5czjuuOOARP/xWbNmccUVV/Dwww9zyCGHcNxxx/HKK69scZ3tYasQSZLUJlTuBli2bBnf/e53yc3NZeTIkTz22GP84x//4JlnnuGoo44CYPjw4fTr148bb7yRO+64g5dffpnc3FxuvPHGqvXGjh27xffad999adeuHd26dWuwhUjHjh055phjmD17do3C7ezZsznllFNITU0lxsgll1zCGWecUSOhzMzM5Pzzz+fyyy+nS5cuddZevHgx69at49ZbbyU3NxeAr3zlK1XnDzroINLS0ujdu3e9Mfbq1YvZs2dXHTfmc6puyZIlDB8+nEMOOYQ//vGPZGRkAHDZZZdx+OGH11g7Pz+fESNG8Nprr7H//vtv8fOSJEmSqktJSeHyyy/nm9/8Jtdeey177bVXnTm/+MUv2LRpE6+88gqdO3cG4Etf+hL9+vXjzjvv5Pzzz2fevHn8+9//ZuHChRxyyCEADB06lH79+jFgwICqtUaMGMGIESOARLF72LBhFBQU8Jvf/IbLL7+cvLw8Bg0aBCTy7crd1vWZOHEi06ZN44UXXqjKxx9++GE2b95c1c7wnnvu4bXXXuP1119n4MCBAIwcOZJBgwbx85//vMbvJ9UtXLiQ008/nTPPPLNq7LTTTgMgOzu7Kq76fg8oLCzkpptu4vjjj68aO/PMMzn66KP53e9+B8AxxxwDwOWXX85VV11F7969a6xxxRVX8Ktf/YpHH3206neHv/71r8ydO7fG7xNf+cpXWLx4Mdddd12dIn5zcMe1JElKemvWrCE9PZ309HQGDRrEsmXLmD17Nr169WLhwoV07969KnkCaNeuHePHj2f+/PkAHHDAAaxbt44zzzyTJ554olkf6jhhwgT++te/smbNGgBeeeUVFi9ezIQJE4BEAXrFihWcdtpplJaWVr2GDx9OUVERr732Wr3rDhgwgPb
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACm0UlEQVR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uehMBdd91Vfjxt2jQef/zxav169+7NpZde2qiv3VA333wzL774YqOOmUz3J0mSJEmSVJMluYc2y1dDbMq2jjrqqGrnTj75ZIYOHbqV70bDvf/++0yePJlvvvmmUvuMGTMIIbB+/frmKayC+fPnM3ny5EYdM5nubxOD6xaqXbt2zJs3j3nz5jF16lTefPNNhg8fzoYNGxrtNebNm8cpp5xSflxbcP2nP/2JH//4x432ultjWwTXkiRJkiRJanzPPvssCxYsaO4yKnn//fe57rrrqgXXo0aNYt68eWRnZzdPYRXMnz+f6667rrnL2ObSmrsANUxaWhoHH3wwAAcffDC9evXi0EMPZe7cuZXC5q2xafzN2X///Rvl9ZpSfn6+T+CVJEmSJElqJh06dKB79+5cf/31NS6UTDa5ubnk5uY2dxlbJMZIYWEhmZmZzV1Kg7jiejsxcOBAAD766CMAvvzyS8aPH0/Hjh3Jzs5m6NChLFy4sNI1s2fPZuDAgbRu3Zr27dtz0EEH8dJLL5Wfr7hVyNChQ3n99df5/e9/X75FyYwZM4DKW2nMmDGDVq1aVfut1DvvvEMIgeeff7687YknnmDQoEFkZmbStWtXLr/8coqKiuq8z1dffZVDDz2UnJwccnJy2G+//Xj44YfL6/jqq6+47rrrymvctPo6hMCtt97KhRdeSG5uLvvss0+936eqVqxYwe67786IESPIy8sD4JVXXuHwww8nOzubjh07cu6557Ju3bo6x5EkSZIkSdpRhRC46qqrmD17Nm+99VadfZctW8a4cePo0KED2dnZHHXUUSxatKhan6OPPpqsrCz69OnDjBkzqm078u9//5tx48bRs2dPsrOz2WuvvbjtttsoLS0F4MUXX+TYY48FoE+fPoQQ6N27N1B9K40+ffpw2WWXVav1lFNOYciQIeXHq1evZsKECXTp0oXMzEwOOeQQ/vGPf9R5v0VFRVx66aX06tWLjIwMdt55Z0444QQ2btzIjBkzmDhxYvl7GEIov8fJkyfTqVMnXn31VQ488EAyMzPLc7NZs2axzz77kJGRQc+ePbnqqqsoLi6us45bbrmFzMxMZs+eDUBBQQGXX345PXv2JCMjg29961vMnTu3zjG2hsH1dmJTYN21a1cAjj/+eJ555hmmTp3KzJkzKS0t5bvf/S6LFy8GYMmSJZx88skMGzaMJ598kgcffJDRo0ezevXqGse/55572H333TnmmGPKtygZNWpUtX7HH388IQT+9Kc/VWqfOXMmXbp04bvf/S6Q+Mty4oknMnjwYGbPns2kSZOYNm0aV155Za33uHbtWkaPHk3fvn159NFHeeSRRzjjjDPKQ/I//elPtGvXju9///vlNR5wwAHl199yyy2sXLmS//3f/+WOO+6o1/tU0/t82GGH0a9fP5566imys7P529/+xogRI+jatSuPPPIIt912G3PnzuXss8+u9V4kSZIkSZJ2dKeccgr9+/fn+uuvr7XP6tWrGTJkCIsWLeLee+9l1qxZbNiwgREjRpCfnw8kVhaPGTOG9957j+nTp3Prrbdyxx13VAuIV6xYwYABA7jnnnuYO3cu5557LpMmTeKmm24C4IADDmDq1KkAPPbYY8ybN69axrXJqaeeWh4Kb7J+/XrmzJnDuHHjACgsLGTEiBE8//zz3HLLLTz++OPk5uYyYsQIPvvss1rv+cYbb+TBBx/kZz/7Gc899xy33XYb7dq1o6SkhFGjRnHJJZcAlOdf99xzT/m1eXl5jB8/nh/84Ac8/fTTDB48mGeffZaxY8dywAEH8MQTTzBx4kSmTp3KBRdcUGsNU6ZMYdKkScyePZsxY8YAif3HZ8yYwU9/+lOefPJJDjzwQMaMGcObb75Z6zhbw61CWrBNvxVZunQpP/rRj2jbti0jRozg6aef5m9/+xsvvvgihx9+OADDhg2jd+/e3HLLLdx333288cYbtG3blltuuaV8vGOOOabW19pzzz1p3bo1ubm5dW4hstNOOzFy5EhmzpxZKbidOXMmJ598MqmpqcQYueyyyzjzzDMr/cXKyMjg/PPP58orr6Rjx47Vxn7//fdZs2YNd911F23btgXgyCOPLD+///77k5aWRo8ePWqssVu3bsycObP8uD7vU0WLFy9m2LBhHHjggfzxj3+kVatWAFxxxRUccsghlcbu3r07w4cP5+2332bvvfeu9f2SJEmSJEnaUaWkpHDllVfy/e9/nylTprDbbrtV6/OrX/2KDRs28Oabb9KhQwcAvvOd79C7d2+mT5/O+eefz9y5c/nnP//J/PnzOfDAAwEYPHgwvXv3pl+/fuVjDR8+nOHDhwOJsHvIkCHk5eXxm9/8hiuvvJKcnBwGDBgAJHKmTautazJu3DhuvvlmXnvttfIc6sknn2Tjxo3l2/g+8MADvP3227zzzjv0798fgBEjRjBgwAB++ctfVsrlKpo/fz6nn34648ePL2879dRTAcjKyiqvq6b8Kz8/n1tvvZXjjjuuvG38+PEMHTqU3//+9wCMHDkSgCuvvJKrr76aHj16VBrjpz/9KXfeeSd//vOfyzOzv/zlL8yZM6dSjnbkkUfy/vvvc/3111cL8RuDK65bqK+++or09HTS09MZMGAAS5cuZebMmXTr1o358+fTuXPn8j9EAK1bt2b06NG8+uqrAOyzzz6sWbOG8ePH8+yzzzbqQx3Hjh3LX/7yF7766isA3nzzTd5//33Gjh0LJALoZcuWceqpp1JcXFz+NWzYMAoKCnj77bdrHLdfv360adOG008/nSeeeKLadiSbUzWYr8/7tMmiRYs
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACtHklEQVR4nOzdd5hV1d2//3tNYQow1KFIEQTEhg0kJqISwAiC2AX9xZqIPlHy2LuCJGoixFiiUcyXoI8mgiWKAWtiTTCAiYliQUBEsKEoIMzAlPX74wyTqTAMU87A/co118xee+11PvuIZs2bddYOMUYkSZIkSZIkSUoWKY1dgCRJkiRJkiRJZRlcS5IkSZIkSZKSisG1JEmSJEmSJCmpGFxLkiRJkiRJkpKKwbUkSZIkSZIkKakYXEuSJEmSJEmSkorBtSRJkqQ6EUKYFkL4IoTwdjXn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5unMLKmDdvHjfccENjl1Hv0hq7AEmSpK1JS0vj4IMPBuDggw+me/fuHHroocyZM6dc2Lw9No+/NQcccECdvF5DysvL88nzkiRJSipt27alS5cu3HjjjVUuGEk2ubm55ObmNnYZ2yTGyMaNG8nMzGzsUmrFFdeSJKnJ6d+/PwDLli0D4Msvv+SMM86gXbt2ZGdnM3jwYBYsWFDumlmzZtG/f3+aN29OmzZt+M53vsPLL79cer7sViGDBw/mjTfe4P777y/domT69OlA+a00pk+fTrNmzSqtxli4cCEhBF544YXStieffJIBAwaQmZlJp06duPzyyykoKNjifb722msceuih5OTkkJOTw/77788jjzxSWsdXX33FDTfcUFrj5tXXIQRuvfVWLrzwQnJzc+nXr1+N36eKVq5cyR577MGwYcPYsGEDAK+++iqHH3442dnZtGvXjnPOOYd169ZtcRxJkiSprBAC11xzDbNmzeKtt97aYt/ly5czduxY2rZtS3Z2NkceeSTvv/9+pT4jRowgKyuLnj17Mn369Erbjrz33nuMHTuWbt26kZ2dzd57781tt91GcXExAC+99BJHH300AD179iSEQI8ePYDKW2n07NmTyy67rFKtJ510EoMGDSo9Xr16NePGjaNjx45kZmbyve99j3/84x9bvN+CggIuvfRSunfvTkZGBrvssgvHHXccmzZtYvr06YwfP770PQwhlN7jxIkTad++Pa+99hoHHXQQmZmZpb8/zJw5k379+pGRkUG3bt245pprKCws3GIdkydPJjMzk1mzZgGQn5/P5ZdfTrdu3cjIyGC//fZjzpw5WxxjexhcS5KkJmdzYN2pUycAjj32WJ599lmmTJnCjBkzKC4u5vvf/z6LFy8GYMmSJZx44okMGTKEp556ioceeohRo0axevXqKse/++672WOPPTjqqKNKtygZOXJkpX7HHnssIQT+9Kc/lWufMWMGHTt25Pvf/z6QmCQef/zxDBw4kFmzZjFhwgSmTp3KVVddVe09rl27llGjRrHbbrvx2GOP8eijj3LaaaeVhuR/+tOfaNWqFT/60Y9KazzwwANLr588eTKffvop//d//8cdd9xRo/epqvf5sMMOo1evXvz5z38mOzubv/3tbwwbNoxO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Tz9d+rvDX/7yF2bPnl3u94kf/OAHLFq0iBtvvLFSiF8XXHEtSZKS3ldffUV6ejrp6en07duXpUuXMmPGDDp37sy8efPo0KFD6eQJoHnz5owaNYrXXnsNgH79+rFmzRrOOOMMnnvuuTp9qOOYMWP4y1/+wldffQXAm2++yaJFixgzZgyQCKCXL1/OySefTGFhYenXkCFDyM/P5+23365y3F69etGiRQtOPfVUnnzyyUrbkWxNxWC+Ju/TZu+
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAJ/CAYAAACQpkQPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACw70lEQVR4nOzdeXxV1b3//9fKnEASpjDIIIiIojiBaC0qBVQQirOg3+vYiv1V6HWu1gGkVVul1rnW3ktpr7biVEXBobaOLRawtXUEARXFARRlSgIZ1u+PhNOMEEJITvD1vI/zMHvttdf57POg3JU366wdYoxIkiRJkiRJkpQsUlq6AEmSJEmSJEmSqjK4liRJkiRJkiQlFYNrSZIkSZIkSVJSMbiWJEmSJEmSJCUVg2tJkiRJkiRJUlJJa+kCmlqnTp1i7969W7oMSZIkNbFXX3318xhjQUvXoebnHF+SJGnntKU5/k4XXPfu3ZuFCxe2dBmSJElqYiGED1q6BrUM5/iSJEk7py3N8d0qRJIkSZIkSZKUVAyuJUmSJEmSJElJxeBakiRJkiRJkpRUDK4lSZIkSZIkSUnF4FqSJEmSJEmSlFQMriVJkiRJkiRJSSWtpQuQJEk71tq1a1m5ciUlJSUtXYpUr/T0dDp37kxeXl5LlyJJkpT0nOOrNdjeOb7BtSRJO7G1a9fy2Wef0b17d7KzswkhtHRJUi0xRoqKilixYgWA4bUkSdIWOMdXa9AUc3y3CpEkaSe2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lUafPn249NJLa9V68sknM3To0MTx6tWrmThxIl26dCErK4tDDz2Uv//971u835KSEi655BJ69epFZmYmu+yyC8cffzybNm1i5syZTJ48OfEZhhAS9zh16lQ6derEyy+/zEEHHURWVlbi94cHHniAgQMHkpmZSc+ePbnyyispLS3dYh033XQTWVlZzJ49G4Di4mIuu+wyevbsSWZmJvvttx9z587d4hjbw+BakiS1OpsD665duwJw3HHH8fTTTzN9+nRmzZpFeXk53/rWt1iyZAkAS5cu5aSTTmL48OE8/vjj3HfffYwdO5bVq1fXOf5dd93FnnvuyTHHHJPYomTMmDG1+h133HGEEPjjH/9YrX3WrFl06dKFb33rW0DFJPGEE05gyJAhzJ49mylTpnDPPfdwxRVX1HuPa9euZezYsey22248/PDDPPTQQ5x++umJkPyPf/wj+fn5fOc730nUeOCBByauv+mmm/jkk0/4v//7P2677bYGfU51fc6HH344ffv25YknniAnJ4e//vWvjBw5kq5du/LQQw9xyy23MHfuXM4+++x670WSJEmqy8knn0y/fv247rrr6u2zevVqhg4dyqJFi7j77rt54IEH2LBhAyNHjqSoqAioWFk8btw43n77bWbMmMHNN9/MbbfdVisgXrFiBf379+euu+5i7ty5nHvuuUyZMoWf/exnABx44IFMnz4dgEceeYR58+bVmutvdsoppyRC4c3Wr1/PnDlzmDBhAgAbN25k5MiRPPvss9x00008+uijFBQUMHLkSD799NN67/mGG27gvvvu48c//jF/+tOfuOWWW8jPz6esrIwxY8Zw8cUXAyR+D7jrrrsS1xYWFnLmmWfy3e9+l6eeeoohQ4bwzDPPMH78eA488EAee+wxJk+ezPTp05k0aVK9NUybNo0pU6Ywe/Zsxo0bB1TsPz5z5kx+9KMf8fjjj3PQQQcxbtw4XnvttXrH2R5uFSJJklqFzasBli1bxve//31yc3MZOXIkTz31FH/96195/vnnOeKIIwAYPnw4vXv35qabbuJXv/oV//znP8nNzeWmm25KjHfMMcfU+14DBgygTZs2FBQUbHELkXbt2jFq1ChmzZpVLbidNWsWJ510EqmpqcQYufTSSznjjDOqTSgzMzM5//zzueKKK+jYsWOtsRcvXsyaNWu44447yM3NBeCoo45KnD/ggANIS0ujR48eddbYrVs3Zs2alThuyOdU1ZIlSxg+fDgHHXQQf/jDH8jIyADg8ssv59BDD602dvfu3RkxYgRvvPEG++yzT72flyRJklRVSkoKV1xxBd/5zneYNm0ae+yxR60+v/jFL9iwYQOvvfYaHTp0AOCb3/wmvXv3ZsaMGZx//vnMnTuXf/3rX8yfP5+DDjoIgCFDhtC7d2/69u2bGGvEiBGMGDECqAi7hw4dSmFhIb/+9a+54ooryMvLo3///kDFfHvzauu6TJgwgRtvvJFXXnklMR9//PHH2bRpU2I7w3vvvZc33niDN998k379+gEwcuRI+vfvz89//vNqv59UNX/+fE477TTOPPPMRNspp5wCQHZ2dqKuun4PKCoq4uabb+bYY49NtJ155pkMGzaM3/72twCMGjUKgCuuuIKrrrqKHj16VBvjRz/6EbfffjtPPvlk4neHP//5z8yZM6fa7xNHHXUUixcv5rrrrqsV4jcFV1xLkqSk98UXX5Cenk56ejr9+/dn2bJlzJo1i27dujF//nw6d+6cmDwBtGnThrFjx/Lyyy8DMHDgQNasWcOZZ57JM88806QPdRw/fjx//vOf+eKLLwB47bXXWLx4MePHjwcqAujly5dzyimnUFpamngNHz6c4uJi3njjjTrH7du3L23btuW0007jscceq7UdydbUDOYb8jlttmjRIg4//HCGDh3KrFmzEqF1YWEh8+bNq3UvQ4cOJT09nVdffXWbapQkSZL+67/+i169enHDDTfUef7ZZ5/lyCOPJC8vLzH/zM3NZdCgQYlt7xYsWEDXrl0ToTVULK7YvMXgZsXFxUyZMoXdd9+dzMxM0tPTufLKK3nvvfe2um1GTQcccAB77LFHtQUds2bN4ogjjqBLly6J2gcNGkSfPn0StQMcccQRW9yyb//992fmzJnceOON/Pvf/ybG2OC6QgiMHj06cVxWVsY//vGPWs8GGj9+POXl5cybN69a+0U
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {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3/yGiooKAJ555hm+8Y1vANCvXz9CCPTt2xeou5RGv379uOiii+rUetJJJzFs2LCq7ZUrVzJ+/Hi6detGTk4OBx54IP/6178aPN/S0lIuvPBC+vTpQ3Z2NjvuuCPHHXccGzduZNq0aUyYMKHqPQwhVJ3jxIkT6dKlC88//zz77bcfOTk5VdfQe+65h0GDBpGdnU3v3r257LLLKCsra7COG264gZycHGbMmAFASUkJF198Mb179yY7O5u9996bWbNmNTiGJElqPINrSZLU5mwKrLt37w7Asccey+OPP87kyZOZPn06FRUVfO1rX+O9994DYMGCBZx44okMHz6chx9+mL/85S8cddRRrFy5st7xb7vtNnbbbTeOPPLIqiVKxowZU6ffscceSwiBBx54oEb79OnT6datG1/72teAREBy/PHHM3ToUGbMmMFVV13F1KlTufTSSzd7jmvWrOGoo45i55135v777+e+++7j1FNPrQrJH3jgAQoLC/nOd75TVeO+++5bdfwNN9zAxx9/zJ///GduvvnmRr1P9b3PhxxyCP379+eRRx4hLy+PF154gZEjR9K9e3fuu+8+fvOb3zBr1izOPPPMzZ6LpMY56aSTGDBgANddd91m+6xcuZJhw4bxzjvvMGXKFO655x7Wr1/PyJEjKS4uBhJ3Fh999NG89dZb3HHHHdx4443cfPPNdQLipUuXMnDgQG677TZmzZrF2WefzVVXXcX1118PwL777svkyZMB+Pvf/87s2bPrXO82Ofnkk6tC4U3WrVvHzJkzGTduHAAbNmxg5MiRPPXUU9xwww08+OCDdO3alZEjR7Js2bLNnvMvfvEL/vKXv3Dttdfy5JNP8pvf/IbCwkLKy8sZM2YMP/7xjwGqroW33XZb1bFFRUWcfvrpfPe73+Wxxx5j6NChPPHEE4wdO5Z9992Xhx56iAkTJjB58mTOO++8zdZwzTXXcNVVVzFjxgyOPvpoILH++LRp0/jpT3/Kww8/zH777cfRRx/NK6+8stlxJElS47lUiCRJahM23Qm3cOFCfvCDH5Cfn8/IkSN57LHHeOGFF3jmmWc49NBDARg+fDh9+/blhhtu4Pbbb+c///kP+fn53HDDDVXjHXnkkZt9rT322IN27drRtWvXBpcQ6dChA4cffjjTp0+vEdxOnz6dE088kfT0dGKMXHTRRZx22mk1wpTs7GzOPfdcLr30Ujp37lxn7Pnz57N69WpuueUW8vPzAfj6179etX+fffYhIyODXr161Vtjjx49mD59etV2Y96n6t577z2GDx/Ofvvtx9/+9jeysrIAuOSSSzjwwANrjN2zZ09GjBjB66+/zl577bXZ90tSw9LS0rj00kv5zne+wzXXXMOuu+5ap8+vf/1r1q9fzyuvvEKnTp0AOOigg+jbty933HEH5557LrNmzeK///0vc+bMYb/99gNg6NCh9O3bl/79+1eNNWLECEaMGAEkwu5hw4ZRVFTE73//ey699FIKCgoYOHAgkLjmbLrbuj7jxo1j0qRJvPTSS1XXpIcffpiNGzdWLel011138frrr/PGG28wYMAAAEaOHMnAgQP51a9+VeMaXd2cOXM45ZRTOP3006vaTj75ZAByc3Or6qrvWlhcXMyNN97IMcccU9V2+umnc9hhh/GnP/0JgMMPPxyASy+9lMsvv5xevXrVGOOnP/0pv/3tb3n00Uerrp//+Mc/mDlzZo1r6te//nXmz5/PddddVyfElyRJTecd15IkKeWtWLGCzMxMMjMzGThwIAsXLmT69On06NGDOXPmsMMOO1QFBwDt2rXjqKOO4vnnnwdg0KBBrF69mtNPP50nnniiRR/qOHbsWP7xj3+wYsUKAF555RXmz5/P2LFjgUQAvXjxYk4++WTKysqqvoYPH05JSQmvv/56veP
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"labels = [[{'age': {'60-69'}},{'hypertension': {'no'}},{'heart_disease': {'yes'}},{'bmi': {'obesity_1'}},{'gender': {'female'}},{'smoking_status': {'smokes'}}],\n",
" [{'age': {'70-79'}},{'hypertension': {'yes'}},{'heart_disease': {'yes'}},{'bmi': {'obesity_2'}},{'gender': {'male'}},{'smoking_status': {'smokes'}}],\n",
" [{'age': {'70-79'}},{'hypertension': {'yes'}},{'heart_disease': {'yes'}},{'bmi': {'correct'}},{'gender': {'female'}},{'smoking_status': {'never_smoked'}}],\n",
" [{'age': {'60-69'}},{'hypertension': {'no'}},{'heart_disease': {'yes'}},{'bmi': {'obesity_2'}},{'avg_glucose_level': {'210-250'}},{'gender': {'female'}},{'smoking_status': {'smokes'}}],\n",
" [{'age': {'0-29'}},{'hypertension': {'no'}},{'heart_disease': {'no'}},{'bmi': {'correct'}},{'avg_glucose_level': {'130-170'}},{'gender': {'male'}},{'smoking_status': {'never_smoked'}}],\n",
" [{'age': {'80-89'}},{'hypertension': {'yes'}},{'heart_disease': {'yes'}},{'bmi': {'extreme'}},{'avg_glucose_level': {'210-250'}},{'gender': {'male'}},{'smoking_status': {'smokes'}}]\n",
" \n",
" \n",
" ]\n",
"\n",
"name = 1\n",
"for i in labels:\n",
" posteriori, labels = naive_bayes.count_bayes(i)\n",
" plot_priori(labels,posteriori, str(name))\n",
" name = name + 1"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aware-kuwait",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}