DSA_SoSe_24/Exploration.ipynb

505 lines
324 KiB
Plaintext
Raw Normal View History

2024-05-08 08:48:17 +02:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 120,
"id": "37d611da-6f56-46d8-905a-62026750150c",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from ucimlrepo import fetch_ucirepo\n",
"import pandas as pd\n",
"\n",
"# fetch dataset \n",
"heart_disease = fetch_ucirepo(id=45) \n",
" \n",
"# data (as pandas dataframes) \n",
"X = heart_disease.data.features \n",
"y = heart_disease.data.targets \n",
"\n",
"male=1\n",
"female=0"
]
},
{
"cell_type": "code",
"execution_count": 127,
"id": "ae26378f-c104-4664-a313-ed8d9edfed42",
"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 "
]
},
"execution_count": 127,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.concat([X, y], axis=1)\n",
"df = df.rename(columns={'num':'goal'})\n",
"\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 128,
"id": "6b3e5424-4a7e-4e53-82b9-d78e38939834",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGxCAYAAABIjE2TAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAr7UlEQVR4nO3dfVxUdaLH8e+EMqIOKCAMs45IZu1umI/dXKoV8ilC3NLyqQe5mdtezXtJuRU9iXu7Uu4trdzsYc2H0sy6Wd3FhzBR82ob6mpqXVcNAl9ClCkDaoPhuX/0crYRULGZ5Qd+3q/Xeb085/zOOb9xd/DTmQdslmVZAgAAMMglTT0BAACAMxEoAADAOAQKAAAwDoECAACMQ6AAAADjECgAAMA4BAoAADAOgQIAAIxDoAAAAOMQKIDBnnvuOdlsNiUmJjb1VOpVXFwsm82mhQsX+rbl5OTIZrM16jzHjx9XTk6O1q9f36jj6rtW165dNWzYsEad51yWLl2qOXPm1LvPZrMpJycnoNcDQKAARnv11VclSXv27NFf/vKXJp7N+bnnnnu0ZcuWRh1z/PhxzZgxo9GBciHXuhBnC5QtW7bonnvuCfocgIsNgQIYauvWrdq5c6fS0tIkSfPnz2/iGZ2fzp07q3///kG9xvHjx/9h1zqX/v37q3Pnzk06B6AlIlAAQ50OkieffFJJSUlatmyZ7x/mHzt48KBuvfVWORwOdejQQbfffrsKCwvrvPQi/RA9w4cPV2RkpNq0aaPevXtr+fLl5zWfQ4cOadSoUXI4HIqIiNDo0aNVXl5eZ1x9L7usW7dOycnJioqKUlhYmLp06aKRI0fq+PHjKi4uVqdOnSRJM2bMkM1mk81mU0ZGht/5tm/frltvvVUdO3ZUt27dGrzWaStWrNBVV12lNm3a6NJLL9Vzzz3nt3/hwoWy2WwqLi72275+/XrZbDbf3Zzk5GTl5eXpyy+/9M3tx9es7yWe3bt36ze/+Y06duyoNm3aqFevXlq0aFG913njjTf0yCOPyOVyKTw8XIMGDdLevXvrfUzAxYRAAQx04sQJvfHGG7r66quVmJiou+++W1VVVXrrrbf8xh07dkwpKSkqKCjQU089peXLlys2NlajR4+uc86CggJde+21Onr0qF588UW999576tWrl0aPHl0nZOqbz6BBg/TBBx8oNzdXb731lpxOZ73XOVNxcbHS0tIUGhqqV199VatXr9aTTz6pdu3aqaamRnFxcVq9erUkacKECdqyZYu2bNmixx57zO88I0aM0GWXXaa33npLL7744lmvuWPHDmVmZur+++/XihUrlJSUpH/7t3/Tf/3Xf51zvmd64YUXdO2118rpdPrmdraXlfbu3aukpCTt2bNHzz33nN555x398pe/VEZGhmbNmlVn/MMPP6wvv/xSf/rTn/Tyyy9r3759Sk9PV21tbaPnCrQoFgDjLF682JJkvfjii5ZlWVZVVZXVvn176/rrr/cb98c//tGSZK1atcpv+7333mtJshYsWODb9vOf/9zq3bu3dfLkSb+xw4YNs+Li4qza2toG5zNv3jxLkvXee+/5bZ84cWKd60yfPt368Y+Wt99+25Jk7dixo8Hzf/3115Yka/r06XX2nT7f448/3uC+H4uPj7dsNlud6w0ePNgKDw+3jh07ZlmWZS1YsMCSZBUVFfmNKygosCRZBQUFvm1paWlWfHx8vXM/c95jxoyx7Ha7VVJS4jcuNTXVatu2rXX06FG/69x0001+45YvX25JsrZs2VLv9YCLBXdQAAPNnz9fYWFhGjNmjCSpffv2uu222/TRRx9p3759vnEbNmyQw+HQjTfe6Hf82LFj/db379+v//u//9Ptt98uSfr+++99y0033aSysrKzvqxQUFAgh8Oh4cOH+20fN27cOR9Lr169FBoaqt/+9rdatGiRvvjii3MeU5+RI0ee99grr7xSPXv29Ns2btw4eTwebd++/YKuf77WrVungQMHyu12+23PyMjQ8ePH69x9OfPv9KqrrpIkffnll0GdJ2A6AgUwzP79+7Vx40alpaXJsiwdPXpUR48e1a233irp75/skaTDhw8rNja2zjnO3PbVV19JkrKystS6dWu/ZdKkSZKkb775psE5NXQdp9N5zsfTrVs3rV27VjExMZo8ebK6deumbt266dlnnz3nsT8WFxd33mPrm9fpbYcPH27UdRvr8OHD9c7V5XLVe/2oqCi/dbvdLumHl9WAi1mrpp4AAH+vvvqqLMvS22+/rbfffrvO/kWLFumJJ55QSEiIoqKi9Mknn9QZc+abV6OjoyVJ2dnZGjFiRL3XveKKKxqc0/lepyHXX3+9rr/+etXW1mrr1q16/vnnlZmZqdjYWN9donNpzHer1Dev09tOB0GbNm0kSV6v12/c2ULtfERFRamsrKzO9kOHDkn6+/8WAM6OOyiAQWpra7Vo0SJ169ZNBQUFdZZp06aprKxMq1atkiQNGDBAVVVVvvXTli1b5rd+xRVXqHv37tq5c6f69etX7+JwOBqcV0pKiqqqqvT+++/7bV+6dGmjHl9ISIiuueYa/fGPf5Qk38stgb5rsGfPHu3cudNv29KlS+VwONSnTx9JP3yhmyR9+umnfuPOfIyn53e+cxs4cKDWrVvnC5LTFi9erLZt2zb5x6KB5oI7KIBBVq1apUOHDumpp55ScnJynf2JiYmaO3eu5s+fr2HDhmn8+PGaPXu27rjjDj3xxBO67LLLtGrVKq1Zs0aSdMklf/9vkJdeekmpqakaOnSoMjIy9LOf/UzffvutPv/8c23fvr3OJ4R+7K677tLs2bN111136T//8z/VvXt3rVy50neds3nxxRe1bt06paWlqUuXLvruu+98L1MNGjRIkuRwOBQfH6/33ntPAwcOVGRkpKKjo30R0Vgul0vDhw9XTk6O4uLi9Prrrys/P19PPfWU2rZtK0m6+uqrdcUVVygrK0vff/+9OnbsqBUrVmjTpk11ztejRw+98847mjdvn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{},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"\n",
"counts_male = len(X[X['sex'] == male])\n",
"counts_female = len(X[X['sex'] == female])\n",
"\n",
"plt.bar([male, female], [counts_male, counts_female])\n",
"plt.xticks([0, 1],['female', 'male'])\n",
"plt.title('Age distribution')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "48fd2655-1dcc-41f6-9938-ef6ea937d52e",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAt7klEQVR4nO3de1TVVf7/8dcp9AgKpKTnQKKSMlreJx1vY5AXyug2lmnWpGPOWNokWUsjK7FloM5kZk6YpYarzMrRcr6mQV+VLthXtDGN+pp9RaVRogu3UYPU/fujH2c8oSkEfs7G52Otz1p+9v5c3mcPq/Oa/bkclzHGCAAAwFIXOF0AAADAL0GYAQAAViPMAAAAqxFmAACA1QgzAADAaoQZAABgNcIMAACwGmEGAABYjTADAACsRpgBGogFCxbI5XKpS5cuTpdySvv27ZPL5dKLL77oa0tJSZHL5arRcY4cOaKUlBRt3ry5Rvud6lzt2rXTddddV6PjnMmKFSs0f/78U/a5XC6lpKTU6fkAEGaABmPp0qWSpLy8PP3P//yPw9WcnfHjx2vLli012ufIkSOaOXNmjcNMbc5VGz8XZrZs2aLx48fXew3A+YYwAzQA27Zt08cff6zExERJ0pIlSxyu6Oy0bt1affv2rddzHDly5Jyd60z69u2r1q1bO1oD0BARZoAGoCq8zJ49W/3799fKlSt9X+In+/LLL3XLLbcoNDRUF110kW6//Xbl5uZWu/wj/RiQbrjhBrVo0UJNmjRRz5499dprr51VPQcPHtStt96q0NBQhYeHa+TIkSosLKy23aku/WzcuFHx8fGKiIhQcHCw2rRpo5tvvllHjhzRvn371LJlS0nSzJkz5XK55HK5NHbsWL/jffTRR7rlllvUvHlztW/f/rTnqrJmzRp169ZNTZo00aWXXqoFCxb49b/44otyuVzat2+fX/vmzZvlcrl8s0Tx8fFat26d9u/f76vt5HOe6jLTJ598ohtvvFHNmzdXkyZN1KNHD2VkZJzyPK+88oqmT5+uqKgohYWFaciQIdq9e/cpPxNwPiHMAJY7evSoXnnlFfXu3VtdunTRuHHjVF5ertdff91vu8OHD+uqq67Spk2bNGfOHL322mvyeDwaOXJktWNu2rRJAwYMUElJiRYtWqQ333xTPXr00MiRI6uFnlPVM2TIEGVmZiotLU2vv/66vF7vKc/zU/v27VNiYqIaN26spUuXasOGDZo9e7aaNm2qyspKRUZGasOGDZKku+66S1u2bNGWLVv06KOP+h1n+PDh6tChg15//XUtWrToZ8+5Y8cOJSUl6f7779eaNWvUv39/TZ48WX/961/PWO9PPfvssxowYIC8Xq+vtp+7tLV79271799feXl5WrBggVavXq3LL79cY8eO1dy5c6tt//DDD2v//v164YUXtHjxYu3Zs0fXX3+9jh8/XuNagQbFALDa8uXLjSSzaNEiY4wx5eXlplmzZmbgwIF+2/3tb38zksz69ev92idMmGAkmWXLlvnaOnXqZHr27Gl++OEHv22vu+46ExkZaY4fP37aetLT040k8+abb/q1//GPf6x2nhkzZpiT/zO0atUqI8ns2LHjtMf/+uuvjSQzY8aMan1Vx3vsscdO23eytm3bGpfLVe18Q4cONWFhYebw4cPGGGOWLVtmJJn8/Hy/7TZt2mQkmU2bNvnaEhMTTdu2bU9Z+0/rHjVqlHG73ebAgQN+2w0bNsyEhISYkpISv/Nce+21ftu99tprRpLZsmXLKc8HnC+YmQEst2TJEgUHB2vUqFGSpGbNmmnEiBF67733tGfPHt922dnZCg0N1TXXXOO3/2233ea3/sUXX+h///d/dfvtt0uSjh075luuvfZaHTp06GcvbWzatEmhoaG64YYb/NpHjx59xs/So0cPNW7cWH/605+UkZGhvXv3nnGfU7n55pvPetvOnTure/fufm2jR49WWVmZPvroo1qd/2xt3LhRgwcPVnR0tF/72LFjdeTIkWqzOj8d027dukmS9u/fX691AoGOMANY7IsvvtC7776rxMREGWNUUlKikpIS3XLLLZL+84STJH377bfyeDzVjvHTtq+++kqS9OCDD6pRo0Z+y8SJEyVJ33zzzWlrOt15vF7vGT9P+/bt9c4776hVq1aaNGmS2rdvr/bt2+vpp58+474ni4yMPOttT1VXVdu3335bo/PW1LfffnvKWqOiok55/oiICL91t9st6cdLe8D5LMjpAgDU3tKlS2WM0apVq7Rq1apq/RkZGZo1a5YuvPBCRUREaOvWrdW2+emNuRdffLEkKTk5WcOHDz/leTt27Hjams72PKczcOBADRw4UMePH9e2bdv0zDPPKCkpSR6Pxzf7dCY1eXfNqeqqaqsKD02aNJEkVVRU+G33c6HubEREROjQoUPV2g8ePCjpP/9bAPh5zMwAljp+/LgyMjLUvn17bdq0qdrywAMP6NChQ1q/fr0kKS4uTuXl5b71KitXrvRb79ixo2JjY/Xxxx+rV69ep1xCQ0NPW9dVV12l8vJyrV271q99xYoVNfp8F154ofr06aO//e1vkuS75FPXsxF5eXn6+OOP/dpWrFih0NBQ/frXv5b048v1JGnnzp1+2/30M1bVd7a1DR48WBs3bvSFlyrLly9XSEiI44+SA7ZgZgaw1Pr163Xw4EHNmTNH8fHx1fq7dOmihQsXasmSJbruuus0ZswYPfXUU7rjjjs0a9YsdejQQevXr9fbb78tSbrggv/8f5vnnntOw4YN09VXX62xY8fqkksu0XfffafPPvtMH330UbUnpU5255136qmnntKdd96pJ554QrGxsXrrrbd85/k5ixYt0saNG5WYmKg2bdro+++/910qGzJkiCQpNDRUbdu21ZtvvqnBgwerRYsWuvjii32Bo6aioqJ0ww03KCUlRZGRkXrppZeUlZWlOXPmKCQkRJLUu3dvdezYUQ8++KCOHTum5s2ba82aNXr//ferHa9r165avXq10tPTdcUVV+iCCy5Qr169TnnuGTNm6L/+67901VVX6bHHHlOLFi308ssva926dZo7d67Cw8Nr9ZmA847TdyADqJ2bbrrJNG7c2BQVFZ12m1GjRpmgoCBTWFhojDHmwIEDZvjw4aZZs2YmNDTU3Hzzzeatt9465dNHH3/8sbn11ltNq1atTKNGjYzX6zWDBg3yPTX1c7788ktz8803+50nJyfnjE8zbdmyxfzud78zbdu2NW6320RERJi4uDizdu1av+O/8847pmfPnsbtdhtJZsyYMX7H+/rrr6vVdLqnmRITE82qVatM586dTePGjU27du3MvHnzqu3/+eefm4SEBBMWFmZatmxp/vznP5t169ZVe5rpu+++M7fccou56KKLjMvl8junTvEU1q5du8z1119vwsPDTePGjU337t39xsiY/zzN9Prrr/u15+fnVxtT4HzkMsYYh3IUgACQmpqqRx55RAcOHODttACsxGUm4DyycOFCSVKnTp30ww8/aOPGjVqwYIHuuOMOggwAaxFmgPNISEiInnrqKe3bt08VFRVq06aNpk2bpkceecTp0gCg1rjMBAAArMaj2QAAwGqEGQAAYDXCDAAAsFqDvwH4xIkTOnjwoEJDQ2v0inMAAOAcY4zKy8sVFRXl91LPU2nwYebgwYPVfpEWAADYoaCg4IyvjmjwYabqN2QKCgoUFhbmcDUAAOBslJWVKTo6+md/C65Kgw8zVZeWwsLCCDMAAFjmbG4R4QZgAABgNcIMAACwGmEGAABYjTADAACsRpgBAABWI8wAAACrEWYAAIDVCDMAAMBqhBkAAGA1wgwAALAaYQYAAFiNMAMAAKxGmAEAAFYjzAAAAKsRZgAAgNWCnC4AAM437R5a53QJNbZvdqLTJQCnxcwMAACwGmEGAABYjTADAACsRpgBAABWI8wAAACrEWYAAIDVCDMAAMBqhBkAAGA1wgwAALAaYQYAAFiNMAMAAKxGmAEAAFYjzAAAAKsRZgAAgNUIMwAAwGqEGQAAYDXHw8y//vUv3XHHHYqIiFBISIh69Oi
"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",
"execution_count": 42,
"id": "b9174a9d-6c8a-4915-9580-48f23cbdd038",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"image/png": "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w4cPn7X90KFDwF/PhRDi/KRlRogA5XK5mD9/PnXr1mXZsmVnXZ5//nkOHz7MokWLAOjYsSMFBQW+614fffRRqesNGzakfv36bNiwgdatW5d5sVgs56zrxhtvpKCggC+++KLU9gULFlzSz6fX62nbti2vvfYagO+UT3m3RmzZsoUNGzaU2rZgwQIsFgutWrUCPJPrAWzcuLHUfmf+jN76Lra2m2++maVLl/rCi9f7779PRESE5kPJhQgU0jIjRIBatGgRhw4dYurUqXTq1Oms29PT03n11Vd555136NGjB48++igzZ87k4YcfZtKkSdSrV49Fixbx7bffAqDT/fW3zZtvvkm3bt245ZZb6NOnD9WrV+fEiRNs27aNdevWnTVS6nR/+9vfmDlzJn/729+YPHky9evX5+uvv/Yd53zeeOMNli5dym233UbNmjUpKSnxnSrr3LkzABaLhVq1avH5559z8803U7VqVeLj432B41KlpKRw++23M27cOJKTk/nggw9YsmQJU6dOJSIiAoA2bdrQsGFDhg4ditPppEqVKixcuJAff/zxrMdr1qwZ//nPf5g7dy5XX301Op2O1q1bl3nssWPH8uWXX3LjjTcyZswYqlatyr///W+++uorpk2bRkxMzGX9TEKEHK17IAshLs+dd96pmkwmNScn55z7PPDAA6rBYFCzs7NVVVXV/fv3q7169VKjoqJUi8Wi3n333erXX39d5uijDRs2qPfdd5+akJCgGo1GNSkpSb3pppt8o6bO58CBA+rdd99d6jirVq264Gim1atXq3fddZdaq1Yt1Ww2q3FxcWrHjh3VL774otTjf/fdd2rLli1Vs9msAuqjjz5a6vGOHj16Vk3nGs102223qZ999pnatGlT1WQyqbVr11ZnzJhx1v3//PNPtWvXrmp0dLRarVo1ddCgQepXX3111mimEydOqPfcc48aGxurKopS6piUMQpr06ZNas+ePdWYmBjVZDKpV111Vanfkar+NZrp008/LbV9z549Z/1OhQhFiqqqqkY5SgjhB6ZMmcKLL77I/v37ZXZaIURAktNMQoSQV199FYBGjRrhcDhYunQpc+bM4eGHH5YgI4QIWBJmhAghERERzJw5k71792Kz2ahZsyYvvPACL774otalCSHEZZPTTEIIIYQIaDI0WwghhBABTcKMEEIIIQKahBkhhBBCBLSg7wDsdrs5dOgQFovlkqY4F0IIIYR2VFWloKCAlJSUUpN6liXow8yhQ4fOWpFWCCGEEIEhKyvrglNHBH2Y8a4hk5WVRXR0tMbVCCGEEOJi5OfnU6NGjfOuBecV9GHGe2opOjpawowQQggRYC6mi4h0ABZCCCFEQJMwI4QQQoiAJmFGCCGEEAFNwowQQgghApqEGSGEEEIENAkzQgghhAhoEmaEEEIIEdAkzAghhBAioEmYEUIIIURAkzAjhBBCiIAmYUYIIYQQAU3CjBBCCCECmoQZIYQQQgS0oF81W4SW5cuX8/PPP9OyZUtuueUWrcsRQghRCRRVVVWti6hI+fn5xMTEkJeXR3R0tNbliAqkqipdunTB6XQC8O2332I2mzWuSgghxOW4lO9vOc0kgkZJSYkvyAAUFhZqWI0QoryVlJSwdu1arFar1qUIPyNhRgSNoqKi814XQgS2mTNnMnT
"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",
"execution_count": 43,
"id": "522ff499-cd7f-4417-ae7d-d637402505b8",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFW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SkmIkmVWrVp1w308++aSR5H5ta1NQUFDj9T6b4wwODjbFxcXutiNHjphOnTqZCy+80N02efJkU9uv83nz5tU4N507dzZJSUk1+tb2PrnqqqtMq1atTHl5ucf+4+PjTZs2bUx1dbXHftLS0jy2mZubaySZXbt21dgfcC5xGQvwQ5deeqnatm3rng8KClLHjh21Y8cOd9vKlSuVnJxcY8RoxIgROnDggD755JNat33o0CF98MEHuuWWWxQSEqIjR464p/79++vQoUNas2aNJOnKK6/U559/rrS0NL333nsqKys77WN47733dOTIEd15550e+wgKClJSUpLHpa5jfv3rX5/29nv37q2wsDD3fGRkpFq1auXxGtVm1apV6ty5s7p16+bRPnTo0FPu89glqttuu03/+Mc/9P333592vcc7k+NMTk5WZGSke75hw4YaMmSIvv76a+3cubNO+z8d+/fv17///W8NHjxYjRs39tj/b3/7W+3cuVPbtm3zWOeXl2O7du0qSac8J0B9I+wA9ahFixYKCQlRYWHhGa0XERFRo83pdOrgwYPu+Z9//tl92eh40dHR7uW1+fnnn3XkyBE988wzCggI8Jj69+8vSfrpp58kSZmZmXryySe1Zs0a9evXTxEREUpOTtann356ymP48ccfJR0NCL/cz6uvvurexzEhISFq0qTJKbd7zOm8RrX5+eef5XK5arTX1vZL1157rV5//XV3iGvTpo3i4+P1yiuvnHbdZ3qcJ6v1ROfYG/bs2SNjzBm9x355To5dIjvVOQHqG/fsAPWoYcOGSk5O1rvvvqudO3d63LtxtiIiIrRr164a7cduCG3RokWt6zVr1sz9v/P09PRa+8TGxkqSGjVqpHHjxmncuHHau3ev3n//fT388MPq27evioqKFBIScsL6ju3/n//8p9q1a3fK46ntBtv6EBERoeLi4hrttbXV5qabbtJNN92kiooKrVmzRjk5ORo6dKjat2+vhISEU65/psd5slqPhYugoCBJUkVFhcc9OL8MlGeiWbNmatCgQZ3eY4C/YWQHqGeZmZkyxuh3v/udKisrayw/fPiw3nrrrTPebnJyslauXFnjaZe//e1vCgkJOeFjxCEhIerdu7c+++wzde3aVT169Kgx1TZq0rRpUw0ePFjp6enavXu3+wmfE/3vvW/fvmrUqJG++eabWvfRo0ePMz5mb+jdu7c2b96szz//3KN94cKFZ7Qdp9OppKQkTZ8+XZLcT5h5ezTjgw8+cI+SSUdven/11Vd1wQUXuMPzsSeqNm7c6LFube+r0xn9kqTQ0FD17NlTixcv9uhfXV2tl156SW3atFHHjh3rckjAOcfIDlDPEhISNGfOHKWlpal79+4aPXq0OnfurMOHD+uzzz7T3LlzFR8fr4EDB57RdidPnqy3335bvXv31mOPPabmzZvr5Zdf1tKlS5Wbm6vw8PATrvv000/rmmuu0a9+9SuNHj1a7du3V3l5ub7++mu99dZb7qdnBg4cqPj4ePXo0UMtW7bUjh07NHPmTLVr105xcXGSpC5duri3OXz4cAUEBOiiiy5S+/btNXXqVD3yyCP69ttvdf3116tZs2b68ccftXbtWoWGhmrKlCl1fFXrLiMjQy+++KIGDBigadOmuZ/G2rp16ynXfeyxx7Rz504lJyerTZs22rt3r55++mkFBAQoKSlJ0tHP5gkODtbLL7+siy++WI0bN1Z0dLT70s+ZatGihfr06aNHH33U/TTW1q1bPR4/79+/v5o3b66RI0dq6tSpatSokebPn6+ioqIa2+vSpYsWLVqkV199VR0
"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",
"execution_count": 88,
"id": "f220fadf-33ec-4bf6-a225-a2c874f02088",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA+BElEQVR4nO3de1yUZf7/8fcoOIACnpABRaUVD3ls0zxkghbkIbVsy7KDZvU10Vx1y2MptQZladSauvootTVrt1IzNRVLyY1MNF1PZa7hMcgyBDwByvX7ox+zjoAcQmduez0fj/vxcK77muv+zMXovL3u+2ZsxhgjAAAAi6ri7gIAAAB+C8IMAACwNMIMAACwNMIMAACwNMIMAACwNMIMAACwNMIMAACwNMIMAACwNMIMAACwNMIMIGnhwoWy2WwuW1BQkKKiorRy5coi/W02m+Li4q56nQcPHpTNZtPChQuv+rF/zy79eRe+Xw4ePFiuceLj47V8+fJyPae4Y0VFRalVq1blGqc0q1evLvE93bhxYw0ZMqRSjwdUJsIMcJEFCxboyy+/VEpKiubNm6eqVauqb9+++vjjj91dGjxInz599OWXXyokJKRcz6tImKnoscpr9erVeu6554rdt2zZMj377LNX9PjAb+Hl7gIAT9KqVSu1b9/e+bhnz56qVauW3n33XfXt29eNlV1dZ86ckZ+fn7vLKDNjjM6dOydfX9+rcrygoCAFBQVd0WOcPXtWPj4+V+VYpbnhhhvcenygNKzMAJfh4+OjatWqydvbu9S+u3fvVv/+/VWrVi35+PioXbt2WrRoUZF+hw8f1oMPPqh69erJbrerRYsWmjFjhgoKClz6/fDDD7r33nvl7++vwMBADRw4UBkZGWWqu/DURFJSkh555BHVrl1b1atXV9++ffX999+79C08ZfH555+rS5cu8vPz09ChQyVJ2dnZeuqppxQeHq5q1aqpfv36Gj16tE6fPu0yxvvvv6+OHTsqMDBQfn5+uu6665xjSFJBQYGmTZumZs2aydfXVzVr1lSbNm302muvOfsMGTJEjRs3LvJa4uLiZLPZXNpsNptGjhypuXPnqkWLFrLb7c653r9/vwYNGuQyv2+88UaZ5i07O1uPP/646tSpoxo1aqhnz5767rvvSpzfi0/9bN++XXfccYfzuKGhoerTp4+OHj3qrPn06dNatGiR81RmVFSUy3jr1q3T0KFDFRQUJD8/P+Xm5l72lNamTZvUqVMn+fr6qn79+nr22Wd14cIF5/6NGzfKZrNp48aNLs+79HTlkCFDnHN08anWwmMWd5qpL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aOfOnVq4cKGef/55+fr6asKECWUao7ifQ0l+/PHHIm2FtRbW7+PjI0lF5vVyoa4syvo+Bq4WVmaAUuzYsUOSLnt77K233qrPPvvM+Y95obffflt+fn7q1KmTs9/evXv19ddfF+lns9nUvXt3SVL37t2Vk5OjFStWuPRbsmRJuWp/5513XB6npKTo0KFDzrtoLueOO+7QgQMHVKdOHedq1cVbcXce2e12RUZG6qWXXpL06x0+l6pZs6b+9Kc/acSIEfrll19c7pg5fvy4y4d0Xl6e1q5dW6bX6ufnp+7du2v79u1q06ZNsTVfukJwscK5v3TOyjvnNptNbdu21auvvqqaNWu6/KztdnulrUaU9P6oUqWKunXrJknOn9HOnTtd+l36vMLapLKtlpT1fQxcLazMABfZvXu3zp8/L+nXpfKlS5cqKSlJd91112X/Vz916lStXLlS3bt315QpU1S7dm298847WrVqlaZPn+68Y2PMmDF6++231adPHz3//PNq1KiRVq1apdmzZ2v48OFq2rSpJOn
"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",
"execution_count": 91,
"id": "f568c911-d961-4d7f-87b1-f25dd5403cff",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAGxCAYAAACEFXd4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA5pklEQVR4nO3dfVxUZf7/8ffInaA4cqMiimJpaQvepGaRpqSJmBKZaeua1lrb5k2Lom7mVtaWtJapK5llfrO0dL9rhkaW6WaKq6ViZpT3i4YJmXfcyJ3MnN8f/ZxvE9oyMjh4eD0fj3noua5rznwOfzBvrnOdcyyGYRgCAAAwqXqeLgAAAKAmEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXaAOmbJkiWyWCxOryZNmqhPnz5KT0+vNN5isWjGjBlXvM4jR47IYrFoyZIlV/yzAZgLYQeoo958801t27ZNW7du1euvvy4vLy8NHjxYH3zwgadLAwC38vZ0AQA8IyoqSt26dXNsDxgwQEFBQVq+fLkGDx7swcqurOLiYgUEBHi6jCozDEOlpaXy9/f3dCnAVYOZHQCSpPr168vX11c+Pj7/dWxWVpbuuusuBQUFqX79+urcubPeeuutSuO+++47jRw5Uk2bNpWfn586dOig2bNny263O407fvy4hg0bpsDAQFmtVg0fPlx5eXlVqvvCabn169frwQcfVHBwsBo0aKDBgwfrP//5j9PYPn36KCoqSps3b1ZMTIwCAgL0+9//XpJUUFCgyZMnq02bNvL19VWLFi2UlJSkc+fOOe3jn//8p3r06CGr1aqAgABdc801jn1Ikt1u13PPPafrr79e/v7+aty4sTp27Kh58+Y5xjzwwAOKjIysdCwzZsyQxWJxarNYLBo/frwWLlyoDh06yM/Pz/GzPnjwoEaMGOH0833llVeq9HMD6hJmdoA6ymazqaKiQoZh6IcfftCLL76oc+fOacSIEb/6vv379ysmJkZNmzbV3//+d4WEhGjZsmV64IEH9MMPP2jq1KmSpB9//FExMTEqLy/XX//6V0VGRio9PV2TJ0/W4cOHtWDBAklSSUmJ+vXrp+PHjyslJUXXXXedPvzwQw0fPtyl4xkzZozuuOMOvfvuu8rJydFf/vIX9enTR3v27FHjxo0d43JzczVy5EhNnTpVM2fOVL169VRcXKzevXvr2LFjeuKJJ9SxY0d98803euqpp/T1119rw4YNslgs2rZtm4YPH67hw4drxowZql+/vo4ePapPP/3Usf9Zs2ZpxowZ+stf/qLbbrtN58+f1759+3T27FmXjufn0tLSlJGRoaeeekphYWFq2rSpvv32W8XExKhVq1aaPXu2wsLCtG7dOj322GM6efKknn766cv+PMB0DAB1yptvvmlIqvTy8/M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XPD2228rICBAN998s2Pct99+q127dlUaZ7FYFBsbK0mKjY1VYWGh1qxZ4zTu3Xffdan2d955x2l769atOnr0qPr06fNf3zto0CAdPnxYISEhjtmun78uduWUn5+fevfurb/97W+SpC+//LLSmMaNG2vo0KEaN26cTp8+rSNHjkiSIiMjdeLECf3www+OseXl5Vq3bl2VjjUgIECxsbH68ssv1bFjx4vWHBISUqV9AXUBMztAHZWVlaWKigpJP50WWbVqldavX6+77777V2cFnn76aaWnpys2NlZPPfWUgoOD9c477+jDDz/UrFmzZLVaJUkTJ07U22+/rTvvvFPPPvusWrdurQ8//FALFizQo48+quuuu06SNGrUKM2ZM0ejRo3S888/r3bt2mnt2rVV/uK/YOfOnXrooYd07733KicnR9OnT1eLFi00duzY//repKQkvffee7rttts0ceJEdezYUXa7Xd99950++eQTJScnq0ePHnrqqad07Ngx9e3bVy1bttTZs2c1b948+fj4qHfv3pKkwYMHO+5h1KRJEx09elRz585V69at1a5dO0nS8OHD9dRTT+m+++7TlClTVFpaqr///e+y2WxVPt558+apZ8+e6tWrlx599FFFRkaqsLBQhw4d0gcffOB0hRhQ53l6hTSAK+tiV2NZrVajc+fOxssvv2yUlpY6jdcvrsYyDMP4+uuvjcGDBxtWq9Xw9fU1OnXqdNGrpo4ePWqMGDHCCAkJMXx8fIzrr7/eePHFFw2bzeY07tixY8Y999xjNGzY0AgMDDTuueceY+vWrS5djfXJJ58Y999/v9G4cWPD39/fGDhwoHHw4EGnsb179zZ+85vfXHQ/RUVFxl/+8hfj+uuvN3x9fQ2r1WpER0cbEydONPLy8gzDMIz09HQjPj7eaNGiheHr62s0bdrUGDhwoJGRkeHYz+zZs42YmBgjNDTU8PX1NVq1amWMGTPGOHLkiNPnrV271ujcubPh7+9vXHPNNUZqauolr8YaN27cRWvOzs42fv/73xstWrQwfHx8jCZNmhgxMTFOV6ABMAyLYRiGx5IWAFTTkiVL9OCDD2rHjh1Od4QGgAtYswMAAEyNsAMAAEyN01gAAMDUmNkBAACmRtgBAACmRtgBAACmxk0FJdntdh0/flyBgYEXvZU8AACofQzDUGFhocLDw1Wv3qXnbwg7+ulZPb98gjMAALg65OTkqGXLlpfsJ+xICgwMlPTTD6tRo0YergYAAFRFQUGBIiIiHN/jl0LY0f89UbhRo0aEHQAArjL/bQkKC5QBAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpEXYAAICpcVNBAKZls9mUkZGh3NxcNW/eXL169ZKXl5enywJwhTGzA8CUVq1apbZt2yo2NlYjRoxQbGys2rZtq1WrVnm6NABXmEfDTkpKirp3767AwEA1bdpUiYmJ2r9/v9MYwzA0Y8YMhYeHy9/
"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",
"execution_count": 92,
"id": "5c174a9d-59b7-4efe-a0eb-a132388c1d2a",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"Text(0.5, 1.0, 'Chol / Age split by sex')"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAADZ7ElEQVR4nOzdd3hUZfbA8e/0SZ30DqH3DlJFUARFwcJaUERUdBVsrG11/a1ll9XVXV1de1sBUbEXFFGkidKbgAhSQ0nvdfr9/fGmTTITEgwEwvk8zzzKvTdz70zKPfO+5z1Hp2mahhBCCCFEK6Vv6QsQQgghhDiRJNgRQgghRKsmwY4QQgghWjUJdoQQQgjRqkmwI4QQQohWTYIdIYQQQrRqEuwIIYQQolWTYEcIIYQ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qA9+uij1cf+8ssvms1m03r37q3NmzdP++6777R7771X0+v19Z63rtWrV2s6nU6bPHmytmjRIm3ZsmXa22+/rU2dOrX6mOXLl2uA1qZNG+3SSy/VFi5cqM2fP1/r1KmTFh4eru3bt6/62EcffVSr+2dz1KhR2qhRozRN0zS73a4tXrxYA7Tp06dra9as0dasWaPt3bs34DU29vwOh0NLSEjQpkyZ4vP1LpdLS0pK0q688soG34sLLrhAi42N1V5//XVtxYoV2ueff6498sgj2oIFC6qPeeeddzSdTqdddtll2qeffqotXLhQmzBhgmYwGLTvv/+++rgFCxZogPb8889rmqZpGRkZWnx8vDZq1CjN7XY3eB1CtAQJdoQ4yTIzMzVAmzx5cqO/JjU1VbNarVpaWlr1toqKCi0qKkq79dZbq7dNnjxZs1gs2qFDh3y+fvz48VpwcLBWWFioaVrTgp3PP/9cMxgMWnZ29jGP/eGHHzRAe/DBBzVN0zSv16u1b99eS01N1bxeb/VxX3/9tQZor7zyis/XP/nkk/WCnQsuuEBLSUnRioqKfI694447NKvVquXn5we8nn//+98aUP26/akKNgYMGOBzjQcPHtRMJpN28803V287VrCjaZqWk5NT7zU0pKnnN5vNWlZWVvW2Dz74oF7Q609oaKg2a9asgPvLysq0qKgobeLEiT7bPR6P1rdvX23w4ME+22fMmKGZzWZtzZo12nnnnafFxcVp6enpjXrNQpxsMo0lxGmiX79+tG3btvrfVquVLl26+EwRLVu2jDFjxtCmTRufr73hhhsoLy/3OwVyLJ988gkjR46snp5pSFVictU0UdUUTlpams9UyMqVKwG46qqrfL7+mmuu8fm33W5n6dKlXH755QQHB+N2u6sfF110EXa7nbVr1wa8nrPOOqv6PB9++CFHjx4NeOy1117rs9IqNTWV4cOHs3z58mO+7ubQmPPPmDEDUMntVV588UV69+7NOeec0+DzDx48mDlz5jB79mzWrl2Ly+Xy2b969Wry8/OZNm2az/vs9Xq58MIL2bBhA2VlZdXH/+c//6Fnz56ce+65rFixgvnz55OYmPi73gMhThQJdoQ4yWJiYggODubAgQNN+rro6Oh62ywWCxUVFdX/zsvL83vDSUpKqt7fFC6Xi4ULF/KHP/zhmMeWlJTw0UcfMXjwYGJjYyksLKSwsJDLL78cnU5XHQhVXYfRaCQqKsrnOeLj433+nZeXh9vt5oUXXsBkMvk8LrroIgByc3MDXtM555zD559/jtvt5vrrryclJYVevXrx/vvv1zs2ISHB77amvmfHqzHnj4+P5+qrr+a1117D4/Gwbds2Vq1axR133HHM5//ggw+YNm0ab775JsOGDSMqKorrr7+ezMxMALKysgC44oor6r3XTz31FJqm+ZRDsFgsXHvttdjtdvr168fYsWN/71sgxAkjq7GEOMkMBgNjxozhm2++4ciRI6SkpDTbc0dHR5ORkVFve1XiakxMTJOe7/vvv6eoqIjLL7/8mMe+//77lJeXs379er+JzJ999hkFBQVERkYSHR2N2+0mPz/fJ+CpuvFWiYyMxGAwMHXqVG6//Xa/523fvn2D13XppZdy6aWX4nA4WLt2LU8++STXXnst7dq1Y9iwYQHPXbXNX5B5IjT2/HfffTfvvPMOX3zxBYsXLyYiIoIpU6Yc8/ljYmJ47rnneO655zh06BBffvklDz74INnZ2SxevLj6Z+OFF15g6NChfp+jdjC6Y8cOHnnkEc466yw2bNjAs88+yz333NOUlyzESSMjO0K0gIceeghN07jllltwOp319leNqDTVmDFjWLZsWb1VOfPmzSM4ODjgTSyQTz75hKFDh5KcnHzMY9966y3CwsJYunQpy5cv93n861//wuFw8O677wIwatQoQI021LZgwQKffwcHB3PuueeyZcsW+vTpw6BBg+o9GhuMWCwWRo0axVNPPQVQb6XV+++/j6Zp1f9OS0tj9erVTa6VU7W6rvaIW2M09vwDBw5k+PDhPPXUU7z77rvccMMNhISENOlcbdu25Y477mDs2LFs3rwZgBEjRhAREcHOnTv9vs+DBg3CbDYDqu7SlVdeSbt27Vi+fDl33HEHDz74IOvWrWvSdQhxssjIjhAtYNiwYbzyyivMnDmTgQMHMmPGDHr27InL5WLLli28/vrr9OrVq1F1bWp79NFH+eqrrzj33HN55JFHiIqK4t133+Xrr7/m6aefxmazNfq5PB4PX3zxBQ8++OAxj92xYwfr169nxowZnHfeefX2jxgxgmeeeYa33nqLO+64gwsvvJARI0Zw7733UlxczMCBA1mzZg3z5s0DQK+v+Rz2/PPPc/bZZzNy5EhmzJhBu3btKCkpYe/evSxcuJBly5YFvK5HHnmEI0eOMGbMGFJSUigsLOT555/HZDJVB1xVsrOzufzyy7nlllsoKiri0UcfxWq18tBDDzX2LQMgLCyM1NRUvvjiC8aMGUNUVBQxMTG0a9euwa9ryvnvvvturr7
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.linear_model import LinearRegression\n",
"import numpy as np\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",
"sick = np.array(y)[:,0] != 0\n",
"\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",
"plt.title('Chol / Age split by sex')"
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "b3d627cf-3ec9-4cd9-bee6-5baeb9d1a22d",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"Text(0.5, 1.0, 'Blood pressure / Age split by sex')"
]
},
"execution_count": 97,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAADQDklEQVR4nOzdd3xT1fvA8U920r1bOmjLHmXvIXurgKCgOAEXuFBw/9wDJ24EUUFRcX5BRfbeG0Q2lAIFuvdKmnF/f1waCElKC92c9+uVl+bem3tPBs2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MwGw2o1arefzxx6/p+Qu1z5XnZQpCLde6dWuWL1/OsWPHnHpkSgQGBpKUlOS0/fz58wAEBQWV+7gdO3Y4HVfWBOXSjk9OTqZRo0YO2y5PAC5pi8Fg4Ntvv3V57pK2AowYMYIRI0ZgMpnYtm0b06dPZ9y4ccTExNCtWzfUajVPPfUUTz31FNnZ2axatYoXXniBwYMHk5iYiIeHB3q9HpPJ5HQdd1/wl7fZ398flUrF3XffzSOPPOLyMbGxsS63A+Tk5LB69eoyTaM+duwYmzZtAqB+/fouj1m+fDnDhg0jMDAQkAOZyyUnJzv07pTnNXelVatW/Pzzz0iSxP79+5k3bx6vv/46BoOB5557zuG6rtoC2Ntbmcp6/XHjxvHss8/yxRdf0LVrV5KTk92+t5e60uetvJ+VgoIC7r77bpo0aUJKSgr
"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",
"sick = np.array(y)[:,0] != 0\n",
"\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",
"plt.title('Blood pressure / Age split by sex')"
]
},
{
"cell_type": "code",
"execution_count": 129,
"id": "3a6dc91a-f3e9-4d7e-9e4b-58c59d24463c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"<Axes: >"
]
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAHNCAYAAAAXN9H8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6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0ZERFR6BjrkJBW9S3Ts7Oxw6NAhLFiwANnZ2XBxccHcuXPRoUMHAICVlRVmz56N0NBQWFtbw8fHB6NHj8bjx4/Ru3dv9OvXD506dQIADBgwAH/88QeCg4Nx6NAhGBuzp4aIiPSMgT4WLhW9S3S8vLwQExNT4uu9evVCr169in3t7NmzRco2b94sWduIiIhkxx4djfRuMjIRERHRy9K7Hh0iIiJ6BoeuNGKiQ0REpM84dKURh66IiIjolSxevBhubm6wsLCAr68vDh8+rLH+2rVrUbduXVhZWcHJyQmfffYZbt26pdU2MtEhIiLSZzra1HPDhg0YPXo0wsPDkZiYiObNm6NDhw7IyMgotv6RI0fQp08fDBgwAGfPnsWvv/6KEydOYODAgVK8CyViokNERKTPdLQFxLx58zBgwAAMHDgQXl5eWLBgAZydnbFkyZJi6x87dgyurq4YOXIk3Nzc0KxZMwwePBjx8fFSvAslYqJDREREAJ5uZJ2dna12PL+xNQA8efIECQkJCAwMVCsPDAxEXFxcsdcOCAjAv//+ix07dkAIgWvXrmHjxo147733tHIvhTgZ+RU
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"corr = df.corr()\n",
"\n",
"sns.heatmap(corr)"
]
}
],
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}