bayes_project/test.ipynb

581 lines
699 KiB
Plaintext
Raw Normal View History

2021-05-30 15:36:17 +02:00
{
"cells": [
{
"cell_type": "code",
2021-05-31 20:38:26 +02:00
"execution_count": 20,
2021-05-30 15:36:17 +02:00
"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",
2021-05-31 16:33:55 +02:00
"# 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",
2021-05-31 18:56:34 +02:00
" color ='black') \n",
"def plot_priori(labels, posteriori, name): \n",
2021-05-31 16:33:55 +02:00
" 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",
2021-05-31 18:56:34 +02:00
"# plt.show()\n",
" plt.savefig(name + \".png\", dpi=100)\n",
2021-05-31 16:33:55 +02:00
"\n",
"\n",
2021-05-31 20:38:26 +02:00
"# Wczytanie i normalizacja danych\n",
2021-05-30 15:36:17 +02:00
"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",
2021-05-31 20:38:26 +02:00
" bins = [50,90,130,170,210,250,290]\n",
" labels = ['50-90', '90-130','130-170','170-210','210-250','250-290']\n",
2021-05-30 15:36:17 +02:00
" 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",
2021-05-31 20:38:26 +02:00
"# Rozdzielenie etykiet i cech\n",
"data = data[['gender', 'age', 'bmi','smoking_status', 'work_type','hypertension','heart_disease','avg_glucose_level','stroke']]\n",
"\n",
2021-05-30 15:36:17 +02:00
"\n",
"\n",
2021-05-31 20:38:26 +02:00
"# Dane wejściowe - zbiór danych, wektor etykiet, wektor prawdopodobieństw a priori dla klas.\n",
2021-05-30 15:36:17 +02:00
"# Wygenerowanie wektora prawdopodobieństw a priori dla klas.\n",
"a_priori_prob = count_a_priori_prob(data_train)\n",
"labels = separate_labels_from_properties(X_train)\n",
"\n",
"class NaiveBayes():\n",
" def __init__(self, dataset, labels, a_priori_prob):\n",
" self.dataset = dataset\n",
" self.labels = labels\n",
" self.a_priori_prob = a_priori_prob\n",
" \n",
" def count_bayes(self):\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 self.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",
"\n",
" amount_label_value_yes_class = len(self.dataset.loc[(self.dataset['stroke'] == 'yes') & (self.dataset[label_name] == label_value)])\n",
" amount_label_value_no_class = len(self.dataset.loc[(self.dataset['stroke'] == 'no') & (self.dataset[label_name] == label_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",
" label_probs.append({str(label_name + \".\" + label_value):(amount_label_value_yes_class/amount_yes_class, amount_label_value_no_class/amount_no_class)})\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",
2021-05-31 16:05:08 +02:00
"labels = [{'age': {'70-79'}},{'hypertension': {'yes'}},{'heart_disease': {'yes'}},{'bmi': {'correct'}},{'gender': {'male'}},{'smoking_status': {'smokes'}}]\n",
2021-05-31 20:38:26 +02:00
"naive_bayes = NaiveBayes(data, labels, a_priori_prob)\n",
2021-05-30 15:36:17 +02:00
"posteriori, labels = naive_bayes.count_bayes()"
]
},
{
"cell_type": "code",
2021-05-31 20:38:26 +02:00
"execution_count": null,
2021-05-30 15:36:17 +02:00
"metadata": {},
"outputs": [],
2021-05-31 20:38:26 +02:00
"source": []
2021-05-30 15:36:17 +02:00
},
{
"cell_type": "code",
2021-05-31 20:38:26 +02:00
"execution_count": 21,
2021-05-30 15:36:17 +02:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-31 20:38:26 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAClIklEQVR4nOzdeXhV1d3//ffKQAZIGMMggyAiTjiB1CoqBVQURK0D6K8Vh4o+VXo71xmkVaugdahWaWvRais4VLHgUFvHFgtYbRUVBFQUUVGUAEkgw3r+SEgzQggZDvB+3de5zF577X2++9z0YuXDOmuFGCOSJEmSJEmSJCWKpOYuQJIkSZIkSZKkigyuJUmSJEmSJEkJxeBakiRJkiRJkpRQDK4lSZIkSZIkSQnF4FqSJEmSJEmSlFAMriVJkiRJkiRJCcXgWpIkSVKDCCHcH0L4MoTwTi3nQwjhzhDC4hDCf0MIBzR1jZIkSdo2GFxLkiRJaijTgOGbOH800KfsNQ74dRPUJEmSpG2QwbUkSZKkBhFjfAVYtYkuxwEP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z8915XpIkSQmlXbt2dO3alRtuuKHGCSOJJicnh5ycnOYuY4vEGFm/fj3p6enNXUq9OONakiRtc/r37w/ARx99BMBXX33F2LFjad++PZmZmQwePJj58+dXumbmzJn079+fli1b0rZtW77zne/w8ssvl5+vuFTI4MGDeeONN3jggQfKlyiZNm0aUHkpjWnTptGiRYtqszEWLFhACIEXXnihvO2pp55iwIABpKen07lzZy6//HIKCws3+ZyvvfYahx56KNnZ2WRnZ7Pffvvx6KOPltfx9ddfc/3115fXuHH2dQiB2267jQsvvJCcnBz69etX58+pquXLl7P77rszbNgw8vLyAHj11Vc5/PDDyczMpH379pxzzjmsWbNmk/eRJEmSKgohcPXVVzNz5kzefvvtTfZdtmwZY8aMoV27dmRmZnLUUUexcOHCan2OPvpoMjIy6NWrF9OmTau27Mj777/PmDFj6N69O5mZmey1117cfvvtlJSUAPDSSy9x7LHHAtCrVy9CCPTs2ROovpRGr169uOyyy6rVevLJJzNo0KDy41WrVjFu3Dg6depEeno6Bx98MP/61782+byFhYVceuml9OjRg7S0NHbaaSdOOOEENmzYwLRp0xg/fnz5ZxhCKH/GiRMn0qFDB1577TUOPPBA0tPTy39/mDFjBv369SMtLY3u3btz9dVXU1RUtMk6Jk+eTHp6OjNnzgSgoKCAyy+/nO7du5OWlsa+++7L7NmzN3mPrWFwLUmStjkbA+vOnTsDcPzxx/Pcc88xZcoUpk+fTklJCd/73vdYvHgxAEuWLOGkk05iyJAhPP300zz88MOMHDmSVatW1Xj/e+65h913351jjjmmfImSESNGVOt3/PHHE0Lgz3/+c6X26dOn06lTJ773ve8BpYPE73//+wwcOJCZM2cyYcIEpk6dypVXXlnrM+bm5jJy5Eh22WUXHn/8cR577DF++MMflofkf/7zn2ndujVnn312eY0HHHBA+fWTJ09mxYoV/OEPf+DOO++s0+dU0+d82GGH0bt3b/7yl7+QmZnJP/7xD4YNG0bnzp157LHHuP3225k9ezZnnnlmrc8iSZIk1eTkk0+mT58+3HDDDbX2WbVqFYMGDWLhwoXce++9zJgxg3Xr1jFs2DDy8/OB0pnFo0aN4r333uP+++/ntttu484776wWEC9fvpy+fftyzz33MHv2bM455xwmTJjAzTffDMABBxzAlClTAHjiiSeYM2dOtbH+Rqecckp5KLzR2rVrmTVrFmPGjAFg/fr1DBs2jBdeeIHJkyfz5JNPkpOTw7Bhw/j8889rfeabbrqJhx9+mJ/97Gf89a9/5fbbb6d169YUFxczYsQILrnkEoDy3wPuueee8mvz8vIYO3YsP/rRj3j22WcZOHAgzz//PKNHj+aAAw7gqaeeYvz48UyZMoULLrig1homTZrEhAkTmDlzJqNGjQJK1x+fNm0aV111FU8//TQHHnggo0aN4q233qr1PlvDpUIkSdI2YeNsgKVLl/LjH/+YrKwshg0bxrPPPss//vEPXnrpJQ4//HAAhgwZQs+ePZk8eTL33Xcfb775JllZWUyePLn8fsccc0yt77XnnnvSsmVLcnJyNrmESJs2bRg+fDjTp0+vFNxOnz6dk046ieTkZGKMXHbZZZx++umVBpRpaWmcf/75XHnllbRv377avRctWsTq1av51a9+RVZWFgBHHnlk+fn999+flJQUunXrVmONXbp0Yfr06eXHdfmcKlq8eDFDhgzhwAMP5E9/+hMtWrQA4IorruDggw+udO+uXbsydOhQ3nnnHfbee+9aPy9JkiSpoqSkJK688krOPvtsJk2axG677Vatzy9/+UvWrVvHW2+9Rbt27QA45JBD6NmzJ/fffz/nn38+s2fP5j//+Q9z587lwAMPBGDgwIH07NmT3r17l99r6NChDB06FCgNuwcNGkReXh6/+c1vuPLKK8nOzqZv375A6Xh742zrmowZM4ZbbrmF119/vXw8/vTTT7Nhw4by5Qwfeugh3nnnHRYsWECfPn0AGDZsGH379uXWW2+t9PtJRXPnzuW0005j7Nix5W2nnHIKABkZGeV11fR7QH5+PrfddhvHHXdcedvYsWMZPHgwDzzwAADDhw8H4Morr+Saa66hW7dule5x1VVXcdddd/HMM8+U/+7wt7/9jVmzZlX6feLII49k0aJF3HDDDdVC/IbgjGtJkpTwvv76a1JTU0lNTaVv374sXbqU6dOn06VLF+bOnUvHjh3LB08ALVu2ZOTIkbz22msA9OvXj9WrVzN27Fief/75Bt3UcfTo0fztb3/j66+/BuCtt95i0aJFjB49GigNoJctW8Ypp5xCUVFR+WvIkCEUFBTwzjvv1Hjf3r1706pVK0477TSeeuqpasuRbE7VYL4un9NGCxc
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACdZklEQVR4nOzdeZzVVf348deZfQZmhn2RRRARN3IB0RKVWMIF9wWyXEvsl9rX3NK0RMssJcs1xL5KZiUuqSi4ZKlpYojfLMUVEEEURRAGmIVZzu+PO9xmZxgG5gKvZ4/7mPmcz/mcz/tzwXzft+eeE2KMSJIkSZIkSZKUKtLaOgBJkiRJkiRJkmqycC1JkiRJkiRJSikWriVJkiRJkiRJKcXCtSRJkiRJkiQppVi4liRJkiRJkiSlFAvXkiRJkiRJkqSU0maF6xDC3SGEz0IIbzZyPoQQbgkhzA8h/CeEsP/WjlGSJElS85njS5IkqbW05YzracDhTZw/AhhY/ZoI/GYrxCRJkiSp5aZhji9JkqRW0GaF6xjj34GVTXQ5Frg3JrwCdAgh9Nw60UmSJEnaVOb4kiRJai0ZbR1AE3oBS2ocf1Td9kndjiGEiSRmbNCuXbshu++++1YJUJIkSVvPa6+99nmMsWtbx6HNYo4vSZKkpKZy/FQuXDdbjHEqMBVg6NChce7cuW0ckSRJklpbCOHDto5BW485viRJ0vavqRy/Lde43pilQJ8ax72r2yRJkiRtm8zxJUmS1CypXLieAZxevfP4QcDqGGO9rxBKkiRJ2maY40uSJKlZ2mypkBDCn4ARQJcQwkfA1UAmQIxxCjALOBKYDxQDZ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UUw4YN45lnnmH8+PHsv//+PPbYY1xwwQVMnjyZ888/v9EYrr32Wq6++mpmzJjBMcccAyTWH582bRo//OEPefzxxznggAM45phjeP311xsdZ3O4VIgkSdombJgNsHDhQr773e+Sn5/P6NGjeeqpp/jHP/7B888/z2GHHQbAyJEj6devHzfeeCN33nkn//rXv8jPz+fGG29MjnfkkUc2eq8999yTdu3a0bVr1yaXEOnQoQOHH34406dPr1W4nT59OieddBLp6enEGLn00ks5/fTTayWU2dnZnHfeeVxxxRV07ty53tjvvfceq1ev5rbbbiM/Px+Ar33ta8nz++23HxkZGfTu3bvBGHv27Mn06dOTx815n2qaP38+I0eO5IADDuBPf/oTWVlZAFx++eV85StfqTV2r169GDVqFG+++SZ77713o++XJEmSVFNaWhpXXHEF3/rWt7j22mvZbbfd6vX51a9+xbp163j99dfp1KkTAAcffDD9+vXj7rvv5rzzzmPWrFn8+9//Zs6cORxwwAEADBs2jH79+jFgwIDkWKNGjWLUqFFAotg9fPhwiouLueuuu7jiiisoKChg0KBBQCLf3jDbuiETJkzghhtu4JVXXknm448//jjr169PLmd433338eabbzJv3jwGDhwIwOjRoxk0aBC//OUva30+qWnOnDmceuqpnHHGGcm2U045BYDc3NxkXA19DigpKeGmm27i2GOPTbadccYZjBgxgt/97ncAHH744QBcccUVXHXVVfTu3bvWGD/84Q+59dZbefLJJ5OfHf76178yc+bMWp8nvva1r/Hee+9x3XXX1SvitwZnXEuSpJS3YsUKMjMzyczMZNCgQSxcuJDp06fTs2dP5syZQ7du3ZLJE0C7du0YN24cL730EgCDBw9m9erVnHHGGTzzzDOtuqnj+PHj+etf/8qKFSsAeP3113nvvfcYP348kChAL168mFNOOYWKiorka+TIkZSWlvLmm282OO6AAQNo374
2021-05-31 16:33:55 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:38:26 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAB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rTxevXo1EyZMoGvXrmRkZHDooYfy97//fbP3W1xczGWXXUbv3r1JT09nl1124aSTTmLjxo3MmDGDiRMnVn6GIYTKe5w8eTKdO3fm9ddf5+CDDyYjI6MyN3vkkUcYOHAg6enp9OrVi6uvvpqSkpLN1jF16lQyMjKYNWsWAIWFhVxxxRX06tWL9PR09t9/f+bMmbPZMbaFwfUOYlNg3a1bNwBOPPFEnn/+eaZNm8bMmTMpKyvjG9/4BkuWLAFg6dKlnHLKKQwfPpxnnnmGhx56iDFjxrB69eo6x7/nnnvYc889Oe644yqXKBk9enStfieeeCIhBJ588slq7TNnzqRr16584xvfAMr/spx88skMGTKEWbNmMWnSJO677z6uuuqqeu8xLy+PMWPGsNtuu/H444/z2GOP8e1vf7syJH/yySdp164d3/nOdyprPOiggyqvnzp1Kp9++im/+93vuPPOOxv0OdX1OR9xxBH069ePZ599lqysLP76178ycuRIunXrxmOPPcbtt9/OnDlzOOecc+q9F0mSJEmSpJ3dqaeeSv/+/bnhhhvq7bN69WqGDh3KokWLmD59Oo888ggbNmxg5MiRFBQUAOUzi8eOHcs777zD/fffz2233cadd95ZKyBesWIFAwYM4J577mHOnDmcd955TJo0iZtvvhmAgw46iGnTpgHwxBNPMHfu3FoZ1yannXZaZSi8yfr165k9ezbjx48HoKioiJEjR/Liiy8ydepUnnrqKXJzcxk5ciSfffZZvfd800038dBDD/GTn/yEP/3pT9x+++20a9eO0tJSRo8ezaWXXgpQmX/dc889ldfm5+dz1lln8d3vfpfnnnuOIUOG8MILLzBu3DgOOuggnn76aSZOnMi0adO48MIL661hypQpTJo0iVmzZjF27FigfP3xGTNm8OMf/5hnnnmGgw8+mLFjx/Lmm2/WO862cKmQVmzTT0WWLVvG97//fbKzsxk5ciTPPfccf/3rX3n55Zc58sgjARg+fDh9+vRh6tSp3HvvvfzrX/8iOzubqVOnVo533HHH1ftee++9N23atCE3N3ezS4i0b9+eUaNGMXPmzGrB7cyZMznllFNITk4mxsjll1/OmWeeWe0vVnp6OhdccAFXXXUVnTp1qjX24sWLWbt2Lb/4xS/Izs4G4Oijj648f+CBB5KSkkLPnj3rrLF79+7MnDmz8rghn1NVS5YsYfjw4Rx88MH84Q9/IC0tDYArr7ySQw89tNrYPXr0YMSIEbz11lvsu+++9X5ekiRJkiRJO6ukpCSuuuoqvvOd7zBlyhT22GOPWn1+/vOfs2HDBt588006duwIwGGHHUafPn24//77ueCCC5gzZw7//ve/mTdvHgcffDAAQ4YMoU+fPvTr169yrBEjRjBixAigPOweOnQo+fn5/OpXv+Kqq64iJyeHAQMGAOU506bZ1nUZP348t9xyC2+88UZlDvXMM8+wcePGymV8H3zwQd566y0WLlxI//79ARg5ciQDBgzg1ltvrZbLVTVv3jzOOOMMzjrrrMq20047DYDMzMzKuurKvwoKCrjttts44YQTKtvOOusshg0bxm9/+1sARo0aBcBVV13FNddcQ8+ePauN8eMf/5i77rqLP/7xj5WZ2Z///Gdmz55dLUc7+uijWbx4MTfccEOtEL8pOOO6lfryyy9JTU0lNTWVAQMGsGzZMmbOnEn37t2ZN28eXbp0qfwmAmjTpg1jxozh9ddfB2DgwIGsXbuWs846ixdeeKFJN3UcN24cf/7zn/nyyy8BePPNN1m8eDHjxo0DygPo5cuXc9ppp1FSUlL5Gj58OIWFhbz11lt1jtuvXz/atm3LGWecwdNPP11rOZItqRnMN+Rz2mTRokUcccQ
2021-05-31 16:33:55 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:38:26 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACrQklEQVR4nOzdd5xV1b3//9eawhRgqEORIgiIDRtIjKISQEVB1FhAf4k1ot8oufau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jqlTpzJjxgxKSkr43ve+x+LFiwFYsmQJJ554IsOGDePpp5/m4YcfZvTo0axevbra+99zzz3stttuHH300WVLlIwaNapKv+OOO44QAn/6058qtM+YMYPOnTvzve99D0gMEr///e8zePBgZs2axcSJE5k2bRpXXXVVjc+4du1aRo8ezS677MLjjz/OY489xg9/+MOykPxPf/oTbdq04eyzzy6rcf/99y+7fsqUKXz22Wf8/ve/584776zV51Td53zooYfSp08f/vznP5Odnc3f//53RowYQZcuXXjssce4/fbbmTNnDmeeeWaNzyJJkiRV56STTqJfv37ceOONNfZZvXo1Q4YM4f333+fee+9l5syZbNiwgREjRpCfnw8kZhaPGTOGd999l/vvv5/bbruNO++8s0pAvGLFCvr3788999zDnDlzOOecc5g4cSK33HILAPvvvz9Tp04F4IknnmDu3LlVxvqbnXzyyWWh8Gbr169n9uzZjBs3DoCNGzcyYsQIXnjhBaZMmcKTTz5Jbm4uI0aM4PPPP6/xmW+++WYefvhhfvrTn/KXv/yF22+/nTZt2lBcXMyoUaO45JJLAMp+D7jnnnvKrs3Ly+P000/nRz/6Ec8++yyDBw/m+eefZ+zYsey///489dRTTJgwgalTp3LBBRfUWMPkyZOZOHEis2bNYsyYMUBi/fHp06dz9dVX8/TTT3PAAQcwZswY3nzzzRrvsz1cKkSSJDULm2cDLF26lB//+Me0bt2aESNG8Oyzz/L3v/+dl156icMOOwyAYcOG0atXL6ZMmcJ9993Hv/71L1q3bs2UKVPK7nf00UfX+F577LEHLVu2JDc3d4tLiLRt25aRI0cyY8aMCsHtjBkzOPHEE0lNTSXGyGWXXcZpp51WYUCZkZHB+eefz1VXXUWHDh2q3HvRokWsWbOGX/3qV7Ru3RqAI444ouz8fvvtR1paGt27d6+2xq5duzJjxoyy49p8TuUtXryYYcOGccABB/DHP/6RFi1aAHDllVdy0EEHVbh3t27dGD58OG+//TZ77bVXjZ+XJEmSVF5KSgpXXXUVZ599NpMnT2bXXXet0ueXv/wlGzZs4M0336R9+/YAHHzwwfTq1Yv777+f888/nzlz5vDvf/+befPmccABBwAwePBgevXqRZ8+fcruNXz4cIYPHw4kwu4hQ4aQl5fHb37zG6666ipycnLo378/kBhvb55tXZ1x48Zx66238vrrr5eNx59++mk2bdpUtpzhQw89xNtvv83ChQvp168fACNGjKB///784he/qPD7SXnz5s3j1FNP5fTTTy9rO/nkkwHIysoqq6u63wPy8/O57bbbOPbYY8vaTj/9dIYOHcoDDzwAwMiRIwG46qqruPbaa+nevXuFe1x99dXcddddPPPMM2W/O/z1r39l9uzZFX6fOOKII1i0aBE33nhjlRC/PjjjWpIkJb1Vq1aRnp5Oeno6/fv3Z+nSpcyYMYOuXbsyb948OnXqVDZ4AmjZsiWjR4/mtddeA2DAgAGsWbOG008/neeff75eN3UcO3Ysf/3rX1m1ahUAb775JosWLWLs2LFAIoBetmwZJ598MkVFRWWvYcOGUVBQwNtvv13tffv06UOrVq049dRTeeqpp6osR7I1lYP52nxOm73
2021-05-31 16:33:55 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:38:26 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAJ/CAYAAACQpkQPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACwoUlEQVR4nOzdeXxV1bn4/8/KnEDCGAYZBAFxwgmkVlEpoKIgzkL91bEVe6v061ytA0irtkKtQ7WI91q02oqzKFStrWOLBWxtHUFARXEARZkykGH9/khIMxNCSE7w876v80r22muv/ezzSr3rPKzzrBBjRJIkSZIkSZKkRJHU0gFIkiRJkiRJklSZiWtJkiRJkiRJUkIxcS1JkiRJkiRJSigmriVJkiRJkiRJCcXEtSRJkiRJkiQpoaS0dABNrXPnzrFPnz4tHYYkSZKa2GuvvfZFjDG3peNQ83OOL0mStGO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QrVs3LrvsMoqKiup9zldeeYVDDjmEnJwccnJy2HfffXnooYcq4vjyyy+59tprK2LcvPo6hMBNN93EBRdcQG5uLoMGDWrw+1TdypUr2W233Rg1ahR5eXkAvPzyyxx22GFkZWXRqVMnzjnnHNavX1/vOJIkSVJlIQSuvPJK5syZwxtvvFFv3xUrVjBhwgQ6duxIVlYWRx55JIsXL67R56ijjiIzM5O+ffsya9asGmVH3n33XSZMmECvXr3Iyspizz335Oabb6a0tBSAF154gWOOOQaAvn37EkKgT58+QM1SGn379uXSSy+tEevJJ5/MsGHDKo7XrFnDxIkT6dq1KxkZGRx00EH84x//qPd5i4qKuOSSS+jduzfp6enstNNOHH/88WzatIlZs2YxadKkivcwhFDxjFOmTKFz58688sorHHDAAWRkZFR8fnjwwQcZNGgQ6enp9OrViyuvvJLi4uJ645g2bRoZGRnMmTMHgIKCAi677DJ69epFeno6++yzD/Pmzat3jG1h4lqSJLU6mxPW3bp1A+C4447jmWeeYfr06cyePZvS0lK+853vsHTpUgCWLVvGSSedxIgRI3jyySe5//77GTt2LGvWrKl1/DvuuIPddtuNo48+uqJEyZgxY2r0O+644wgh8Nhjj1Vpnz17Nl27duU73/kOUDZJPOGEExg6dChz5sxh8uTJzJw5kyuuuKLOZ1y3bh1jx45ll1124ZFHHuHhhx/mtNNOq0iSP/bYY7Rr147vf//7FTHuv//+FddPmzaNTz/9lN///vfceuutDXqfanufDz30UPr168dTTz1FVlYWf/vb3xg1ahTdunXj4Ycf5uabb2bevHmcddZZdT6LJEmSVJuTTz6ZAQMGcN1119XZZ82aNQwbNozFixczY8YMHnzwQTZu3MioUaPIz88HylYWjxs3jnfeeYe7776bm266iVtvvbVGgnjlypUMHDiQO+64g3nz5nHOOecwefJkfvnLXwKw//77M336dAAeffRR5s+fX2Ouv9kpp5xSkRTebMOGDcydO5cJEyYAUFhYyKhRo3juueeYNm0ajz/+OLm5uYwaNYrPPvuszme+4YYbuP/++/nZz37Gn//8Z26++WbatWtHSUkJY8aM4eKL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YJUmSpO9973v07t2bG264odbzzz33HIcffjg5OTkV88/s7GwGDx5cUfZu4cKFdOvWrSJpDWWLKzaXGNysoKCAyZMn079/f9LT00lNTeXKK6/k/fff32LZjOr2228/dt111yoLOmbPns1hhx1G165dK2IfPHgwffv2rYgd4LDDDqu3ZN++++7LrFmzuPHGG/nPf/5DjLHBcYUQOOqooyqOS0pK+Oc//1ljb6Dx48dTWlrK/Pnzq7RfdNF
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAACnY0lEQVR4nOzdeXhV1b3/8ffKnEDCPMkgiIgTtQqit+JQhuJAnRVq69iKbdX+rHWstaKttUVqq1aLeK9Sr21FbVUUHHvVimIRW1vFAQURRFFEGZNAhvX744RjJkISQs4Jvl998pC99trrfPd5ku3qJ/usHWKMSJIkSZIkSZKULjJSXYAkSZIkSZIkSdUZXEuSJEmSJEmS0orBtSRJkiRJkiQprRhcS5IkSZIkSZLSisG1JEmSJEmSJCmtGFxLkiRJkiRJktJKyoLrEMIdIYSPQwivbWF/CCHcFEJ4J4TwnxDCfq1doyRJkqTGc44vSZKklpLKO66nA4c3sP8IYFDV10Tg961QkyRJkqTmm45zfEmSJLWAlAXXMca/A5820OUY4K6Y8CLQMYTQq3WqkyRJktRUzvElSZLUUrJSXUADegPLqm2/X9X2Ye2OIYSJJO7YoF27dkN33333VilQkiRJrefll1/+JMbYLdV1aJs4x5ckSVJSQ3P8dA6uGy3GOA2YBjBs2LA4f/78FFckSZKklhZCeC/VNaj1OMeXJEna8TU0x0/lGtdbsxzoW227T1WbJEmSpLbJOb4kSZIaJZ2D65nAaVV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17kRcsGABIQSeeuqpZNtDDz3EsGHDyMvLo2fPnlxyySWUlZU1eJ5z5szh4IMPpqioiKKiIr785S9z3333JetYtWoVV199dbLGzXdfhxC44YYbuOCCC+jWrRtDhgxp9PtU2/Lly9l9990ZPXo0xcXFADz33HMceuihFBQU0KVLF84++2zWrVvX4DiSGhZC4IorrmDmzJm8+uqrDfZdunQpEyZMoHPnzhQUFDB27FjeeuutOn2OOOII8vPzGTBgANOnT6+z7Mibb77JhAkT6Nu3LwUFBey111789re/pbKyEoBnnnmGr3/96wAMGDCAEAL9+/cH6i6lMWDAAC6++OI6tZ500kmMGDEiuf3pp58yceJEevToQV5eHl/5ylf4xz/+0eD5lpWVcdFFF9GvXz9yc3PZaaedOO6449i0aRPTp0/n/PPPT76HIYTkOU6aNImuXbsyZ84c9t9/f/Ly8pLX0HvvvZchQ4aQm5tL3759ueKKKygvL2+wjuuvv568vDxmzpwJQGlpKZdccgl9+/YlNzeXffbZh9mzZzc4hiRJajyDa0mS1OZsDqx79uwJwLHHHsvjjz/OlClTmDFjBpWVlXz1q1/lnXfeAWDRokWceOKJjBw5kocffpg//vGPjBs3jk8//bTe8W+99VZ23313jjzyyOQSJUcddVSdfsceeywhBB544IEa7TNmzKBHjx589atfBRIByfHHH8/w4cOZOXMmV111FdOmTePyyy/f4jmuXbuWcePGscsuu/CXv/yF+++/n1NPPTUZkj/wwAN06NCBb3/728ka99tvv+Tx119/PR9++CH/+7//y0033dSo96m+9/mQQw5h4MCBPPLIIxQUFPD8888zevRoevbsyf33389vf/tbZs+ezZlnnrnFc5HUOCeddBKDBg3i2muv3WKfTz/9lBEjRvDWW28xdepU7r33XjZs2MDo0aMpKSkBEncWH3300bzxxhvccccd3HDDDdx00011AuLly5czePBgbr31VmbPns3ZZ5/NVVddxa9+9SsA9ttvP6ZMmQLAX//6V+bOnVvnerfZySefnAyFN1u/fj2zZs1iwoQJAGzcuJHRo0fz1FNPcf311/Pggw/SrVs3Ro8ezYoVK7Z4ztdddx1//OMf+dnPfsaTTz7Jb3/7Wzp06EBFRQVHHXUUP/rRjwCS18Jbb701eWxxcTGnn3463/nOd3jssccYPnw4TzzxBOPHj2e//fbjoYce4vzzz2fKlCmcd955W6zhmmuu4aqrrmLmzJkcffTRQGL98enTp/PjH/+Yhx9+mP3335+jjz6aV155ZYvjSJKkxnOpEEmS1CZsvhNu8eLFfP/736ewsJDRo0fz2GOP8fzzz/PMM89w6KGHAjBy5Ej69+/P9ddfz2233ca//vUvCgsLuf7665PjHXnkkVt8rT333JN27drRrVu3BpcQ6dixI4cffjgzZsyoEdzOmDGDE088kczMTGKMXHzxxZx22mk1wpTc3FzOPfdcLr/8crp06VJn7IULF7JmzRp+97vfUVhYCMDXvva15P59992XrKws+vTpU2+NvXr1YsaMGcntxrxP1b3zzjuMHDmS/fffnz//+c/k5OQAcNlll/GVr3ylxti9e/dm1KhRvPbaa+y9995bfL8kNSwjI4PLL7+cb3/721xzzTXstttudfr85je/YcOGDbzyyit07twZgIMOOoj+/ftzxx13cO655zJ79mz+/e9/M2/ePPbff38Ahg8fTv/+/Rk4cGByrFGjRjFq1CggEXaPGDGC4uJibr/9di6//HKKiooYPHgwkLjmbL7buj4TJkxg8uTJvPjii8lr0sMPP8ymTZuSSzrdfffdvPbaayxYsIBBgwYBMHr0aAYPHsyvf/3rGtfo6ubNm8cpp5zC6aefnmw7+eSTAcjPz0/WVd+1sKSkhBtuuIFjjjkm2Xb66adz2GGH8Yc//AGAww8/HIDLL7+cn/zkJ/Tp06fGGD/+8Y+5+eabefTRR5PXz7/97W/MmjWrxjX1a1/7GgsXLuTaa6+tE+JLkqSm845rSZKU9latWkV2djbZ2dkMHjyYxYsXM2PGDHr16sW8efPo3r17MjgAaNeuHePGjWPOnDkADBkyhDVr1nD66afzxBNPtOhDHcePH8/f/vY3Vq1aBcArr7zCwoULGT9+PJAIoJcuXcrJJ59MeXl58mvkyJGUlpby2muv1Tv
2021-05-30 15:36:17 +02:00
"text/plain": [
2021-05-31 16:05:08 +02:00
"<Figure size 1800x720 with 2 Axes>"
2021-05-30 15:36:17 +02:00
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
2021-05-31 16:33:55 +02:00
"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': {'correct'}},{'gender': {'male'}},{'smoking_status': {'never_smoked'}}],\n",
" [{'age': {'70-79'}},{'hypertension': {'yes'}},{'heart_disease': {'yes'}},{'bmi': {'correct'}},{'gender': {'female'}},{'smoking_status': {'never_smoked'}}],\n",
2021-05-31 20:38:26 +02:00
" [{'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",
2021-05-31 16:33:55 +02:00
" \n",
" ]\n",
"\n",
2021-05-31 18:56:34 +02:00
"name = 1\n",
2021-05-31 16:33:55 +02:00
"for i in labels:\n",
" naive_bayes = NaiveBayes(data_train, i, a_priori_prob)\n",
" posteriori, labels = naive_bayes.count_bayes()\n",
2021-05-31 18:56:34 +02:00
" plot_priori(labels,posteriori, str(name))\n",
" name = name + 1"
2021-05-30 15:36:17 +02:00
]
2021-05-31 16:33:55 +02:00
},
{
"cell_type": "code",
2021-05-31 20:52:48 +02:00
"execution_count": 30,
2021-05-31 16:33:55 +02:00
"metadata": {},
"outputs": [],
2021-05-31 20:38:26 +02:00
"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_train)\n",
"labels = separate_labels_from_properties(X_train)\n",
"\n",
"class NaiveBayes():\n",
" def __init__(self, dataset, labels, a_priori_prob):\n",
" self.dataset = dataset\n",
" self.labels = labels\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, labels, a_priori_prob)\n",
"naive_bayes.fit()"
]
2021-05-31 16:33:55 +02:00
},
{
"cell_type": "code",
2021-05-31 20:52:48 +02:00
"execution_count": 31,
2021-05-31 16:33:55 +02:00
"metadata": {},
2021-05-31 20:38:26 +02:00
"outputs": [
{
"data": {
2021-05-31 20:52:48 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACkfElEQVR4nOzdeXxV1b3//9fKQAYgyBBBGQQBUZQ6gFQrKgVUFMShCtRf1WIreqv0WuexgFatQq1zkfaL1KutOINC1WodaouCtrSKAwJaBAdQlCkJZFi/PxLSjBAgyTmB1/M+zoPstdde57NP9bryZp21Q4wRSZIkSZIkSZKSRUqiC5AkSZIkSZIkqSKDa0mSJEmSJElSUjG4liRJkiRJkiQlFYNrSZIkSZIkSVJSMbiWJEmSJEmSJCUVg2tJkiRJkiRJUlIxuJYkSZJUL0II00IIK0MI79RyPoQQ7gwhLA4h/DuEcEhj1yhJkqSmweBakiRJUn2ZDgzdwvnjgZ5lr7HAbxqhJkmSJDVBBteSJEmS6kWM8VVg9Ra6nAQ8EEu9DuwWQtijcaqTJElSU5KW6ALqW7t27WLXrl0TXYYkSZLq2VtvvfVljDE30XVoh3QEPqlwvLys7bOqHUMIYyldlU3z5s377rvvvo1SoCRJkhrPlub4O11w3bVrV958881ElyFJkqR6FkL4T6Jr0A4LNbTFmjrGGKcCUwH69esXneNLkiTtfLY0x3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aaoyFCxcSQuDFF18sb5s5cyb9+vUjMzOTDh06cPnll1NYWLjF+3zttdc48sgjycnJIScnh4MOOohHH320vI6vvvqKiRMnlte4efV1CIHbbruNiy66iNzcXPr06VPnz6mqFStW0KtXL4YMGUJeXl55XUcffTTZ2dm0bduWc889l3Xr1m1xHEmSJKmiEAJXX301s2bN4u23395i32XLljF69GjatGlDdnY2xx13HB988EG1PscffzxZWVl069aN6dOnV9t25P3332f06NF07tyZ7Oxs9t9/f26//XZKSkoAePnllznxxBMB6NatGyEEunbtClTfSqNbt25cfvnl1Wo97bTTOPLI/26hsnr1as477zzat29PZmYm3/nOd3jjjTe2eL+FhYVceumldOnShYyMDPbcc09OOeUUNm3axPTp0xk3blz5ZxhCKL/HCRMm0K5dO1577TUOPfRQMjMzy39/eOSRR+jTpw8ZGRl07tyZa665hqKioi3WMWnSJDIzM5k1axYABQUFXH755XTu3JmMjAwOPPBA5syZs8UxdoTBtSRJanI2B9YdOnQA4OSTT+a5555j8uTJzJgxg5KSEr773e+yePFiAJYsWcJpp53GoEGDePrpp3nooYcYPnw4q1evrnH8e++9l3333ZcTTjihfIuSYcOGVet36qmnAqXbh1Q0Y8YMdt999/IJ5COPPMKpp55K//79mTVrFuPHj2fq1KlcddVVtd7j2rVrGT58OHvvvTePP/44jz32GGeeeWZ5SP7kk0/SqlUrfvSjH5XXeMghh5RfP2nSJD777DP+7//+jzvvvLNOn1NNn/NRRx1Fjx49eOaZZ8jOzuZvf/sbgwcPpkOHDjz22GPcfvvtzJkzhzFjxtR6L5IkSVJNTj/9dPbZZx9uvPHGWvusXr2aAQMG8MEHHzBlyhQeeeQRNmzYwJAhQ8jPzwdKVxaPGDGC9957j2nTpnHbbbdx5513VguINy/KuPfee5kzZw7nnnsu48eP55ZbbgHgkEMOYfLkyQA88cQTzJ07t9pcf7ORI0fyyCOPEGMsb1u/fj1z5sxh1KhRAGzcuJEhQ4bw5z//mUmTJvHUU0+Rm5vLkCFD+Pzzz2u955tvvpmHHnqIG264gT//+c/cfvvttGrViuLiYoYNG8Yll1wCUP57wL333lt+bV5eHmeffTY//vGPefbZZ+nfvz/PP/88o0aN4pBDDmHmzJmMGzeOyZMnc+GFF9Zaww033MD48eOZOXMmI0aMAEpD+enTp3P11Vfz9NNPc+ihhzJixAgWLFhQ6zg7wq1CJElSk7B5NcDSpUv5yU9+QsuWLRkyZAjPPvssf/vb33j55Zc5+uijARg0aBBdu3Zl0qRJ3Hffffzzn/+kZcuWTJo0qXy8E044odb36t27N82bNyc3N3eLW4i0atWKoUOHMmPGjErB7YwZMzj99NNJTU0lxshll13GWWedVWlCmZGRwQUXXMBVV11F27Ztq429aNEi1qxZw913303Lli0BOPbYY8vPH3zwwaSlpdGpU6caa+zQoQMzZswoP67L51TR4sWLGTRoEIceeih//OMfadasGQBXXnkl3/nOdyqN3bFjRwYPHsw777zDAQccUOvnJUmSJFWUkpLClVdeyY9+9COuv/569tlnn2p9fv3rX7NhwwYWLFhAmzZtADjiiCPo2rUr06ZN44ILLmDOnDn861//4o033qB///4A9O/fn65du9K9e/fysQYPHszgwYOB0rB7wIAB5OXl8dvf/parrrqKnJwcevXqBZTOtzevtq7J6NGjufXWW3njjTfK5+NPP/00GzduLN/O8MEHH+Sdd95h4cKF9OzZE4AhQ4bQq1cvfvWrX1X6/aSiefPmccYZZ3D22WeXt40cORKArKys8rpq+j0gPz+f2267jZNOOqm87eyzz2bgwIH8/ve/B2Do0KEAXHXVVVx77bV06tSp0hhXX301d911F3PmzClfjPPiiy8ye/bsSr9PHHvssSxatIgbb7yxfGV3fXLFtSRJSnpfffUV6enppKen06tXL5YuXcqMGTPYY489mDdvHrm5ueWTJ4DmzZszfPhwXnvtNQD69OnDmjVrOPvss3n++efr9aGOo0aN4sUXX+TLL78EYMGCBSxatKh8lcWiRYtYtmwZI0eOpKioqPw1aNAgCgoKeOedd2oct3v37rRo0YIzzjiDmTNnVtuOZGuqrhCvy+e02QcffMB
2021-05-31 20:38:26 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:52:48 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACctElEQVR4nOzdeXxV1bnw8d/KnEDCLGgAQUQcaxVEragUpKhQZ4HaqtU6tYqvdR4raK1Vqa1WLdJepV7bClpncL51qihia+uMgIqiKKKMSSDDev844ZgRkhA4B/h97+d8yF577XWefaTXJ4/rPDvEGJEkSZIkSZIkKV1kpDoASZIkSZIkSZJqsnAtSZIkSZIkSUorFq4lSZIkSZIkSWnFwrUkSZIkSZIkKa1YuJYkSZIkSZIkpRUL15IkSZIkSZKktJKywnUI4Y4QwhchhDcbOR9CCDeHEOaEEP4bQthzY8coSZIkqenM8SVJktRaUrnjejJw8FrOHwL0rX6dBvxhI8QkSZIkqeUmY44vSZKkVpCywnWM8Xngq7VMORy4Kya8DLQPIWy9caKTJEmS1Fzm+JIkSWotWakOYC2KgY9rHH9SPfZZ3YkhhNNI7NigTZs2/XfccceNEqAkSZI2ntdee+3LGGOXVMeh9WKOL0mSpKS15fjpXLgODYzFhibGGCcBkwAGDBgQZ82atSHjkiRJUgqEED5KdQxab+b4kiRJSlpbjp/KHtfr8gnQo8Zxd+DTFMUiSZIkaf2Z40uSJKlJ0rlw/TBwQvWTx/cBlsYY632FUJIkSdImwxxfkiRJTZKyViEhhL8Bg4HOIYRPgCuBbIAY40RgOnAoMAcoAU5KTaSSJEmSmsIcX5IkSa0lZYXrGOMP1nE+AmdupHAkSZIkrSdzfEmSJLWWdG4VIkmSJEmSJEnaAlm4liRJkiRJkiSllZS1CpEkSRvHsmXL+OKLLygvL091KFKjsrOz2WqrrSgqKkp1KJIkSWnPHF+bgvX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969ezN58uR6bUfeffddxowZQ48ePSgoKGCXXXbhd7/7HVVVVQA8++yzfP/73wegd+/ehBDo1asXUL+VRu/evbnwwgvrxXrMMcew//7ftFD56quvOP300+natSt5eXl85zvf4ZVXXlnr/ZaXl3P++efTs2dPcnNz2WabbTjyyCNZvXo1kydPZuzYscnPMISQvMdx48bRuXNnXnzxRfbaay/y8vKSvz9MnTqV3XbbjdzcXHr06MFll11GRUXFWuO44YYbyMvL4+GHHwagrKyMCy+8kB49epCbm8vuu+/O9OnT17rG+rBwLUmSNjlrCtbdunUD4IgjjuCJJ55gwoQJTJkyhaqqKr773e8yZ84cAObOncsxxxzDkCFDeOSRR/jLX/7CyJEj+eqrrxpc/7bbbmPHHXfk0EMPTbYoGTFiRL15Rx11FJBoH1LTlClT2GqrrZIJ5NSpUznqqKMYOHAgDz/8MFdeeSWTJk3ikksuafQely1bxsiRI9luu+34+9//zn333cfxxx+fLJI/8MADtGvXjp/85CfJGPfcc8/k9TfccAOfffYZ//u//8vNN9/cpM+poc/5gAMOYPvtt+fRRx+loKCAf/7znwwdOpRu3bpx33338bvf/Y7p06dz0kknNXovkiRJUkOOPfZYdthhB6655ppG53z11VcMGjSI9957j4kTJzJ16lRWrlzJQQcdRGlpKZDYWXzYYYfxzjvvcMcdd3DjjTdy88031ysQr9mUcdtttzF9+nROPfVUrrzySq677joA9txzTyZMmADA/fffz4wZM+rl+muMGjWKqVOnEmNMjq1YsYLp06czevRoAFatWsVBBx3EU089xQ033MCDDz5Ily5dOOigg1i4cGGj93zttdfyl7/8hauvvpqnnnqK3/3ud7Rr147KykpGjBjBeeedB5D8PeC2225LXltSUsKJJ57IKaecwuOPP87AgQN58sknGT16NHvuuScPPfQQY8eOZcKECZx11lmNxnD11Vdz5ZVX8tBDD3HYYYcBiaL85MmTufTSS3nkkUfYa6+9OOyww3j99dcbXWd92CpEkiRtEtbsBpg3bx4/+9nPKCws5KCDDuLxxx/nn//8J88++ywHHnggAEOGDKFXr17ccMMN3H777fz73/+msLCQG264IbneoYce2uh77bzzzrRp04YuXbqstYVIu3btOPjgg5kyZUqtwu2UKVM49thjyczMJMbIBRdcwAknnFAroczNzeXMM8/kkksuoVOnTvXWnj17NkuXLuWWW26hsLAQgO9973vJ83vssQdZWVl07969wRi7devGlClTksdN+ZxqmjNnDkOGDGGvvfbib3/7Gzk5OQBcfPHFfOc736m1dnFxMUOHDuXNN99k1113bfTzkiRJkmrKyMjg4osv5ic/+QlXXXUVO+ywQ705v/3tb1m5ciWvv/46HTt2BGC//fajV69e3HHHHZx55plMnz6d//znP7zyyisMHDgQgIEDB9KrVy/69OmTXGvo0KEMHToUSBS7Bw0aRElJCX/84x+55JJLKCoqol+/fkAi316z27ohY8aM4frrr+eVV15J5uOPPPIIq1atSrYzvPvuu3nzzTd566236Nu3LwAHHXQQ/fr14ze/+U2t309qmjlzJscddxwnnnhicmzUqFEA5OfnJ+Nq6PeA0tJSbrzxRg4//PDk2IknnsjgwYP585//DMDBBx8MwCWXXMLll19O9+7da61x6aWX8vvf/57p06cnN+M888wzTJs2rdbvE9/73veYPXs211xzTXJnd2tyx7UkSUp7ixcvJjs7m+zsbPr168e8efOYMmUKW2+9NTNnzqRLly7J5AmgTZs2jBw5khdffBGA3XbbjaVLl3LiiSfy5JNPtupDHUePHs0zzzzDl19+CcDrr7/O7Nmzk7ssZs+ezfz58xk1ahQVFRXJ15AhQygrK+PNN99scN0+ffrQtm1bjjv
2021-05-31 20:38:26 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:52:48 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACoLElEQVR4nOzdeXxV1b3//9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EpsC6S5cuAJx00kk899xzTJkyhZkzZ1JWVsZ3v/tdFi1aBMDixYs59dRTGT58OE899RQPPPAAo0ePZs2aNbWOf88997DXXntx3HHHJbYoGTVqVI1+p5xyClC+fUhlM2fOZNddd038RXrooYc45ZRTGDx4MLNmzWLixIlMmzaNK664os57zMvLY/To0eyxxx48+uijPPLII/zoRz9KhOSPP/447dq14yc/+UmixoMOOihx/eTJk1m5ciX/8z//wx133NGg96m29/nwww+nb9++PP3002RnZ/P3v/+dESNG0KVLFx555BFuu+02Zs+ezbhx4+q8F0mSJEmSpJ3d97//ffbcc09uuOGGOvusWbOGIUOGsGDBAqZOncpDDz3Ehg0bOPLIIykoKADKVxafcMIJfPDBB0yfPp1bb72VO+64o0ZAvGkx4j333MPs2bM5++yzmThxIjfffDMABx10EFOmTAHgscceY86cOTUyrk1OO+00HnroIWKMibb169cze/ZsxowZA0BRURFHHnkkf/3rX5k8eTJPPPEEubm5HHnkkXz++ed13vNNN93EAw88wPXXX89f//pXbrvtNtq1a0dpaSmjRo3ioosuAkjkX/fcc0/i2vz8fM4880x++tOf8uyzzzJ48GCef/55xowZw0EHHcSTTz7JhAkTmDJlCueff36dNVx//fVMnDiRJ598khNOOAEoD+VnzJjBlVdeyVNPPcXBBx/MCSecwNtvv13nONvCrUJasE2/FVmyZAk/+9nPaNu2LUceeSTPPvssf//733n55Zc54ogjABg+fDi9evVi8uTJ3HvvvfzrX/+ibdu2TJ48OTHecccdV+drDRgwgNatW5Obm1vvFiLt2rVj5MiRzJw5s0pwO3PmTL7//e+TmppKjJFLLrmEM844o8pfrIyMDM477zyuuOIKOnbsWGPshQsXsnbtWu666y7atm0LwNFHH504f+CBB5KWlkb37t1rrbFLly7MnDkzcdyQ96myRYsWMXz4cA4++GD+/Oc/06pVKwAuv/xyvvOd71QZu1u3bowYMYL33nuPb33rW3W+X5IkSZIkSTurlJQULr/8cn7yk59w3XXXseeee9bo89vf/pYNGzbw9ttv06FDBwAOO+wwevXqxfTp0znvvPOYPXs2//73v3njjTcYPHgwAIMHD6ZXr1706dMnMdaIESMYMWIEUB52DxkyhPz8fH7/+99zxRVXkJOTQ//+/YHynGnTauvajB07lltuuYU33ngjkUM99dRTFBUVJbbxvf/++3nvvfeYP38+/fr1A+DII4+kf//+/OY3v6mSy1X25ptvcvrpp3PmmWcm2k477TQAsrKyEnXVln8VFBRw6623cuKJJybazjzzTIYNG8af/vQnAEaOHAnAFVdcwdVXX0337t2rjHHllVdy5513Mnv27MQi1BdffJFnnnmmSo529NFHs3DhQm644YbEyu7G5IrrFuqrr74iPT2d9PR0+vfvz5IlS5g5cyZdu3blzTffJDc3N/FDBNC6dWtGjx7Na6+9BsC+++7L2rVrOfPMM3n++ecb9aGOY8aM4cUXX+TLL78E4O2332bhwoWJ3zYtXLiQpUuXctppp1FSUpL4Gj58OIWFhbz33nu1jtunTx/atGnD6aefzpNPPlljO5LNqb5CvCHv0yYLFiz
2021-05-31 20:38:26 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:52:48 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACuPUlEQVR4nOzdeXxV1b3//9fKQAYgyBBBGQQBURQnELWiUgYFQRyqgP6qFqvordKv82xBrVqFep2LtBepV2+NM6hUrdahtqhoa1UcKKBFcEJRxgQyrN8fJ6QZIYQMJ/h63kceyV577XU++1zarryzztohxogkSZIkSZIkSckipakLkCRJkiRJkiSpPINrSZIkSZIkSVJSMbiWJEmSJEmSJCUVg2tJkiRJkiRJUlIxuJYkSZIkSZIkJRWDa0mSJEmSJElSUjG4liRJklQvQggzQwhfhRDeq+F8CCHcHkJYFEJ4J4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lvPHGG1xzzTVNXUaDS2vqAiRJkrYkLS2Ngw46CICDDjqIbt26ceihhzJ37twKYfO22DT+luy333718nqNKT8/3yfPS5IkKam0a9eOLl26cP3111e7YCTZ5Obmkpub29RlbJUYIxs2bCAzM7OpS6kTV1xLkqRmp3///gB88sknAHz99decdtpptG/fnuzsbAYPHsybb75Z4Zo5c+bQv39/WrZsSdu2bTnwwAN5+eWXy86X3ypk8ODBvPXWW/z+978v26Jk1qxZQMWtNO69914yMjKqrMZYsGABIQReeOGFsrbZs2czYMAAMjMz6dSpE5dccgmFhYWbvc9XX32VQw89lJycHHJycth33315+OGHy+r45ptvuOaaa8pq3LT6OoTALbfcwnnnnUdubi79+vWr9ftU2fLly+nTpw/Dhg1j/fr1ZXUdfvjhZGdn0759e84880zWrFmz2XEkSZKk8kIIXHHFFcyZM4d33313s32XLl3K+PHjadeuHdnZ2Rx55JF89NFHVfqMHDmSrKwsevTowaxZs6psO/Lhhx8yfvx4unbtSnZ2NnvuuSe33norJSUlALz00kscffTRAPTo0YMQAt27dweqbqXRo0cPLrnkkiq1nnDCCRx66H+2UFm5ciVnnXUWHTt2JDMzkx/84Ae8/vrrm73fwsJCLrroIrp160ZGRgY777wzxx13HBs3bmTWrFlMmjSp7D0MIZTd45QpU+jQoQOvvvoqBxxwAJmZmWW/Pzz00EP069ePjIwMunbtypVXXklRUdFm65g6dSqZmZnMmTMHgIKCAi655BK6du1KRkYG++yzD3Pnzt3sGNvC4FqSJDU7mwLrTp06AXDsscfy7LPPMm3aNPLy8igpKeGHP/whixYtAmDx4sWccMIJDBkyhCeffJIHHniA0aNHs3LlymrHv/vuu9l999056qijyrYoGTVqVJV+xx9/PJDYPqS8vLw8dtxxx7IJ5EMPPcTxxx/PwIEDmTNnDpMnT2bGjBlcfvnlNd7j6tWrGT16NLvuuiuPPvoojzzyCKecckpZSP7444/Tpk0bfvrTn5bVuP/++5ddP3XqVD7//HP+93//l9tvv71W71N17/Nhhx1Gr169eOqpp8jOzuavf/0rQ4cOpVOnTjzyyCPceuutzJ07lwkTJtR4L5IkSVJ1TjzxRHbbbTeuv/76GvusXLmSQYMG8dFHHzF9+nQeeugh1q1bx7Bhw8jPzwcSK4vHjBnDBx98wMyZM7nlllu4/fbbqwTEmxZl3H333cydO5czzzyTyZMnc9NNNwGw//77M23aNAAee+wx5s2bV2Wuv8nYsWN56KGHiDGWta1du5a5c+cybtw4ADZs2MCwYcP405/+xNSpU3niiSfIzc1l2LBhfPHFFzXe84033sgDDzzAddddx5/+9CduvfVW2rRpQ3FxMaNGjeLCCy8EKPs94O677y67dv369Zx22mmcccYZPPPMMwwcOJDnnnuOcePGsf/++zN79mwmTZrEtGnTOPfcc2us4brrrmPy5MnMnj2bMWPGAIlQftasWVxxxRU8+eSTHHDAAYwZM4a33367xnG2hVuFSJKkZmHTaoAlS5bws5/9jNatWzNs2DCeeeYZ/vrXv/LSSy9x+OGHAzBkyBC6d+/O1KlTueeee/jHP/5B69atmTp1atl4Rx11VI2v1bdvX1q2bElubu5mtxBp06YNI0aMIC8vr0Jwm5eXx4knnkhqaioxRi6++GJOPfXUChPKjIwMzjnnHC6//HLat29fZeyFCxeyatUq7rzzTlq3bg3AEUccUXZ+v/32Iy0tjS5dulRbY6dOncjLyys7rs37VN6iRYsYMmQIBxxwAH/4wx9o0aIFAJdddhk/+MEPKozduXNnhg4dynvvvcdee+1V4/slSZIklZeSksJll13GT3/6U6699lp22223Kn3++7//m3Xr1vH222/Trl07AA455BC6d+/OzJkzOeecc5g7dy7//Oc/ef311xk4cCAAAwcOpHv37vTs2bNsrKFDhzJ06FAgEXYPGjSI9evX89vf/pbLL7+cnJwc+vTpAyTm25tWW1dn/Pjx3Hzzzbz++utl8/Enn3ySDRs2lG1neP/99/Pee++xYMECevfuDcCwYcPo06cPv/71ryv8flLeG2+8wcknn8xpp51W1jZ27FgAsrKyyuqq7veA/Px8brnlFo455piyttNOO43Bgwfz+9//HoARI0YAcPnll3PVVVfRpUuXCmNcccUV3HHHHcydO7dsMc4LL7zA008/XeH3iSOOOIKFCxdy/fXXl63srk+uuJYkSUnvm2++IT09nfT0dPr06cOSJUvIy8tjp5124o033iA3N7ds8gTQsmVLRo8ezauvvgpAv379WLVqFaeddhrPPfdcvT7Ucdy4cbzwwgt8/fXXALz99tssXLiwbJXFwoULWbp0KWPHjqWoqKjsa8iQIRQUFPDee+9VO27Pnj1p1aoVJ598MrNnz66yHcmWVF4hXpv3aZO
2021-05-31 20:38:26 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:52:48 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAJ/CAYAAACQpkQPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACymElEQVR4nOzdeXxV1bn4/8/KQAYgkSGCMggCojgLoq2gFFBRELVVQe+tFlvRb5X+nGeLQ9UqaJ1L6b1IvdqKMyg4VOtQW1SwtVVUEFARJ1CUAEkgw/r9kXCaEUIIyQl+3n2dl9lrr73Os88L7ZOHdZ4dYoxIkiRJkiRJkpQsUpo7AEmSJEmSJEmSKrNwLUmSJEmSJElKKhauJUmSJEmSJElJxcK1JEmSJEmSJCmpWLiWJEmSJEmSJCWVtOYOoLF17Ngx9ujRo7nDkCRJUiN78803v4ox5jV3HGp65viSJEnbp03l+Ntd4bpHjx7Mnz+/ucOQJElSIwshfNzcMah5mONLkiRtnzaV49sqRJIkSZIkSZKUVCxcS5IkSZIkSZKSioVrSZIkSZIkSVJSsXAtSZIkSZIkSUoqFq4lSZIkSZIkSUnFwrUkSZIkSZIkKamkNXcAkiRp28rPz2fFihUUFxc3dyhSndLT09lxxx3Jyclp7lAkSZKSnjm+WoKtzfEtXEuStB3Lz8/nyy+/pEuXLmRlZRFCaO6QpBpijBQ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//vuMHTuWbt26kZ2dzZ577sltt91GWVkZAC+99BLHHHMMAD179iSEQI8ePYCarTR69uzJxRdfXCPWE044gcGD/9NCZdWqVZx55pl06tSJzMxMvv/97/P6669v8n6Li4u58MIL6d69OxkZGey8884cf/zxbNiwgenTpzNhwoTEZxhCSNzj1VdfTceOHXn11Vc58MADyczMTPz+8NBDD7H33nuTkZFBt27duOKKKygpKdlkHJMmTSIzM5NZs2YBUFRUxMUXX0y3bt3IyMhg3333Zc6cOZtcY2tYuJYkSS3OxoJ1586dATjuuON49tlnmTx5MjNmzKCsrIwf/OAHLF68GIAlS5ZwwgknMHToUJ588kkeeOABRo0axapVq2pd/5577mH33Xfn6KOPTrQoGTlyZI15P/zhD4Hy9iGVzZgxgx133DGRQD700EP88Ic/ZODAgcyaNYuJEycydepULrvssjrvMT8/n1GjRrHrrrvy6KOP8sgjj/DjH/84USR//PHHyc3N5ac//WkixgMOOCBx/aRJk/j888/5v//7P+644456fU61fc6HHnoovXv35qmnniI7O5u//e1vDBs2jM6dO/PII49w2223MWfOHMaNG1fnvUiSJEm1OfHEE9ltt924/vrr65yzatUqBg0axMKFC5kyZQoPPfQQ69atY/jw4RQWFgLlO4tHjx7Ne++9x7Rp07j11lu54447ahSIN27KuOeee5gzZw5nnHEGEydO5KabbgLggAMOYPLkyQA89thjzJ07t0auv9FJJ53EQw89RIwxMbZ27VrmzJnDmDFjAFi/fj3Dhw/nz3/+M5MmTeKJJ54gLy+P4cOH88UXX9R5zzfeeCMPPPAA1113HX/+85+57bbbyM3NpbS0lJEjR3LBBRcAJH4PuOeeexLXFhQUcNppp/Gzn/2MZ555hoEDB/Lcc88xZswYDjjgAGbOnMmECROYPHky55xzTp0xXHfddUycOJGZM2cyevRooLwoP336dC6//HKefPJJDjzwQEaPHs1bb71V5zpbw1YhkiSpRdi4G2Dp0qX8/Oc/p23btgwfPpxnnnmGv/3tb7z00kscdthhAAwdOpQePXowadIkfve73/HPf/6Ttm3bMmnSpMR6Rx99dJ3v1a9fP1q3bk1eXt4mW4jk5uYyYsQIZsyYUaVwO2PGDE488URSU1OJMXLRRRdx6qmnVkkoMzIyOPvss7nsssvo0KFDjbUXLVrE6tWrueuuu2jbti0ARxxxROL8/vvvT1paGl27dq01xs6dOzNjxozEcX0+p8oWL17M0KFDOfDAA/nTn/5Eq1atALj00kv5/ve/X2XtLl26MGzYMN555x322muvOj8vSZIkqbKUlBQuvfRSfvrTn3Lttdey22671Zjzm9/8hnXr1vHWW2/Rvn17AA455BB69OjBtGnTOPvss5kzZw7/+te/eP311xk4cCAAAwcOpEePHvTq1Sux1rBhwxg2bBhQXuweNGgQBQUF/P73v+eyyy4jJyeHvn37AuX59sbd1rUZO3YsN998M6+//noiH3/yySdZv359op3h/fffzzvvvMOCBQvo06cPAMOHD6dv377ccsstVX4/qeyNN97glFNO4bTTTkuMnXTSSQBkZWUl4qrt94DCwkJuvfVWjj322MTYaaedxpAhQ/jDH/4AwIgRIwC47LLLuPLKK+natWuVNS6//HLuvPNO5syZk9iM88ILLzB79uwqv08cccQRLFq0iOuvvz6xs7sxueNakiQlva+//pr09HTS09Pp27cvS5cuZcaMGey000688cYb5OXlJZIngNatWzNq1CheffVVAPbee29Wr17NaaedxnPPPdeoD3UcM2YML7zwAl999RUAb731FosWLUrssli0aBHLli3jpJNOoqSkJPEaOnQoRUVFvPPOO7Wu26tXL9q0acMpp5zCzJkza7Qj2ZzqO8Tr8zlttHDhQg499FAGDRrEjBkzEkXrgoIC5s6dW+NeBg0aRHp6Om+++eYWxShJkiT993//N927d+fGG2+s9fzzzz/P4YcfTk5OTiL/bNu2Lf3790+0vZs3bx6dO3dOFK2hfHPFxhaDGxUVFTFx4kR69+5NRkYG6enpXHHFFXz44YebbZtR3f77789uu+1WZUPHjBkzGDJkCJ06dUrE3r9/f3r27JmIHeCwww7bZMu+/fbbj+nTp3PzzTfz73//u8qu7s0JIXDUUUcljktLS/nHP/5R49lAY8aMoaysjLlz51YZP//887nnnnt49tl
2021-05-31 20:38:26 +02:00
"text/plain": [
"<Figure size 1800x720 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
2021-05-31 20:52:48 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACpzElEQVR4nOzdeXhV1d238XtlTiAJo4AMgog4Uasg2gpKQUTFOovUVi3WqVX7WqvWsYLWWpHaaqtF2kepj21FrTPU8XEWRWytsyioIIoiCAGSQIb1/nFCzERIQuCc4P3xOpfZa6+9z2+fC7bLb9ZZO8QYkSRJkiRJkiQpVaQluwBJkiRJkiRJkmoyuJYkSZIkSZIkpRSDa0mSJEmSJElSSjG4liRJkiRJkiSlFINrSZIkSZIkSVJKMbiWJEmSJEmSJKWUpAXXIYRbQgifhxDe2MD+EEK4IYTwfgjhtRDCnlu6RkmSJElN5xhfkiRJrSWZM66nAwc1sv9gYEDV6zTgT1ugJkmSJEktNx3H+JIkSWoFSQuuY4zPAMsb6XI4cFtMeBHoEELosWWqkyRJktRcjvElSZLUWjKSXUAjegKLamx/XNX2ad2OIYTTSMzYoF27doN32mmnLVKgJEmStpxXXnnlixhj12TXoU3iGF+SJEnVGhvjp3JwHRpoiw11jDFOA6YBDBkyJM6dO3dz1iVJkqQkCCF8lOwatMkc40uSJKlaY2P8ZK5xvTEfA71rbPcCPklSLZIkSZI2nWN8SZIkNUkqB9cPACdWPXl8H2BljLHeVwglSZIktRmO8SVJktQkSVsqJITwD2AE0CWE8DFwOZAJEGOcCswCDgHeB4qBCcmpVJIkSVJTOMaXJElSa0lacB1j/N5G9kfgzC1UjiRJkqRN5BhfkiRJrSWVlwqRJEmSJEmSJH0NGVxLkiRJkiRJklJK0pYKkSRJW0ZRURGff/45ZWVlyS5F2qDMzEy22WY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06dSIvL48xY8bw7rvv1utz8MEHk5ubS79+/Zg+fXq9ZUfeeecdxo8fT+/evcnLy2PXXXfl97//PZWVlQA89dRTfPe73wWgX79+hBDo27cvUH8pjX79+nHBBRfUq/WYY45h+PCvllBZvnw5p59+Ot26dSMnJ4dvf/vbvPTSS41eb1lZGeeddx59+vQhOzubbbfdliOPPJJ169Yxffp0zj777OrPMIRQfY0TJ06kS5cuPPfcc+y1117k5ORU30fvvPNOBg0aRHZ2Nr179+aSSy6hvLy80TquvfZacnJyeOCBBwAoLS3lggsuoHfv3mRnZ7P77rsza9asRs8hSZKaxuBakiS1OesD6+7duwNwxBFH8MgjjzBlyhRmzJhBZWUl3/nOd3j//fcBmD9/PscccwwjR47kwQcf5G9/+xuHHnooy5cvb/D8N910EzvttBOHHHJI9RIlY8eOrdfvqKOOAhLLh9Q0Y8YMttlmm+rg5M477+Soo45i6NChPPDAA1x++eVMmzaNiy66aIPXWFRUxKGHHsr222/PP//5T+6++25OOOGE6pD83nvvpbCwkB/96EfVNe65557Vx1977bV8+umn/O///i833HBDkz6nhj7n/fbbjx122IGHHnqIvLw8nn/+eUaNGkX37t25++67+f3vf8+sWbOYMGHCBq9FUtMde+yx7Ljjjlx11VUb7LN8+XKGDRvGu+++y9SpU7nzzjtZs2YNBxxwACUlJUBiZvFhhx3G22+/zS233MJ1113HDTfcUC8gXv/LqZtuuolZs2Zx6qmncvnll3PNNdcAsOeeezJlyhQA7rnnHmbPnl3vnrfeuHHjuPPOO4kxVretXr2aWbNmcdxxxwGwdu1aDjjgAB577DGuvfZa7rvvPrp27coBBxzAkiVLNnjNV199NX/729+48soreeyxx/j9739PYWEhFRUVjB07lp///OcA1ffDm266qfrY4uJiTjrpJE455RQefvhhhg4dyqOPPspxxx3Hnnvuyf3338/ZZ5/NlClTOOusszZYw5VXXsnll1/O/fffz2GHHQYkQvnp06dz8cUX8+CDD7LXXntx2GGH8eqrr27wPJIkqWlcKkSSJLUJ62fBLViwgJ/85Cfk5+dzwAEH8PDDD/P888/z1FNPsf/++wMwcuRI+vbty7XXXsvNN9/Mf/7zH/Lz87n22murz3fIIYds8L122WUX2rVrR9euXRtdQqSwsJCDDjqIGTNm1ApuZ8yYwbHHHkt6ejoxRs4//3xOPPHEWkFKdnY2Z555JhdddBGdO3eud+558+axcuVK/vjHP5Kfnw/AgQceWL1/jz32ICMjg169ejVYY/fu3ZkxY0b1dlM+p5ref/99Ro4cyV577cU//vEPsrKyALjwwgv59re/XevcPXv2ZNSoUbzxxhvstttuG/y8JG1cWloaF154IT/60Y+44oor2HHHHev1+d3vfseaNWt49dVX6dSpEwD77rsvffv25ZZbbuHMM89k1qxZ/Pe//+Wll15i6NChAAwdOpS+ffvSv3//6nONGjWKUaNGAYmwe9iwYRQXF/PnP/+Ziy66iIKCAgYOHAgk7jvrZ1s3ZPz48UyePJmXXnqp+r704IMPsnbt2uplnW6//XbeeOMN3nzzTQYMGADAAQccwMCBA/ntb39b6z5d05w5czj++OM56aSTqtvGjRsHQG5ubnVdDd0PS0pKuO666zj88MOr20466SRGjBjBX//6VwAOOuggAC666CIuvfRSevXqVescF198MX/4wx+YNWtW9S8ln3jiCWbOnFnrvnrggQcyb948rrrqquqZ3ZIkqWWccS1JklLesmXLyMzMJDMzk4EDB7JgwQJmzJhBjx49mDNnDl27dq0ODQDatWvHoYceynPPPQfAoEGDWLlyJSeddBKPPvpoqz7U8bjjjuOJJ57giy++AODVV19l3rx51bML582bx8KFCxk3bhzl5eXVr5EjR1JaWsobb7zR4Hn
2021-05-31 20:38:26 +02:00
"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"
]
2021-05-30 15:36:17 +02:00
}
],
"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
}