DSA_SoSe_24/Exploration.ipynb

473 lines
326 KiB
Plaintext
Raw Normal View History

2024-05-08 08:48:17 +02:00
{
"cells": [
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 1,
2024-05-08 08:48:17 +02:00
"id": "37d611da-6f56-46d8-905a-62026750150c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>age</th>\n",
" <th>sex</th>\n",
" <th>cp</th>\n",
" <th>trestbps</th>\n",
" <th>chol</th>\n",
" <th>fbs</th>\n",
" <th>restecg</th>\n",
" <th>thalach</th>\n",
" <th>exang</th>\n",
" <th>oldpeak</th>\n",
" <th>slope</th>\n",
" <th>ca</th>\n",
" <th>thal</th>\n",
" <th>goal</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>63</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>145</td>\n",
" <td>233</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>150</td>\n",
" <td>0</td>\n",
" <td>2.3</td>\n",
" <td>3</td>\n",
" <td>0.0</td>\n",
" <td>6.0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>67</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>160</td>\n",
" <td>286</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>108</td>\n",
" <td>1</td>\n",
" <td>1.5</td>\n",
" <td>2</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>67</td>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>120</td>\n",
" <td>229</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>129</td>\n",
" <td>1</td>\n",
" <td>2.6</td>\n",
" <td>2</td>\n",
" <td>2.0</td>\n",
" <td>7.0</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>37</td>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>130</td>\n",
" <td>250</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>187</td>\n",
" <td>0</td>\n",
" <td>3.5</td>\n",
" <td>3</td>\n",
" <td>0.0</td>\n",
" <td>3.0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>41</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>130</td>\n",
" <td>204</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>172</td>\n",
" <td>0</td>\n",
" <td>1.4</td>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>3.0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" age sex cp trestbps chol fbs restecg thalach exang oldpeak slope \\\n",
"0 63 1 1 145 233 1 2 150 0 2.3 3 \n",
"1 67 1 4 160 286 0 2 108 1 1.5 2 \n",
"2 67 1 4 120 229 0 2 129 1 2.6 2 \n",
"3 37 1 3 130 250 0 0 187 0 3.5 3 \n",
"4 41 0 2 130 204 0 2 172 0 1.4 1 \n",
"\n",
" ca thal goal \n",
"0 0.0 6.0 0 \n",
"1 3.0 3.0 2 \n",
"2 2.0 7.0 1 \n",
"3 0.0 3.0 0 \n",
"4 0.0 3.0 0 "
]
},
2024-06-07 11:20:34 +02:00
"execution_count": 1,
2024-05-08 08:48:17 +02:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2024-06-07 11:20:34 +02:00
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"df = pd.read_csv('./data/dataset_cleaned.csv')\n",
"\n",
"# extract all columns except 'goal' --> X\n",
"X = df.loc[:, df.columns != 'goal']\n",
"# extract only the column 'goal' --> y\n",
"y = df.loc[:, 'goal']\n",
"\n",
"male=1\n",
"female=0\n",
2024-05-08 08:48:17 +02:00
"\n",
"df.head()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 2,
2024-05-08 08:48:17 +02:00
"id": "6b3e5424-4a7e-4e53-82b9-d78e38939834",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGxCAYAAABIjE2TAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAzy0lEQVR4nO3deXxU5d3///cYyCSBZEISkpmUECJGqgZZvbVBS5DNEEAWZa2SW6S2UvqNSFXcCL2VAK0CSt2osigUlFuQymbY4QYtiyCgpUATwJI0ipBJABMg5/eHP6YOCYHgjHMlvJ6Px3k8ONe5znU+J2Fm3jnb2CzLsgQAAGCQawJdAAAAwIUIKAAAwDgEFAAAYBwCCgAAMA4BBQAAGIeAAgAAjENAAQAAxiGgAAAA4xBQAACAcQgogMFeeukl2Ww2paSkBLqUKuXn58tms2nWrFmetuzsbNlsthqNc+rUKWVnZ2vdunU1Wq+qbTVr1kw9e/as0TiXMm/ePE2dOrXKZTabTdnZ2T7dHgACCmC0t956S5K0d+9effLJJwGu5vI8+OCD2rJlS43WOXXqlMaPH1/jgHIl27oS1QWULVu26MEHH/R7DcDVhoACGGrbtm3atWuXMjIyJElvvvlmgCu6PE2aNNFtt93m122cOnXqR9vWpdx2221q0qRJQGsA6iICCmCo84Fk4sSJSk1N1fz58z0fzN/35Zdf6p577lF4eLgiIyM1dOhQbd26tdKpF+m70NO7d29FRUUpJCREbdq00bvvvntZ9Rw9elQDBgxQeHi4HA6HBg4cqMLCwkr9qjrtsmbNGqWlpSk6OlqhoaFq2rSp+vfvr1OnTik/P1+NGzeWJI0fP142m002m02ZmZle4+3YsUP33HOPGjVqpObNm190W+ctWrRIN998s0JCQnTttdfqpZde8lo+a9Ys2Ww25efne7WvW7dONpvNczQnLS1NS5cu1aFDhzy1fX+bVZ3i2bNnj+6++241atRIISEhat26tWbPnl3ldv7yl7/oqaeeUnx8vCIiItSlSxft27evyn0CriYEFMBAp0+f1l/+8hfdcsstSklJ0QMPPKCSkhK99957Xv1OnjypTp06ae3atZo0aZLeffddxcXFaeDAgZXGXLt2rTp06KATJ07otdde0wcffKDWrVtr4MCBlYJMVfV06dJFH330kXJycvTee+/J6XRWuZ0L5efnKyMjQ8HBwXrrrbe0YsUKTZw4UQ0aNFB5eblcLpdWrFghSRo+fLi2bNmiLVu26JlnnvEap1+/frruuuv03nvv6bXXXqt2mzt37lRWVpYeeeQRLVq0SKmpqfp//+//6Y9//OMl673QK6+8og4dOsjpdHpqq+600r59+5Samqq9e/fqpZde0vvvv68bb7xRmZmZmjx5cqX+Tz75pA4dOqQ///nPeuONN7R//3716tVL586dq3GtQJ1iATDOnDlzLEnWa6+9ZlmWZZWUlFgNGza07rjjDq9+f/rTnyxJ1vLly73aH3roIUuSNXPmTE/bT3/6U6tNmzbWmTNnvPr27NnTcrlc1rlz5y5az6uvvmpJsj744AOv9hEjRlTazrhx46zvv7UsXLjQkmTt3LnzouN/9dVXliRr3LhxlZadH+/ZZ5+96LLvS0xMtGw2W6Xtde3a1YqIiLBOnjxpWZZlzZw505Jk5eXlefVbu3atJclau3atpy0jI8NKTEyssvYL6x40aJBlt9utw4cPe/VLT0+3wsLCrBMnTnhtp0ePHl793n33XUuStWXLliq3B1wtOIICGOjNN99UaGioBg0aJElq2LCh7r33Xm3cuFH79+/39Fu/fr3Cw8N11113ea0/ePBgr/kDBw7o73//u4YOHSpJOnv2rGfq0aOHCgoKqj2tsHbtWoWHh6t3795e7UOGDLnkvrRu3VrBwcH65S9/qdmzZ+uf//znJdepSv/+/S+770033aRWrVp5tQ0ZMkRut1s7duy4ou1frjVr1qhz585KSEjwas/MzNSpU6cqHX258Gd68803S5IOHTrk1zoB0xFQAMMcOHBAGzZsUEZGhizL0okTJ3TixAndc889kv5zZ48kHTt2THFxcZXGuLDt3//+tyRpzJgxql+/vtf08MMPS5K+/vrri9Z0se04nc5L7k/z5s21atUqxcbGauTIkWrevLmaN2+uadOmXXLd73O5XJfdt6q6zrcdO3asRtutqWPHjlVZa3x8fJXbj46O9pq32+2SvjutBlzN6gW6AADe3nrrLVmWpYULF2rhwoWVls+ePVvPPfecgoKCFB0drb/97W+V+lx48WpMTIwkaezYserXr1+V223RosVFa7rc7VzMHXfcoTvuuEPnzp3Ttm3b9PLLLysrK0txcXGeo0SXUpNnq1RV1/m284EgJCREklRWVubVr7qgdjmio6NVUFBQqf3o0aOS/vO7AFA9jqAABjl37pxmz56t5s2ba+3atZWmRx99VAUFBVq+fLkkqWPHjiopKfHMnzd//nyv+RYtWig5OVm7du1S+/btq5zCw8MvWlenTp1UUlKiJUuWeLXPmzevRvsXFBSkW2+9VX/6058kyXO6xddHDfbu3atdu3Z5tc2bN0/h4eFq27atpO8e6CZJn332mVe/C/fxfH2XW1vnzp21Zs0aTyA5b86cOQoLCwv4bdFAbcERFMAgy5cv19GjRzVp0iSlpaVVWp6SkqLp06frzTffVM+ePTVs2DBNmTJFv/jFL/Tcc8/puuuu0/Lly7Vy5UpJ0jXX/OdvkNdff13p6enq3r27MjMz9ZOf/ETffPONvvjiC+3YsaPSHULfd//992vKlCm6//779fzzzys5OVnLli3zbKc6r732mtasWaOMjAw1bdpU3377rec0VZcuXSRJ4eHhSkxM1AcffKDOnTsrKipKMTExnhBRU/Hx8erdu7eys7Plcrn0zjvvKDc3V5MmTVJYWJgk6ZZbblGLFi00ZswYnT17Vo0aNdKiRYu0adOmSuO1bNlS77//vl599VW1a9dO11xzjdq3b1/ltseNG6cPP/xQnTp10rPPPquoqCjNnTtXS5cu1eTJk+VwOK5on4CrTqCv0gXwH3369LGCg4OtoqKii/YZNGiQVa9ePauwsNCyLMs6fPiw1a9fP6thw4ZWeHi41b9/f2vZsmVV3nWza9cua8CAAVZsbKxVv359y+l0WnfeeafnbqHqfPnll1b//v29trN58+ZL3sWzZcsWq2/fvlZiYqJlt9ut6Ohoq2PHjtaSJUu8xl+1apXVpk0by263W5KsYcOGeY331VdfVarpYnfxZGRkWAsXLrRuuukmKzg42GrWrJn14osvVlr/H//4h9WtWzcrIiLCaty4sTVq1Chr6dKlle7i+eabb6x77rnHioyMtGw2m9c2VcXdR7t377Z69eplORwOKzg42GrVqpXXz8iy/nMXz3vvvefVnpeXV+lnClyNbJZlWQHKRgD8ZMKECXr66ad1+PBhnnIKoFbiFA9Qy02fPl2S9NOf/lRnzpzRmjVr9NJLL+kXv/gF4QRArUVAAWq5sLAwTZkyRfn5+SorK1PTpk31+OOP6+mnnw50aQBwxTjFAwAAjMNtxgAAwDgEFAAAYBwCCgAAME6tvEi2oqJCR48eVXh4eI0efw0AAALHsiyVlJQoPj7e60GSVamVAeXo0aOVvikUAADUDkeOHLnkYxBqZUA5/50hR44cUURERICrAQAAl8PtdishIaHa7/46r1YGlPOndSIiIggoAADUMpdzeQYXyQIAAOMQUAAAgHEIKAAAwDi18hqUy2FZls6ePatz584FuhRICgoKUr169bgtHABwWepkQCkvL1dBQYFOnToV6FLwPWFhYXK5XAoODg50KQAAw9W5gFJRUaG8vDwFBQUpPj5ewcHB/NUeYJZlqby8XF999ZXy8vKUnJx8yQf0AACubnUuoJSXl6uiokIJCQkKCwsLdDn4/4WGhqp+/fo6dOiQysvLFRISEuiSAAAGq7N/xvIXunn4nQAALhefGAAAwDgEFAAAYJw6dw1KdZo9sfRH3V7+xIwa9U9LS1Pr1q01depU/xQ
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"\n",
2024-06-07 11:20:34 +02:00
"counts_male = sum(X['sex'] == male)\n",
"counts_female = sum(X['sex'] == female)\n",
"\n",
"counts_male_sick = sum(np.all([X['sex'] == male,\n",
" y > 0], axis=0))\n",
"counts_female_sick = sum(np.all([X['sex'] == female,\n",
" y > 0], axis=0))\n",
2024-05-08 08:48:17 +02:00
"\n",
"plt.bar([male, female], [counts_male, counts_female])\n",
2024-06-07 11:20:34 +02:00
"plt.bar([male, female], [counts_male_sick, counts_female_sick])\n",
"plt.xticks([male, female],['male', 'female'])\n",
2024-05-08 08:48:17 +02:00
"plt.title('Age distribution')\n",
2024-06-07 11:20:34 +02:00
"plt.legend(['healthy', 'sick'])\n",
2024-05-08 08:48:17 +02:00
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 3,
2024-05-08 08:48:17 +02:00
"id": "48fd2655-1dcc-41f6-9938-ef6ea937d52e",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAt00lEQVR4nO3de1TVdb7/8dcudQsKpKZ7Q6GScrS8l46JY5IXyug2mmnapMdsLG2SrKWRldgqUOdkVk6Y5gVXmZWj5RzzQkelC3ZEG5KoMfuJSqMMZdzygqmf3x8t93EHXiDwuz/4fKz1Xcvv5/PZ3+97f4YVr/l8L7iMMUYAAACWusTpAgAAAH4LwgwAALAaYQYAAFiNMAMAAKxGmAEAAFYjzAAAAKsRZgAAgNUIMwAAwGqEGQAAYDXCDFBHv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lyo4ONjxR8kBW7AyA1hq7dq12r9/v2bOnKnY2NgK/R07dtTcuXO1cOFC3XrrrRo1apRefPFF3XvvvXruuefUtm1brV27VuvXr5ckXXLJ//1/m9dee02DBg3STTfdpNGjR+uKK67Qjz/+qK+//lqff/55hSelTnfffffpxRdf1H333afnn39e0dHR+uCDD3znOZt58+Zp48aNio+PV8uWLXX06FHfpbIBAwZIkkJCQtSqVSu9//776t+/v5o2barLL7/cFziqKiIiQrfffruSkpIUHh6uN954Q+np6Zo5c6aCg4MlST169FC7du30+OOP6/jx42rSpIlWrVqlTz75pMLxOnXqpJUrVyo1NVXXXXedLrnkEnXv3r3Sc0+bNk3//d//rRtvvFHPPPOMmjZtqjfffFNr1qzRrFmzFBYWVq3vBFx0nL4DGUD13HnnnaZBgwamsLDwjGOGDx9u6tWrZwoKCowxxuzbt88MHjzYNG7c2ISEhJghQ4aYDz74oNKnj7744gtz9913mxYtWpj69esbr9dr+vXr53tq6my+++47M2TIEL/zZGZmnvNppi1btpg//OEPplWrVsbtdptmzZqZvn37mtWrV/sd/8MPPzTdunUzbrfbSDKjRo3yO973339foaYzPc0UHx9vVqxYYTp06GAaNGhgWrdubWbPnl3h8998842Ji4szoaGhpnnz5ubPf/6zWbNmTYWnmX788Udz1113mcsuu8y4XC6/c6qSp7BycnLMbbfdZsLCwkyDBg1Mly5d/ObImP97mundd9/1a8/Ly6swp8DFyGWMMQ7lKAABIDk5WU899ZT27dvH22kBWInLTMBFZO7cuZKk9u3b6+eff9bGjRv18ssv69577yXIALAWYQa4iAQHB+vFF1/Unj17VF5erpYtW2rKlCl66qmnnC4NAKqNy0wAAMBqPJoNAACsRpgBAABWI8wAAACr1fkbgE+ePKn9+/crJCSkSq84BwAAzjHGqKysTBEREX4v9axMnQ8z+/fvr/AXaQEAgB3y8/PP+eqIOh9mTv0Nmfz8fIWGhjpcDQAAOB+lpaWKjIw869+CO6XOh5lTl5ZCQ0MJMwAAWOZ8bhHhBmAAAGA1wgwAALAaYQYAAFiNMAMAAKxGmAEAAFYjzAAAAKsRZgAAgNUIMwAAwGqEGQAAYDXCDAAAsBphBgAAWI0wAwAArEaYAQAAViPMAAAAqxFmAACA1eo5XQAAXGxaP7HG6RKqbM+MeKdLAM6IlRkAAGA1wgwAALAaYQYAAFiNMAMAAKxGmAEAAFYjzAAAAKsRZgAAgNUIMwAAwGqEGQAAYDXCDAAAsBphBgAAWM3xMPOvf/1L9957r5o1a6bg4GB17dpV27dv9/UbY5SUlKSIiAgFBQUpNjZWubm5DlYMAAA
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.hist(X['age'])\n",
"plt.xlabel('Age')\n",
"plt.ylabel('counts')\n",
"plt.title('Age distribution')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 4,
2024-05-08 08:48:17 +02:00
"id": "b9174a9d-6c8a-4915-9580-48f23cbdd038",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB9VklEQVR4nO3dd3xT9f7H8ddJ0qR70EIHo5Q9CjJFhjIUlOFeIA4ExCtDhoKAgBWFMhRQURSuIl7lel38HKjgAFSGMpUlILOMUgrdadKM8/sjJFr2aHsyPs/HIw/NSZq8aZvk3XO+5/tVVFVVEUIIIYTwUTqtAwghhBBCXA0pM0IIIYTwaVJmhBBCCOHTpMwIIYQQwqdJmRFCCCGET5MyI4QQQgifJmVGCCGEED5NyowQQgghfJqUGSGEEEL4NCkzQviJV199FUVRSE1N1TrKOR04cABFUXj33Xc929LS0lAU5bIex2w2k5aWxsqVKy/r6871XDVr1qRXr16X9TgXs3jxYubMmXPO2xRFIS0trUyfTwghZUYIv/HOO+8AsH37dn799VeN01yagQMHsnbt2sv6GrPZzPPPP3/ZZeZKnutKXKjMrF27loEDB5Z7BiECjZQZIfzAhg0b+P333+nZsycAb7/9tsaJLk21atW47rrryvU5zGZzhT3XxVx33XVUq1ZN0wxC+CMpM0L4AXd5mTZtGu3atePDDz/0fIj/0+HDh7nnnnuIiIggOjqavn37sn79+rMO/4CrIN12221UqlSJ4OBgmjdvzkcffXRJeY4ePcp9991HREQEUVFR3H///WRmZp51v3Md+vnxxx/p1KkTsbGxhISEUKNGDe6++27MZjMHDhygcuXKADz//PMoioKiKPTr16/U423atIl77rmHmJgYateufd7ncluyZAlNmzYlODiYWrVq8eqrr5a6/d1330VRFA4cOFBq+8qVK1EUxbOXqFOnTixdupSDBw96sv3zOc91mGnbtm3cfvvtxMTEEBwcTLNmzVi0aNE5n+e///0vzz77LElJSURGRnLTTTexa9euc/6bhAgkUmaE8HHFxcX897//pXXr1qSmptK/f38KCgr4+OOPS92vqKiIzp07s2LFCqZPn85HH31EfHw8999//1mPuWLFCtq3b09ubi5vvvkmn3/+Oc2aNeP+++8/q/ScK89NN93E8uXLSU9P5+OPPyYhIeGcz3OmAwcO0LNnT4xGI++88w7ffvst06ZNIywsjJKSEhITE/n2228BGDBgAGvXrmXt2rVMnDix1OPcdddd1KlTh48//pg333zzgs+5ZcsWRowYwciRI1myZAnt2rVj+PDhvPTSSxfNe6Y33niD9u3bk5CQ4Ml2oUNbu3btol27dmzfvp1XX32Vzz77jEaNGtGvXz9mzJhx1v3Hjx/PwYMH+fe//838+fPZs2cPt956Kw6H47KzCuFXVCGET3vvvfdUQH3zzTdVVVXVgoICNTw8XL3++utL3e/1119XAfWbb74ptf3xxx9XAXXhwoWebQ0aNFCbN2+u2my2Uvft1auXmpiYqDocjvPmmTdvngqon3/+eantjz322FnP89xzz6n/fBv65JNPVEDdsmXLeR//xIkTKqA+99xzZ93mfrxJkyad97Z/Sk5OVhVFOev5unbtqkZGRqpFRUWqqqrqwoULVUDdv39/qfutWLFCBdQVK1Z4tvXs2VNNTk4+Z/Yzc/fu3Vs1mUzqoUOHSt2ve/fuamhoqJqbm1vqeXr06FHqfh999JEKqGvXrj3n8wkRKGTPjBA+7u233yYkJITevXsDEB4ezr333svPP//Mnj17PPdbtWoVERER3HLLLaW+vk+fPqWu//XXX/z555/07dsXALvd7rn06NGDY8eOXfDQxooVK4iIiOC2224rtf2BBx646L+lWbNmGI1GBg0axKJFi9i3b99Fv+Zc7r777ku+b+PGjbnmmmtKbXvggQfIz89n06ZNV/T8l+rHH3/kxhtvpHr16qW29+vXD7PZfNZenTO/p02bNgXg4MGD5ZpTCG8nZUYIH/bXX3/x008/0bNnT1RVJTc3l9zcXO655x7g7zOcAE6ePEl8fPxZj3HmtuPHjwPw9NNPExQUVOoyePBgALKzs8+b6XzPk5CQcNF/T+3atfn++++pUqUKQ4YMoXbt2tSuXZtXXnnlol/7T4mJiZd833Plcm87efLkZT3v5Tp58uQ5syYlJZ3z+WNjY0tdN5lMgOvQnhCBzKB1ACHElXvnnXdQVZVPPvmETz755KzbFy1axIsvvoheryc2NpbffvvtrPucOTA3Li4OgHHjxnHXXXed83nr169/3kyX+jznc/3113P99dfjcDjYsGEDr732GiNGjCA+Pt6z9+liLmfumnPlcm9zl4fg4GAArFZrqftdqNRditjYWI4dO3bW9qNHjwJ//yyEEBcme2aE8FEOh4NFixZRu3ZtVqxYcdblqaee4tixY3zzzTcAdOzYkYKCAs91tw8//LDU9fr161O3bl1+//13WrVqdc5LRETEeXN17tyZgoICvvjii1LbFy9efFn/Pr1eT5s2bXj99dcBPId8ynpvxPbt2/n9999LbVu8eDERERG0aNECcE2uB/DHH3+Uut+Z/0Z3vkvNduONN/Ljjz96yovbe++9R2hoqOankgvhK2TPjBA+6ptvvuHo0aNMnz6dTp06nXV7amoqc+fO5e2336ZXr1488sgjzJ49mwcffJAXX3yROnXq8M0337Bs2T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QQvg0KTNCCCGE8GlSZoQQQgjh06TMCCGEEMKnSZkRQgghhE+TMiOEEEIIn+b3q2aLwLJixQp+/fVXmjdvzs0336x1HCGEEBVAUVVV1TpEecrPzycqKoq8vDwiIyO1jiPKkaqqdO3aFbvdDsCyZcswmUwapxJCCHElLufzWw4zCb9RXFzsKTIAhYWFGqYRQpQ1VVXJyMjA6XRqHUV4GSkzwm8
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ax = sns.violinplot(X, x='sex', y='age')\n",
"ax.set_xticklabels(['male', 'female'])\n",
"plt.title('Age distribution')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 5,
2024-05-08 08:48:17 +02:00
"id": "522ff499-cd7f-4417-ae7d-d637402505b8",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAzQklEQVR4nO3de1hVZf7//9dWYHMQUVHZoqhYmCVKpWVYEyqBqdnBsSybScvmW4IWaZmUJfoxSSrHyrRsJnWmzOYzaSfLQ6lMRY6kmYfUDqJiSVQq4AlU7t8f/dwfd+AJN+7t3fNxXeu6XPe611rvtdcGXt5rrb0dxhgjAAAAS9XxdQEAAAC1ibADAACsRtgBAABWI+wAAACrEXYAAIDVCDsAAMBqhB0AAGA1wg4AALAaYQcAAFiNsAOcJWvXrtWdd96p2NhYBQcHq169err00kuVk5OjXbt2ufu1bt1a1113ndf2u3XrVjkcDs2aNctr2zxWXl6esrKytGfPnlrZ/uDBg9W6deta2faxli9fLofDoeXLl5/Rvn/44QdlZWVpz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qwYIHy8/M1fvx41atXTzk5Obrpppu0efNmtWnT5rjr/fjjj0pKSlJgYKCmTZumqKgovfbaa6d0b8xnn32mAQMGaMCAAcrKylJwcLC2bdumpUuXSpIuvfRSzZw50328Ry8JtWjRosbH+c4772jZsmUaP368wsLCNG3aNN12220KCAhQ//79T1rzsebPn6/+/fsrIiJC06ZNk6RqA/hRubm5SklJUceOHfX3v/9dTqdT06ZNU9++ffX6669rwIABHv3vvvtu9enTR3PmzFFhYaEeeugh/elPf3K/PoDPGAC1pqioyEgyt9566ymv06pVKxMcHGy2bdvmbjtw4IBp1KiRueeee9xtt956q3E6nWb79u0e6/fq1cuEhoaaPXv2GGOMKSgoMJLMzJkz3X169uxpWrRoYUpKSjzWHTZsmAkODja7du0yxhhz3XXXmYsvvviE9T711FNGkikoKPBo3759uwkICDDDhw/3aC8rKzMul8vccsst7rZBgwYZSeaVV16psv1BgwaZVq1aebRJMlFRUaa0tNTdVlRUZOrUqWOys7NPWO/DDz9sHA6HWbNmjUd7SkqKkWSWLVt23H0//fTTRpL7ta1Ofn5+ldf7TI4zJCTEFBUVudsOHz5s2rVrZ84//3x329ixY011v85nzpxZ5dy0b9/eJCUlVelb3fvkiiuuME2bNjVlZWUe+4+PjzctWrQwlZWVHvtJS0vz2GZOTo6RZHbu3Fllf8DZxGUswA9dfPHFatmypXs+ODhYbdu21bZt29xtS5cuVXJycpURo8GDB2v//v367LPPqt32wYMH9dFHH+mmm25SaGioDh8+7J569+6tgwcPasWKFZKkyy+/XF9++aXS0tK0aNEilZaWnvIxLFq0SIcPH9Ydd9zhsY/g4GAlJSV5XOo66o9//OMpb7979+4KDw93z0dFRalp06Yer1F1li1bpvbt2yshIcGjfeDAgSfd59FLVLfccov+9a9/6fvvvz/leo91OseZnJysqKgo93zdunU1YMAAffvtt9qxY0eN9n8q9u3bp//+97/q37+/6tWr57H/P//5z9qxY4c2b97ssc5vL8d27NhRkk56ToDaRtgBalHjxo0VGhqqgoKC01ovMjKySpvT6dSBAwfc87/88ov7stGxoqOj3cur88svv+jw4cN6/vnnFRgY6DH17t1bkvTzzz9LkjIzM/X0009rxYoV6tWrlyIjI5WcnKzPP//8pMfw448/Svo1IPx2P2+88YZ7H0eFhoaqfv36J93uUafyGlXnl19+kcvlqtJeXdtvXX311XrrrbfcIa5FixaKj4/X66+/fsp1n+5xnqjW451jb9i9e7eMMaf1HvvtOTl6iexk5wSobdyzA9SiunXrKjk5WR988IF27Njhce/GmYqMjNTOnTurtB+9IbRx48bVrtewYUP3/87T09Or7RMbGytJCggI0IgRIzRixAjt2bNHH374oR555BH17NlThYWFCg0NPW59R/f/73//W61atTrp8VR3g21tiIyMVFFRUZX26tqqc8MNN+iGG25QeXm5VqxYoezsbA0cOFCtW7dWYmLiSdc/3eM8Ua1Hw0VwcLAkqby83OMenN8GytPRsGFD1alTp0bvMcDfMLID1LLMzEwZY/SXv/xFFRUVVZYfOnRI77777mlvNzk5WUuXLq3ytMs//vEPhYaGHvcx4tDQUHXv3l1ffPGFOnbsqM6dO1eZqhs1adCggfr376/09HTt2rXL/YTP8f733rNnTwUEBOi7776rdh+dO3c+7WP2hu7du2vDhg368ssvPdrnzJlzWttxOp1KSkrSpEmTJMn9hJm3RzM++ugj9yiZ9OtN72+88YbOO+88d3g++kTV2rVrPdat7n11KqNfkhQWFqYuXbpo3rx5Hv0rKyv16quvqkWLFmrbtm1NDgk46xjZAWpZYmKipk+frrS0NHXq1ElDhw5V+/btdejQIX3xxReaMWOG4uPj1bdv39Pa7tixY/Xee++pe/fuevzxx9WoUSO99tprWrBggXJychQREXHcdZ999lldddVV+sMf/qChQ4eqdevWKisr07fffqt3333X/fRM3759FR8fr86dO6tJkybatm2bpkyZolatWikuLk6S1KFDB/c2Bw0apMDAQF1wwQVq3bq1xo8fr0cffVRbtmzRtddeq4YNG+rHH3/UypUrFRYWpnHjxtXwVa25jIwMvfLKK+rTp48mTJjgfhpr06ZNJ1338ccf144dO5ScnKwWLVpoz549evbZZxUYGKikpCRJv342T0hIiF577TVdeOGFqlevnqKjo92Xfk5X48aN1aNHDz322GPup7E2bdrk8fh579691ahRIw0ZMkTjx49XQECAZs2apcLCwirb69Chg+bOnas33nhDbdq0UXB
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ax = plt.hist(X['chol'])\n",
"plt.xlabel('Cholesterin')\n",
"plt.ylabel('counts')\n",
"plt.title('Cholesterin distribution')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 6,
2024-05-08 08:48:17 +02:00
"id": "f220fadf-33ec-4bf6-a225-a2c874f02088",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA+A0lEQVR4nO3de1yUdf7//+d4YACF8YQMKCqueMhjm6aSCVqQh9SyLcsOmtW3RHPVLY+V1BaUpVFranortTVrt1IzNRVLyY1c0fTjqcxNPBVEGQKeAOX9+6Mfs46AAovOXPa4327X7ea8r/e8r9e8GZ2n7+u6GJsxxggAAMCiqnm6AAAAgP8FYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQaQtHDhQtlsNrctKChI0dHRWrlyZYn+NptN8fHxV7zOgwcPymazaeHChVf82L9nF/68i98vBw8erNA4CQkJWr58eYWeU9qxoqOj1a5duwqNcymrV68u8z3drFkzDR8+vEqPB1QlwgxwngULFuirr75Samqq5s2bp+rVq2vAgAH65JNPPF0avEj//v311VdfKSQkpELPq0yYqeyxKmr16tV69tlnS923bNkyPf3005f1+MD/ooanCwC8Sbt27dS5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Rjxgw5nU6tXbtWY8aM0S+//KJp06aVOZ4xRrfddptSU1P1zDPPqEuXLvryyy/Vt2/fS9Zy8uRJxcTEKDw8XG+88YaCg4OVmZmpDRs2KC8vT5L01VdfqXfv3urVq5frlE1gYKDbOCNGjFD//v3197//XSdPnrxoiM7MzNTdd9+tSZMm6bnnntOqVav0/PPPKzs7W7NmzSrPFLo8/fTTOnnypD788EN99dVXrvayTm2V931c7I033lDr1q2VlJTkOl6/fv2Unp4uh8NRoVqBUhkAZsGCBUZSic1ut5vZs2eX6C/JTJs2zfX47rvvNna73Rw+fNitX9++fY2/v785fvy4McaYSZMmGUnm3//+t1u/kSNHGpvNZvbt22eMMWbOnDlGkvn444/d+j3yyCNGklmwYEG5Xs/tt9/u1v7ll18aSeb55593tUVFRRlJ5rPPPnPrm5iYaKpVq2bS0tLc2j/88EMjyaxevdoYY8wrr7xiJLleY2luvfVW06lTp4vWPGzYMNO0adMS7dOmTTMX/lMlyTgcDvPrr7+6td9yyy2mcePGJicnx6199OjRxtfXt0T/83366adGknnttdfc2l944YUSP+/i+U1PTzfGGLN161YjySxfvvyir7FWrVpm2LBhJdqLx3vggQfK3Fd8LGP++zMr7f1RrVo1c+jQIWOMMRs2bDCSzIYNG9z6paenl3gfjRo1qsQ8F2vatKlb3eV9Hxcfp3379ubs2bOuflu2bDGSzHvvvVfq8YCK4jQTcJ533nlHaWlpSktL06effqphw4Zp1KhRl/yf7ueff66bbrpJYWFhbu3Dhw/XqVOnXP/b/fzzz3XNNdfo+uuvL9HPGONazdiwYYMCAgI0cOBAt36XWiG60L333uv2ODIyUk2bNtWGDRvc2uvWravevXu7ta1cuVLt2rVTp06ddPbsWdd2yy23uJ266NKliyTprrvu0j//+U/98MMPJeq4/vrr9X//93+Ki4vT2rVrlZubW6HXUZrevXurbt26rsdnzpzRZ599pttvv13+/v5uNffr109nzpy56KmN4jm5cM7KM+ctWrRQ3bp1NXHiRM2dO1d79+6t1Gu64447yt23rPdHUVGRvvjii0odv7zK+z4u1r9/f1WvXt31uEOHDpKkQ4cOXdY68ftBmAHO06ZNG3Xu3FmdO3dWnz599Oabbyo2NlYTJky46CmRY8eOlbokHxoa6tpf0X7BwcEl+jmdzgq9ntL6O51O13GKlVbTTz/9pJ07d6pmzZpuW0BAgIwx+uWXXyRJPXv21PLly3X27Fk98MADaty4sdq1a6f33nvPNdbkyZP1yiuvaPPmzerbt6/q16+vm266SVu3bq3Q67lYzceOHdPZs2f1t7/9rUTN/fr1kyRXzaU5duyYatSoofr167u1l2fOHQ6HUlJS1KlTJ02ZMkVt27ZVaGiopk2bpsLCwkq/pou52Pvjwp9vVSvv+7jYhXNqt9sl/XY6FagKXDMDXEKHDh20du1afffddyX+J1qsfv36ysjIKNH+448/SpIaNGhQ4X5btmwp0a+8FwBfrH9mZqZatGjh1nbhBbbFtfj5+entt98udeziWiVp0KBBGjRokPLz87V582YlJiZq6NChatasmbp3764aNWpo/PjxGj9+vI4fP67169drypQpuuWWW3TkyBH5+/vL19dX+fn5JY5TVgC5sOa6deuqevXquv/++zVq1KhSnxMeHl5qu/TbnJ89e1bHjh1z+/At75y3b99e77//vowx2rlzpxYuXKjnnntOfn5+mjRpUrnGKO3nUJaffvqpRFtxrcX1+/r6SlKJeb1YqCuP8r6PgSuFlRngEnbs2CFJF7099qabbtLnn3/u+se82DvvvCN/f39169bN1W/v3r36+uuvS/Sz2Wzq1auXJKlXr17Ky8vTihUr3PotWbKkQrW/++67bo9TU1N16NAh1100F3Prrbfq+++/V/369V2rVedvpd15ZLfbFRUVpZdeeknSb3f4XKhOnTr605/+pFGjRunXX391u2MmKyvL7UO6oKBAa9euLddr9ff3V69evbR9+3Z16NCh1JovXCE4X/HcXzhnFZ1zm82mjh076tVXX1WdOnXcftZ2u73KViPKen9Uq1ZNPXv2lCTXz2jnzp1u/S58XnFtUvlWS8r7PgauFFZmgPPs3r1bZ8+elfTbUvnSpUuVnJys22+//aL/q582bZpWrlypXr166ZlnnlG9evX07rvvatWqVZo+fbrrjo1x48bpnXfeUf/+/fXcc8+padOmWrVqlWbPnq2RI0eqZcu
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.hist(X['trestbps'])\n",
"plt.xlabel('Blood pressure (rest)')\n",
"plt.ylabel('counts')\n",
"plt.title('Blood pressure distribution')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 7,
2024-05-08 08:48:17 +02:00
"id": "f568c911-d961-4d7f-87b1-f25dd5403cff",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAGxCAYAAACEFXd4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA5hklEQVR4nO3dfVxUdf7//+eIDILhyIWKKIqlpS6opWaRpqRJmBKZaeua1lrb5kWLom7mltaWtJZpK9mF+cnS0v2uKRZZppsprpaKmVFetmiYkHnFhVzJzPn90c/ZJrRlZGDw8LjfbnPT836/58zrcLvJPH2f9znHYhiGIQAAAJNq4O0CAAAAahJhBwAAmBphBwAAmBphBwAAmBphBwAAmBphBwAAmBphBwAAmBphBwAAmBphBwAAmBphB6hnlixZIovF4vJq1qyZ+vXrp/T09ErjLRaLZs2aVet1Hj58WBaLRUuWLKn1zwZgLoQdoJ564403tG3bNm3dulWvvfaafHx8NGTIEL3//vveLg0APKqhtwsA4B1RUVHq0aOHc/u2225TUFCQli9friFDhnixstpVXFysgIAAb5dRZYZhqLS0VP7+/t4uBbhsMLMDQJLUqFEjWa1W+fr6/s+xWVlZuuOOOxQUFKRGjRqpW7duevPNNyuN++677zRq1Cg1b95cfn5+6tSpk+bOnSuHw+Ey7tixYxo+fLgCAwNls9k0YsQI5eXlVanu86fl1q9fr/vvv1/BwcFq3LixhgwZov/85z8uY/v166eoqCht3rxZMTExCggI0O9//3tJUkFBgaZMmaJ27drJarWqVatWSkpK0tmzZ1328c9//lO9evWSzWZTQECArrzySuc+JMnhcOjpp5/WNddcI39/fzVt2lRdunTRiy++6Bxz3333KTIystKxzJo1SxaLxaXNYrFowoQJeuWVV9SpUyf5+fk5f9YHDx7UyJEjXX6+L730UpV+bkB9wswOUE/Z7XZVVFTIMAz98MMPeu6553T27FmNHDnyV9+3f/9+xcTEqHnz5vr73/+ukJAQLVu2TPfdd59++OEHTZs2TZL0448/KiYmRuXl5frrX/+qyMhIpaena8qUKfr222+1cOFCSVJJSYkGDBigY8eOKSUlRVdffbU++OADjRgxwq3jGTt2rG699Va98847ysnJ0V/+8hf169dPe/bsUdOmTZ3jcnNzNWrUKE2bNk2zZ89WgwYNVFxcrL59++ro0aN67LHH1KVLF3399dd64okn9NVXX2nDhg2yWCzatm2bRowYoREjRmjWrFlq1KiRjhw5ok8++cS5/zlz5mjWrFn6y1/+optvvlnnzp3Tvn37dObMGbeO5+fS0tKUkZGhJ554QmFhYWrevLm++eYbxcTEqE2bNpo7d67CwsK0bt06PfLIIzpx4oRmzpx5yZ8HmI4BoF554403DEmVXn5+fsbChQsrjZdkzJw507l9zz33GH5+fsZ3333nMi4+Pt4ICAgwzpw5YxiGYTz66KOGJOPzzz93Gffwww8bFovF2L9/v2EYhvHyyy8bkow1a9a4jHvwwQcNScYbb7xRpeO58847Xdr//e9/G5KMp59+2tnWt29fQ5Lxr3/9y2VsSkqK0aBBA2PHjh0u7StXrjQkGWvXrjUMwzCef/55Q5LzGC9k8ODBRrdu3X615jFjxhht27at1D5z5kzjl7+WJRk2m804deqUS3tcXJzRunVrIz8/36V9woQJRqNGjSqNB+ozTmMB9dRbb72lHTt2aMeOHfrwww81ZswYjR8/Xqmpqb/6vk8++UT9+/dXRESES/t9992n4uJibdu2zTmuc+fOuv766yuNMwzDORuyceNGBQYGKiEhwWXc/5ph+qXf/e53LtsxMTFq27atNm7c6NIeFBSkW265xaUtPT1dUVFR6tatmyoqKpyvuLg4WSwWffrpp5Kknj17SpKGDx+u//f//p++//77SnVcf/31+vLLLzVu3DitW7dOBQUFbh3Hhdxyyy0KCgpybpeWlupf//qX7rzzTgUEBLjUPGjQIJWWluqzzz6r9ucCZkHYAeqpTp06qUePHurRo4duu+02vfrqqxo4cKCmTZv2q6dcTp48qZYtW1ZqDw8Pd/a7O65FixaVxoWFhbl1PBcaHxYW5vyc8y5U0w8//KA9e/bI19fX5RUYGCjDMHTixAlJ0s0336y0tDRVVFRo9OjRat26taKiorR8+XLnvqZPn67nn39en332meLj4xUSEqL+/ftr586dbh3Pr9V88uRJVVRUaMGCBZVqHjRokCQ5awbAmh0AP9OlSxetW7dOBw4cqDQjc15ISIhyc3MrtR87dkySFBoa6va47du3VxpX1QXKvzY+Ly9P7du3d2n75QLg87X4+/vr//7v/y647/O1StIdd9yhO+64Q2VlZfrss8+UkpKikSNHKjIyUjfeeKMaNmyoyZMna/LkyTpz5ow2bNigxx57THFxccrJyVFAQIAaNWqksrKySp9zsYDyy5qDgoLk4+Oje++9V+PHj7/ge9q1a3fBdqA+YmYHgNPu3bslSc2aNbvomP79++uTTz5xhpbz3nrrLQUEBOiGG25wjvvmm2+0a9euSuMsFotiY2MlSbGxsSosLNR7773nMu6dd95xq/a3337bZXvr1q06cuSI+vXr9z/fO3jwYH377bcKCQlxznb9/HWhK6f8/PzUt29f/e1vf5MkffHFF5XGNG3aVMOGDdP48eN16tQpHT58WJIUGRmp48eP64cffnCOLS8v17p166p0rAEBAYqNjdUXX3yhLl26XLDmkJCQKu0LqA+Y2QHqqaysLFVUVEj66bTIqlWrtH79et15552/Oiswc+ZMpaenKzY2Vk888YSCg4P19ttv64MPPtCcOXNks9kkSZMmTdJbb72l22+/XU899ZTatm2rDz74QAsXLtTDDz+sq6++WpI0evRozZs3T6NHj9YzzzyjDh06aO3atVX+4j9v586deuCBB3T33XcrJydHM2bMUKtWrTRu3Lj/+d6kpCS9++67uvnmmzVp0iR16dJFDodD3333nT7++GMlJyerV69eeuKJJ3T06FH1799frVu31pkzZ/Tiiy/K19dXffv2lSQNGTLEeQ+jZs2a6ciRI5o/f77atm2rDh06SJJGjBihJ554Qvfcc4+mTp2q0tJS/f3vf5fdbq/y8b744ovq3bu3+vTpo4cffliRkZEqLCzUoUOH9P7777tcIQbUe95eIQ2gdl3oaiybzWZ069bNeOGFF4zS0lKX8frF1ViGYRhfffWVMWTIEMNmsxlWq9Xo2rXrBa+aOnLkiDFy5EgjJCTE8PX1Na655hrjueeeM+x2u8u4o0ePGnfddZdxxRVXGIGBgcZdd91lbN261a2rsT7++GPj3nvvNZo2bWr4+/sbgwYNMg4ePOgytm/fvsZvfvObC+6nqKjI+Mtf/mJcc801htVqNWw2mxEdHW1MmjTJyMvLMwzDMNLT0434+HijVatWhtVqNZo3b24MGjTIyMjIcO5n7ty5RkxMjBEaGmpYrVajTZs2xtixY43Dhw+7fN7atWuNbt26Gf7+/saVV15ppKamXvRqrPHjx1+w5uzsbOP3v/+90apVK8PX19do1qyZERMT43IFGgDDsBiGYXgtaQFANS1ZskT333+/duzY4XJHaAA4jzU7AADA1Ag7AADA1DiNBQAATI2ZHQAAYGqEHQAAYGqEHQAAYGrcVFCSw+HQsWPHFBgYeMFbyQMAgLrHMAwVFhYqPDxcDRpcfP6GsKOfntXzyyc4AwCAy0NOTo5at2590X7CjqTAwEBJP/2wmjRp4uVqAABAVRQUFCgiIsL5PX4xhB3994nCTZo0IewAAHCZ+V9LUFigDAAATI2wAwAATI2wAwAATI2wAwAATI2wAwAATI2wAwAATI2wAwAATI2wAwAATI2bCgIwLbvdroyMDOXm5qply5bq06ePfHx8vF0WgFrGzA4AU1q1apXat2+v2NhYjRw5UrGxsWrfvr1WrVrl7dIA1DKvhp2UlBT17NlTgYGBat68uRITE7V//36XMYZhaNasWQoPD5e
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.boxplot(X['trestbps'])\n",
"plt.ylabel('Blood pressure (rest)')\n",
"plt.title('Blood pressure')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 8,
2024-05-08 08:48:17 +02:00
"id": "5c174a9d-59b7-4efe-a0eb-a132388c1d2a",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADZ3ElEQVR4nOzdd3hUZfbA8e/0TNqk9wCh996LIIiogAU7iKjoKqhrdy27ll1WV11d/dk7RRF7QZBeROkQuiI1tFTSy2QyM/f3x0vKkJmQQEIgns/z5NHce+fOnUnIPfO+5z1Hp2mahhBCCCFEE6Vv7AsQQgghhGhIEuwIIYQQokmTYEcIIYQQTZoEO0IIIYRo0iTYEUIIIUSTJsGOEEIIIZo0CXaEEEII0aRJsCOEEEKIJk2CHSGEEEI0aRLsCNGItm3bxq233kpSUhJ+fn4EBgbSs2dPXnzxRbKzsyuOa9GiBWPGjKm35z148CA6nY7p06fX+jHjxo3jiiuuqNWxP/zwAzqdjvDwcEpLS0/zKs89zzzzDDqdzmPbsGHDGDZsWMX3xcXFPPPMM6xYsaJW51yxYgU6nY6vvvqqHq9UCFGVsbEvQIg/q/fff5+pU6fSrl07HnnkETp27EhZWRkbN27knXfeYc2aNXz77beNfZkAFBUVsWDBAt55551aHf/hhx8CkJ2dzXfffcf111/fkJfXqN566y2P74uLi3n22WcBPIIgIUTjkWBHiEawZs0apkyZwsiRI/nuu++wWCwV+0aOHMlDDz3EggULGvEKPc2fPx+n08nYsWNPeWxaWhrz589n+PDhrF69m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sLCtDvvvLNi2w033KBZLBbt0KFDHo+/9NJLNX9/fy03N1fTtLoFO999951mMBi0jIyMUx77888/a4D22GOPaZqmaW63W0tKStKaN2+uud3uiuPmzZunAdrbb7/t8fjnn3++WrAzatQoLSEhQcvLy/M49p577tH8/Py07Oxsn9fz3//+VwMqXrc35cFGz549Pa7x4MGDmslk0m6//faKbacKdjRN0zIzM6u9hprU9fnNZrOWnp5ese3zzz+vFvR6ExgYqN1///0+9xcVFWlhYWHa2LFjPba7XC6tW7duWt++fT22T5kyRTObzdqaNWu04cOHa1FRUdqxY8dq9ZqFONtkGkuI80T37t1p1qxZxfd+fn60bdvWY4po2bJljBgxgsTERI/H3nLLLRQXF3udAjmVr7/+miFDhlRMz9SkPDG5fJqofAonJSXFYypk5cqVAFx33XUej7/xxhs9vrfb7SxdupSrrroKf39/nE5nxddll12G3W5n7dq1Pq+nT58+Fc/zxRdfcPToUZ/Hjh8/3mOlVfPmzRk4cCDLly8/5euuD7V5/ilTpgAqub3cG2+8QZcuXbjgggtqPH/fvn2ZPn0606ZNY+3atZSVlXnsX716NdnZ2UyaNMnjfXa73VxyySVs2LCBoqKiiuP/97//0alTJy688EJWrFjBJ598Qmxs7Bm9B0I0FAl2hDjLIiIi8Pf358CBA3V6XHh4eLVtFouFkpKSiu+PHz/u9YYTFxdXsb8uysrKmDt3LldfffUpjy0oKODLL7+kb9++REZGkpubS25uLldddRU6na4iECq/DqPRSFhYmMc5oqOjPb4/fvw4TqeT119/HZPJ5PF12WWXAZCVleXzmi644AK+++47nE4nN998MwkJCXTu3JnPPvus2rExMTFet9X1PTtdtXn+6Ohorr/+et59911cLhfbtm1j1apV3HPPPac8/+eff86kSZP44IMPGDBgAGFhYdx8882kpaUBkJ6eDsA111xT7b1+4YUX0DTNoxyCxWJh/Pjx2O12unfvzsiRI8/0LRCiwchqLCHOMoPBwIgRI/jpp584cuQICQkJ9Xbu8PBwUlNTq20vT1yNiIio0/mWLFlCXl4eV1111SmP/eyzzyguLmb9+vVeE5m//fZbcnJyCA0NJTw8HKfTSXZ2tkfAU37jLRcaGorBYGDixIncfffdXp83KSmpxuu64ooruOKKKygtLWXt2rU8//zzjB8/nhYtWjBgwACfz12+zVuQ2RBq+/z33Xcfs2bN4vvvv2fBggWEhIQwYcKEU54/IiKCV199lVdffZVDhw7xww8/8Nhjj5GRkcGCBQsqfjdef/11+vfv7/UcVYPRHTt28NRTT9GnTx82bNjAK6+8woMPPliXlyzEWSMjO0I0gscffxxN07jjjjtwOBzV9pePqNTViBEjWLZsWbVVOTNnzsTf39/nTcyXr7/+mv79+xMfH3/KYz/88EOCgoJYunQpy5cv9/h66aWXKC0t5dNPPwVg6NChgBptqGrOnDke3/v7+3PhhReSnJxM165d6d27d7Wv2gYjFouFoUOH8sILLwBUW2n12WefoWlaxfcpKSmsXr26zrVyylfXVR1xq43aPn+vXr0YOHAgL7zwAp9++im33HILAQEBdXquZs2acc899zBy5Eg2b94MwKBBgwgJCWHXrl1e3+fevXtjNpsBVXfp2muvpUWLFixfvpx77rmHxx57jHXr1tXpOoQ4W2RkR4hGMGDAAN5++22mTp1Kr169mDJlCp06daKsrIzk5GTee+89OnfuXKu6NlU9/fTT/Pjjj1x44YU89dRThIWF8emnnzJv3jxefPFFbDZbrc/lcrn4/vvveeyxx0557I4dO1i/fj1Tpkxh+PDh1fYPGjSIl19+mQ8//JB77rmHSy65hEGDBvHQQw+Rn59Pr169WLNmDTNnzgRAr6/8HPbaa68xePBghgwZwpQpU2jRogUFBQXs3buXuXPnsmzZMp/X9dRTT3HkyBFGjBhBQkICubm5vPbaa5hMpoqAq1xGRgZXXXUVd9xxB3l5eTz99NP4+fnx+OOP1/YtAyAoKIjmzZvz/fffM2LECMLCwoiIiKBFixY1Pq4uz3/fffdx/fXXo9PpmDp
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.linear_model import LinearRegression\n",
"\n",
"model = LinearRegression()\n",
"x = np.array(X['age'])\n",
"x = x[:, np.newaxis]\n",
"reg = model.fit(x, X['chol'])\n",
"pred = reg.predict(x)\n",
"\n",
2024-06-07 11:20:34 +02:00
"sick = y != 0\n",
2024-05-08 08:48:17 +02:00
"\n",
"sns.scatterplot(X, x='age', y='chol', hue='sex')\n",
"plt.plot(x, pred, color='black')\n",
"plt.xlabel('Age')\n",
"plt.ylabel('Chol')\n",
2024-06-07 11:20:34 +02:00
"plt.title('Chol / Age split by sex')\n",
"plt.legend(['male', 'female'])\n",
"plt.show()"
2024-05-08 08:48:17 +02:00
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 9,
2024-05-08 08:48:17 +02:00
"id": "b3d627cf-3ec9-4cd9-bee6-5baeb9d1a22d",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADQWElEQVR4nOzdd3xT1fvA8U+aJmm6d0sHtOxR9kaUTQVZLhCUryBOFBX3Xl8Vx9eJA1ygqDh/OJC9QfYS2RsKtJTumbRJ7u+PSwMhSWlLF+V5v159ac+9ufdJGpqn5zznHI2iKApCCCGEEHWUR00HIIQQQghRlSTZEUIIIUSdJsmOEEIIIeo0SXaEEEIIUadJsiOEEEKIOk2SHSGEEELUaZLsCCGEEKJOk2RHCCGEEHWaJDtCCCGEqNMk2RF1wsyZM9FoNA5fYWFh9O7dm7lz5zqdr9FoeOmll6o9zqNHj6LRaJg5c2a13/tK8uGHHxISEoLFYrnouWlpaRgMBjQaDZs3b66G6KrHihUr0Gg0rFixwt720ksvodFoHM775JNPyvV+1Gg0PPDAA5UUpRDVQ5IdUafMmDGDdevWsXbtWj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myZInywQcfKAEBAUrfvn0Vm82mKIqirF27VtFoNMott9yizJs3T1m2bJkyY8YMZezYsfZ7TJkyRdFqtcqLL76oLF26VFmwYIHy/vvvKy+99JL9nNtvv11p0KCB03N58cUXlQt/1QBKdHS00qZNG+X7779Xli1bpuzcuVPZtWuXEhAQoLRu3Vr55ptvlEWLFimPPvqo4uHh4XCv0vTv318ZM2ZMmc696667FEDZtWuXkpOTo3h7eyu9e/d2Ou/pp59WAOXuu+9WFixYoHz++edK/fr1lXr16im9evWyn1fW19yVvLw8JSQkROnUqZPy008/KStXrlR+/PFH5d5771V2797t8NrFxsYqLVu2VGbPnq388ccfyrXXXqsAys8//2w/b/ny5QqgLF++3N524c9i69atSsOGDZX27dsr69atU9atW6ds3bq11NesrPe//vrrlfr16ysWi8Xh8TfffLMSFRWlFBcXu71HWd5vZX2v7N+/X/Hz81NuuOEGRVEUxWq1Kn379lXCw8OVU6dOlfpcRd0hyY6oE0qSgwu/DAaD8sknnzidf2Gyc8sttygGg0E5fvy4w3mDBg1SvL29laysLEVRFOWpp55SAGXDhg0O5913332KRqNR9u3bpyiKonz66acKoPz+++8O55V8uJY12bn++usd2v/++28FUF599VV7W69evRRAWbp0qcO5U6ZMUTw8PJRNmzY5tP/yyy8KoMybN09RFEX53//+pwD25+jKkCFDlHbt2pUac3mTnYCAACUjI8OhPTExUYmJiVGys7Md2h944AHFy8vL6fwLpaWlKZ6ensqvv/5a6nmKoiYm/v7+Srdu3Ryeg0ajUQ4ePGhvy8jIUAwGgzJq1CiHx69bt04BHJKdsr7mrmzevFkBlN9++63UuAHFaDQqKSkp9jaLxaI0b95cady4sb2tLMmOoihKq1atHJ7DxZT3/nPmzLG3nTx5UvH09FRefvnlUu9Rlvdbed4rP/74owIo77//vvLCCy8oHh4eyqJFi8rydEUdIcNYok755ptv2LRpE5s2bWL+/Pncfvvt3H///Xz00UelPm7ZsmX069eP2NhYh/Zx48ZRUFBgL+pctmwZLVu2pEuXLk7nKYrCsmXLAFi+fD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pDj07pTnNXeldevW/PDDDyiKwo4dO5g5cyavvPIKRqORp556yuG+rmIB7PFWpbLef8yYMTz55JN8/PHHdOvWjZSUFLc/2/Nd7P1W3vdKfn4+Y8eOpWnTppw
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"model = LinearRegression()\n",
"x = np.array(X['chol'])\n",
"x = x[:, np.newaxis]\n",
"reg = model.fit(x, X['trestbps'])\n",
"pred = reg.predict(x)\n",
"\n",
2024-06-07 11:20:34 +02:00
"sick = y != 0\n",
2024-05-08 08:48:17 +02:00
"\n",
"sns.scatterplot(X, x='chol', y='trestbps', hue='sex')\n",
"plt.plot(x, pred, color='black')\n",
"plt.xlabel('Chol')\n",
"plt.ylabel('Blood pressure (rest)')\n",
2024-06-07 11:20:34 +02:00
"plt.title('Blood pressure / Age split by sex')\n",
"plt.legend(['male', 'female'])\n",
"plt.show()"
2024-05-08 08:48:17 +02:00
]
},
{
"cell_type": "code",
2024-06-07 11:20:34 +02:00
"execution_count": 10,
2024-05-08 08:48:17 +02:00
"id": "3a6dc91a-f3e9-4d7e-9e4b-58c59d24463c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 11:20:34 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAHNCAYAAAAXN9H8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB350lEQVR4nO3deXxM1/8/8Ndk34MgCSWLBAmxJZbEXkvQorSlaFB77YJoPpHYm9oFpbW0aBWtraoaYl+CSiSopLaIKLEvEUu2Ob8/8st8jSRju3MnM17PPu7jkZw5c9/nTiXezqoQQggQERERGSAjXTeAiIiISFuY6BAREZHBYqJDREREBouJDhERERksJjpERERksJjoEBERkcFiokNEREQGi4kOER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MOXWnEoSsiIiJ6I0uWLIGbmxssLCzg6+uLQ4cOaay/du1a1K5dG1ZWVnB2dsYXX3yBu3fvarWNTHSIiIj0mY4O9dywYQNGjx6NsLAwJCQkoGnTpmjfvj3S0tKKrH/48GH07t0b/fv3x9mzZ/Hbb7/hxIkTGDBggBSfQrGY6BAREekzHR0BMW/ePPTv3x8DBgyAl5cXFixYgEqVKmHp0qVF1j927BhcXV0xcuRIuLm5oUmTJhg8eDDi4uKk+BSKxUSHiIiIAOQfZJ2RkaF2vXiwNQBkZ2cjPj4ebdu2VStv27YtYmNji7x3QEAA/vvvP+zYsQNCCNy8eRMbN27EBx98oJVnKcDJyG+
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"corr = df.corr()\n",
"\n",
2024-06-07 11:20:34 +02:00
"sns.heatmap(corr)\n",
"plt.show()"
2024-05-08 08:48:17 +02:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.7"
2024-05-08 08:48:17 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 5
}