bayes_project/test.ipynb

304 lines
236 KiB
Plaintext
Raw Normal View History

2021-05-30 15:36:17 +02:00
{
"cells": [
{
"cell_type": "code",
2021-05-31 18:56:34 +02:00
"execution_count": 27,
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-30 15:36:17 +02:00
"#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,70,90,110,130,150,170,190,210,230,250,270]\n",
" labels = ['50-70', '70-90', '90-110','110-130','130-150','150-170','170-190','190-210', '210-230','230-250','250-270']\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",
"#podział danych na treningowy i testowy \n",
"data_train, data_test = train_test_split(data, random_state = 42)\n",
"\n",
"#rozdzielenie etykiet i cech\n",
"X_train =data_train[['gender', 'age', 'bmi','smoking_status', 'work_type','hypertension','heart_disease']]\n",
"Y_train = data_train['stroke']\n",
"\n",
"#rozdzielenie etykiet i cech\n",
"# Dane wejściowe - zbiór danych, wektor etykiet, wektor prawdopodobieństw a priori dla klas.\n",
"\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",
" \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",
" # Suma prawdopodobienstw mozliwych wartosci danej cechy dla danej klasy, powinna sumować się do 1.\n",
"# print(label_probs)\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",
"# print(\"Prawdopodobieństwo a posteriori dla klasy yes-stroke\", final_probs['yes']/final_probs['total'])\n",
"# print(\"Prawdopodobieństwo a posteriori dla klasy no-stroke\", final_probs['no']/final_probs['total'])\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-30 15:36:17 +02:00
"naive_bayes = NaiveBayes(data_train, labels, a_priori_prob)\n",
"posteriori, labels = naive_bayes.count_bayes()"
]
},
{
"cell_type": "code",
2021-05-31 18:56:34 +02:00
"execution_count": 28,
2021-05-30 15:36:17 +02:00
"metadata": {},
"outputs": [],
"source": [
2021-05-31 16:33:55 +02:00
"# plot_priori(labels,posteriori)"
2021-05-30 15:36:17 +02:00
]
},
{
"cell_type": "code",
2021-05-31 18:56:34 +02:00
"execution_count": 29,
2021-05-30 15:36:17 +02:00
"metadata": {},
"outputs": [
{
"data": {
2021-05-31 18:56:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACm/klEQVR4nOzdeZhVxZ3/8Xf1Qi9At2wCsggqoihuIJqISgAVBdeoEGbUYBSdKPNT474El6hRiOMeJBkkjk4EV1CIGh2XmKCiCYnigoAGQRQUpYHuhl7q90c3N73TNL1c8P2apx/71Klz7vfc4Fj3Q92qEGNEkiRJkiRJkqRkkdLSBUiSJEmSJEmSVJHBtSRJkiRJkiQpqRhcS5IkSZIkSZKSis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g0bGu015s2bx2mnnZY4ri24fuqpp/jP//zPRnvdbdEUwbUkSZLUXF544QXmz5/f0mVUsmjRIm644YZqwfXIkSOZN28e2dnZLVNYBW+99RY33HBDS5fR5NJaugBJkqQtSUtL49BDDwXg0EMPpWfPnhx++OHMnTu3Uti8LTbff0sOPPDARnm95lRQUODO85IkSUoq7du3p3v37tx88801ThhJNp06daJTp04tXcZWiTGyceNGMjMzW7qUBnHGtSRJ2u4MGDAAgE8//RSAr776irPOOosOHTqQnZ3NkCFDePvttytdM3v2bAYMGEDr1q1p164dhxxyCK+++mrifMWlQoYMGcI777zD7373u8QSJdOnTwcqL6Xx4IMPkpGRUW02xsKFCwkh8NJLLyXaZs2axcCBA8nMzKRLly5cfvnlFBUV1fmcr7/+Oocffjg5OTnk5ORwwAEH8NhjjyXq+Prrr7nhhhsSNW6efR1C4I477uCiiy6iU6dO9O/fv97vU1UrVqygb9++DB8+nPz8/ERdRx55JNnZ2XTo0IFzzz2XdevW1XkfSZIkqaIQAldffTWzZ8/m3XffrbPvsmXLGDNmDO3btyc7O5tjjjmGjz76qFqfY489lqysLHr37s306dOrLTvy4YcfMmbMGHr06EF2djb77LMPd955J6WlpQC88sorHH/88QD07t2bEAK9evUCqi+l0bt3by6//PJqtZ566qkcfvi/llBZs2YN5513Hp07dyYzM5Pvf//7vPnmm3U+b1FREZdeeik9e/YkIyODXXbZhZNPPplNmzYxffp0JkyYkHgPQwiJZ7z++uvp2LEjr7/+OgcffDCZmZmJzw8zZ86kf//+ZGRk0KNHD6655hqKi4vrrGPSpElkZmYye/ZsAAoLC7n88svp0aMHGRkZ7L///sydO7fOe2wLg2tJkrTd2RxYd+nSBYCTTjqJ559/nsmTJzNjxgxKS0v5wQ9+wOLFiwFYsmQJp556KkOHDuWZZ57hkUceYdSoUaxZs6bG+99///3stddeHHfccYklSkaOHFmt3ymnnAKULR9S0YwZM9h5550TA8iZM2dyyimnMGjQIGbPns3EiROZOnUqV111Va3PmJeXx6hRo9htt9144oknePz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dO5azzjor0Xb66acDkJWVlairps8BBQUF3HHHHZx44omJtrPOOoshQ4bwu9/9DoARI0YAcNVVV3HttdfSvXv3Sve4+uqrueeee5g7d25iMs5LL73EnDlzKn2eOProo1m0aBE333xzYmZ3Y3LGtSRJSnpff/016enppKen07dvX5YuXcqMGTPo2rUrb731Fp06dUoMngBat27NqFGjeP311wHo378/a9eu5ayzzuKFF15o1E0dR48ezUsvvcRXX30FwIIFC1i0aFFilsWiRYtYtmwZp59+OsXFxYmfoUOHUlhYyHvvvVfjfXfffXfatGnD2LFjmTVrVrXlSLak6gzx+rxPm33
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 18:56:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAACexUlEQVR4nOzdeZyWVd348c+ZfQZm2AVkEUTEjVxAtEQlkFAxt0zIUsMSe1L7mam5laCpqWRpakg9SmYlauUGqemTmomhlqW4IIsiKIIiDMzGLOf3xz0zzc4wzHDfwOf9vO7XcJ3rXOf6Xjf49L2/c+5zQowRSZIkSZIkSZJSRVqyA5AkSZIkSZIkqS4L15IkSZIkSZKklGLhWpIkSZIkSZKUUixcS5IkSZIkSZJSioVrSZIkSZIkSVJKsXAtSZIkSZIkSUopSStchxDuCiGsDiG83sz5EEK4NYSwOITwnxDCQds6RkmSJEmtZ44vSZKk9pLMGdezgaNbOH8MMLT6NRX4xTaISZIkSVLbzcYcX5IkSe0gaYXrGONzwNoWupwA3BMTXgS6hhD6bpvoJEmSJG0pc3xJkiS1l4xkB9CCfsD7dY5XVLd92LBjCGEqiRkbdOrUacRee+21TQKUJEnStvPK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HH3/MmWeeSY8ePcjLy2PMmDG8/PLL9a555JFHGDFiBJ06daJbt24ccsghPPvss7Xn6y4VMmbMGF555RV+/etf1y5RMnv2bKD+Uhp333032dnZjWZjLFy4kBACTz/9dG3bww8/zMiRI8nJyaFPnz5ccskllJeXt/iczz//PIcffjgFBQUUFBRwwAEH8MADD9TG8cknnzB9+vTaGGtmX4cQuPnmm7ngggvo1asXw4cPb/X71NDKlSsZNmwYRx11FMXFxbVxHXnkkeTl5dGjRw/OPvtsNmzY0OI4kiRJUl0hBC6//HIeeeQRXnvttRb7Ll++nMmTJ9O9e3fy8vKYMGECb7/9dqM+xxxzDLm5uQwePJjZs2c3WnbkrbfeYvLkyQwYMIC8vDz23Xdffvazn1FVVQXAM888wxe/+EUABg8eTAiBQYMGAY2X0hg8eDCXXHJJo1hPOeUUDj/8v0uorF27lnPOOYfevXuTk5PD5z73Of7xj3+0+Lzl5eVcdNFFDBw4kOzsbHbddVdOOukkNm3axOzZszn//PNr38MQQu0zTps2jZ49e/L8889z8MEHk5OTU/v54f7772f48OFkZ2czYMAArrjiCioqKlqM46abbiInJ4dHHnkEgNLSUi655BIGDBhAdnY2+++/P/PmzWtxjK1h4VqSJG13agrWffr0AeDEE0/kiSeeYMaMGcyZM4eqqio+//nPs3jxYgCWLFnCKaecwtixY3n00Uf57W9/y3HHHcfatWubHP+OO+5gr7324thjj61domTixImN+p188slAYvmQuubMmcMuu+xSm0Def//9nHzyyYwaNYpHHnmEq666ilmzZnHZZZc1+4yFhYUcd9xx7L777vzhD3/gwQcf5PTTT68tkv/pT3+iS5cufOMb36iN8aCDDqq9/qabbuLDDz/kN7/5Dbfeemur3qem3ucjjjiCPfbYg8cee4y8vDz+/ve/M27cOPr06cODDz7Iz372M+bNm8eUKVOafRZJkiSpKV/+8pfZc889ufbaa5vts3btWkaPHs3bb7/NzJkzuf/++ykqKuKoo46ipKQESMwsPv7443nzzTe56667uPnmm7n11lsbFYhrJmXccccdzJs3j7PPPpurrrqKG264AYCDDjqIGTNmAPDHP/6R+fPnN8r1a5x66qncf//9xBhr2zZu3Mi8efOYNGkSAGVlZRx11FH85S9/4aabbuKhhx6iV69eHHXUUaxatarZZ77++uv57W9/yzXXXMNf/vIXfvazn9GlSxcqKyuZOHEi3/ve9wBqPwfccccdtdcWFxdz5pln8s1vfpPHH3+cUaNG8eSTTzJp0iQOOuggHn74Yc4//3xmzJjBeeed12wM11xzDVdddRUPP/wwxx9/PJAoys+ePZvLL7+cRx99lIMPPpjjjz+eV199tdlxtoZLhUiSpO1CzWyApUuX8u1vf5v8/HyOOuooHn/8cf7+97/zzDPPcOSRRwIwduxYBg0axE033cSdd97Jv/71L/Lz87nppptqxzv22GObvdc+++xDp06d6NWrV4tLiHTp0oWjjz6aOXPm1Cvczpkzhy9/+cukp6cTY+Tiiy/mjDPOqJdQZmdnc+6553LZZZfRo0ePRmMvWrSI9evXc9ttt5Gfnw/AF77whdrzBx54IBkZGfTv37/JGPv06cOcOXNqj1vzPtW1ePFixo4dy8EHH8zvf/97srKyALj00kv53Oc+V2/sfv36MW7cOF5//XX222+/Zt8vSZIkqa60tDQuvfRSvvGNb3D11Vez5557Nurz05/+lKKiIl599VW6d+8OwGGHHcagQYO46667OPfcc5k3bx7//ve/+cc//sGoUaMAGDVqFIMGDWLIkCG1Y40bN45x48YBiWL36NGjKS4u5pe//CWXXXYZBQUFDBs2DEjk2zWzrZsyefJkbrzxRv7xj3/U5uOPPvooZWVltcsZ3nvvvbz++ussXLiQoUOHAnDUUUcxbNgwfvKTn9T7fFLXggULOO200zjzzDNr20499VQAcnNza+Nq6nNASUkJN998MyeccEJt25lnnsmYMWP49a9/DcDRRx8NwGWXXcaVV15J//79641x+eWX8/Of/5x58+bVTsZ5+umnmTt3br3PE1/4whdYtGgR1157be3M7vbkjGtJkpTyPvnkEzIzM8nMzGTYsGEsXbqUOXPm0LdvXxYsWECvXr1qkyeATp06cdxxx/H8888DMHz4cNavX8+ZZ57Jk08+2a6bOk6aNImnn36ajz/+GIBXX32VRYsW1c6yWLRoEcuXL+fUU0+loqKi9jV27FhKS0t5/fXXmxx
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 18:56:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAClhUlEQVR4nOzdd5hV1b3/8feaPgMMdQSkCAqi2AWJUVQCqCjYEiPojRpMRG+U/OzdYIkahRh7EHOR5OqN2EElajSWGFHBxESxEEBFEBVEKdOYsn5/zHAylTJMOcD7lWceZq+99j7ffTIki8+ss1aIMSJJkiRJkiRJUrJIaekCJEmSJEmSJEmqyuBakiRJkiRJkpRUDK4lSZIkSZIkSUnF4FqSJEmSJEmSlFQMriVJkiRJkiRJScXgWpIkSZIkSZKUVAyuJUmSJDWKEMLUEMJXIYT36jkfQgh3hBAWhBD+FULYv7lrlCRJ0tbB4FqSJElSY5kGjNjA+aOAvpVf44DfNkNNkiRJ2goZXEuSJElqFDHGV4GVG+hyHPCHWOENoF0IoWvzVCdJkqStSVpLF9DYOnXqFHv16tXSZUiSJKmRvf322ytijHktXYe2SDfgsyrHSyrbltXsGEIYR8WsbFq1ajVgt912a5YCJUmS1Hw2NMbf5oLrXr16MXfu3JYuQ5IkSY0shPBpS9egLRbqaIt1dYwxTgGmAAwcODA6xpckSdr2bGiM71IhkiRJkprLEqBHlePuwOctVIskSZKSmMG1JEmSpOYyEzgtVDgQWBVjrLVMiCRJkrTNLRUiSZIkqWWEEP4IDAE6hRCWABOAdIAY42RgFnA0sAAoAMa2TKWSJElKdgbXkiRJkhpFjPHkjZyPwDnNVI4kSZK2Yi4VIkmSJEmSJElKKgbXkiRJk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9JEmSJEmStlchBK644gpmzpzJu+++u8G+ixcvZsyYMXTo0IGcnByOPPJIPvroo1p9jjrqKLKzs+nduzfTpk2rtezIhx9+yJgxY+jRowc5OTnsscce3HbbbZSXlwPw8ssvc8wxxwDQu3dvQgj06tULqL2URu/evbnkkktq1XriiSdyyCH/WUJl5cqVnHXWWXTu3JmsrCwOOugg3nzzzQ0+b0lJCRdddBE9e/YkMzOTHXfckRNOOIF169Yxbdo0xo8fn3gPQwiJZ7zmmmvo1KkTr732GgcccABZWVmJ3Ozhhx9mr732IjMzkx49enDllVdSWlq6wTomTpxIVlYWM2fOBKCoqIhLLrmEHj16kJmZyT777MOsWbM2eI8tYXC9jVgfWHfp0gWA448/nueee45JkyYxffp0ysvL+d73vseCBQsAWLhwISeeeCJDhw7lqaee4sEHH2TUqFGsXLmyzvvfc8897Lbbbhx99NGJJUpGjhxZq9/3v/99oGL5kKqmT5/ODjvskPiL9PDDD/P973+fQYMGMXPmTCZMmMCUKVO4/PLL633G1atXM2rUKHbeeWcee+wxHn30UU499dRESP7EE0/Qtm1bfvKTnyRq3H///RPXT5w4kWXLlvG///u/3HHHHZv0PtX1Ph966KH06dOHp59+mpycHP72t78xbNgwunTpwqOPPsptt93GrFmzGDt2bL3PIkmSJEmStL374Q9/yK677soNN9xQb5+VK1cyePBgPvroIyZPnszDDz9Mfn4+w4cPp7CwEKiYWXzsscfywQcfMHXqVG699VbuuOOOWgHx+smI99xzD7NmzeLMM89kwoQJ3HzzzQDsv//+TJo0CYDHH3+c2bNn18q41jvppJN4+OGHiTEm2tauXcusWbMYPXo0AMXFxQwfPpw///nPTJw4kSeffJK8vDyGDx/OF198Ue8z33TTTTz44INcf/31/PnPf+a2226jbdu2lJWVMXLkSC688EKARP51zz33JK4tKCjg9NNP56c//SnPPvssgwYN4vnnn2f06NHsv//+zJgxg/HjxzNp0iTOPffcemu4/vrrmTBhAjNmzODYY48FKkL5adOmccUVV/DUU09xwAEHcOyxx/LOO+/Ue58t4VIhW7H1vxVZtGgRP/vZz2jTpg3Dhw/n2Wef5W9/+xsvv/wyhx12GABDhw6lV69eTJw4kXvvvZd//OMftGnThokTJybud/TRR9f7Wv3796dVq1bk5eVtcAmRtm3bMmLECKZPn14tuJ0+fTo//OEPSU1NJcbIxRdfzGmnnVbtL1ZmZibnnHMOl19+OR07dqx17/nz57Nq1Sruuusu2rRpA8ARRxyROL/ffvuRlpZG9+7d66yxS5cuTJ8+PXG8Ke9TVQsWLGDo0KEccMAB/PGPfyQjIwOAyy67jIMOOqjavbt168awYcN477332HPPPet9vyRJkiRJkrZXKSkpXHbZZfzkJz/huuuuY9ddd63V5ze/+Q35+fm88847dOjQAYCDDz6YXr16MXXqVM455xxmzZrFP//5T958800GDRoEwKBBg+jVqxe77LJL4l7Dhg1j2LBhQEXYPXjwYAoKCrjvvvu4/PLLyc3NpV+/fkBFzrR+tnVdxowZwy233MKbb76ZyKGeeuopiouLE8v4PvDAA7z33nvMmzePvn37AjB8+HD69evHr3/962q5XFVvvfUWp5xyCqeffnqi7aSTTgIgOzs7UVdd+VdhYSG33norxx13XKLt9NNPZ8iQIfz+978HYMSIEQBcfvnlXHXVVXTv3r3aPa644gruvPNOZs2alZiE+uKLL/LMM89Uy9GOOOII5s+fzw033JCY2d2YnHG9lfr6669JT08nPT2dfv36sWjRIqZPn07Xrl156623yMvLS/wQAbRq1YpRo0bx2muvAbDXXnuxatUqTj/9dJ5//vlG3dRx9OjRvPjii6xYsQKAd955h/nz5yd+2zR//nwWL17MSSedRGlpaeJr6NChFBUV8d5779V531122YXWrVtzyimnMGPGjFrLkWxMzRnim/I+rffRRx9
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 18:56:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABa4AAAKDCAYAAADy9p1tAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZl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2b69OmMHz++7D0MIZQ948SJE2nXrh2vv/46hx9+OJmZmWW/P8ycOZPevXuTkZFB586dufbaaykqKtpqHZMmTSIzM5PZs2cDUFBQwBVXXEHnzp3JyMjg4IMPZu7cuVu9x44wuJYkSU3OlsC6Q4cOAJx88sk8//zzTJ48mRkzZlBSUsL3v/99lixZAsDSpUs57bTTGDhwIM888wyPPPIIw4cPZ82aNdXe//7772e//fbjhBNOKFuiZNiwYVX6nXrqqUBi+ZDyZsyYwe677142gJw5cyannnoq/fr1Y/bs2UyYMIGpU6dy9dVX1/iM69atY/jw4ey999488cQTPP7445x55pllIflTTz1Fq1at+PGPf1xW42GHHVZ2/aRJk/jss8/43//9X+6+++5avU/Vvc9HH3003bt359lnnyU7O5s///nPDBo0iA4dOvD4449z5513MnfuXMaOHVvjs0iSJEnVOf3009l33325+eaba+yzZs0a+vfvz4cffsiUKVOYOXMmGzduZPDgweTn5wOJmcUjRozg/fffZ9q0adxxxx3cfffdVQLiLZMy7r//fubOnct5553HhAkTuO222wA47LDDmDx5MgBPPvkk8+bNqzLW32LkyJHMnDmTGGNZ24YNG5g7dy6jRo0CYNOmTQwePJg//OEPTJo0iaeffprc3FwGDx7M559/XuMz33rrrTzyyCPcdNNN/OEPf+DOO++kVatWFBcXM2zYMC677DKAst8D7r///rJr8/LyOPvsszn33HN57rnn6NevHy+88AKjRo3isMMOY9asWYwfP57Jkydz0UUX1VjDTTfdxIQJE5g1axYjRowAEqH89OnTueaaa3jmmWc4/PDDGTFiBAsXLqzxPjvCpUIkSVKTsGU2wLJly/jJT35Cy5YtGTx4MM899xx//vOfeeWVVzjmmGMAGDhwIF27dmXSpEk88MAD/O1vf6Nly5ZMmjSp7H4nnHBCja/Vq1cvmjdvTm5u7laXEGnVqhVDhgxhxowZFYLbGTNmcPrpp5OamkqMkZ/+9KecddZZFQaUGRkZXHjhhVx99dW0bdu2yr0XL17M2rVruffee2nZsiUAxx13XNn5Qw89lLS0NDp16lRtjR06dGDGjBllx7V5n8pbsmQJAwcO5PDDD+d3v/sdzZo1A+Cqq67iu9/9boV7d+zYkUGDBvHuu+9y4IEH1vh+SZIkSeWlpKRw1VVX8eMf/5gbb7yRfffdt0qf//7v/2bjxo0sXLiQNm3aAPC9732Prl27Mm3aNC688ELmzp3L3//+d95880369esHQL9+/ejatSv77LNP2b0GDRrEoEGDgETY3b9/f/Ly8vj1r3/N1VdfTU5ODj179gQS4+0ts62rM3r0aG6//XbefPPNsvH4M888w6ZNm8qWM3z44Yd59913WbRoET169ABg8ODB9OzZk1/+8pcVfj8pb/78+YwZM4azzz67rG3kyJEAZGVlldVV3e8B+fn53HHHHZx00kllbWeffTYDBgzgt7/9LQBDhgwB4Oqrr+a6666jU6dOFe5xzTXXcM899zB37tyyyTgvvfQSc+bMqfD7xHHHHcfixYu5+eaby2Z21ydnXEuSpKT31VdfkZ6eTnp6Oj179mTZsmXMmDGDPfbYg/nz55Obm1s2eAJo3rw5w4cP5/XXXwegd+/erF27lrPPPpsXXnihXjd1HDVqFC+99BJffvklAAsXLmTx4sVlsywWL17M8uXLGTlyJEVFRWVfAwcOpKCggHfffbfa++6zzz60aNGCMWPGMGvWrCrLkWxL5RnitXmftvj
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",
" [{'age': {'30-39'}},{'hypertension': {'no'}},{'heart_disease': {'yes'}},{'bmi': {'obesity_2'}},{'avg_glucose_level': {'250-270'}},{'gender': {'female'}},{'smoking_status': {'smokes'}}]\n",
" \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",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
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
}