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",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <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",
2024-06-07 15:16:29 +02:00
" <td>1</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>67</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <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",
2024-06-07 15:16:29 +02:00
" <td>0</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>67</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <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",
2024-06-07 15:16:29 +02:00
" <td>0</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>37</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <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",
2024-06-07 15:16:29 +02:00
" <td>1</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>41</td>\n",
2024-06-07 15:16:29 +02:00
" <td>female</td>\n",
2024-05-08 08:48:17 +02:00
" <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",
2024-06-07 15:16:29 +02:00
" <td>1</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2024-06-07 15:16:29 +02:00
" age sex cp trestbps chol fbs restecg thalach exang oldpeak \\\n",
"0 63 male 1 145 233 1 2 150 0 2.3 \n",
"1 67 male 4 160 286 0 2 108 1 1.5 \n",
"2 67 male 4 120 229 0 2 129 1 2.6 \n",
"3 37 male 3 130 250 0 0 187 0 3.5 \n",
"4 41 female 2 130 204 0 2 172 0 1.4 \n",
2024-05-08 08:48:17 +02:00
"\n",
2024-06-07 15:16:29 +02:00
" slope ca thal goal \n",
"0 3 0.0 6.0 1 \n",
"1 2 3.0 3.0 0 \n",
"2 2 2.0 7.0 0 \n",
"3 3 0.0 3.0 1 \n",
"4 1 0.0 3.0 1 "
2024-05-08 08:48:17 +02:00
]
},
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",
2024-06-07 15:16:29 +02:00
"df['sex'].replace({0: 'female', 1: 'male'}, inplace=True)\n",
2024-06-07 11:20:34 +02:00
"\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",
2024-05-08 08:48:17 +02:00
"df.head()"
]
},
2024-06-05 11:20:55 +02:00
{
"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 15:16:29 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAGxCAYAAACEFXd4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA0jUlEQVR4nO3deXxU9b3/8fcYkkkCyYQkJjMpIUSMVA2yerVBS5DNEEABZa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93/+tP//5z+et91yvvvqq2rVrJ6fT6amtultne/bsUUpKinbv3q2XX35Z77//vm644QZlZGRowoQJFfo/9dRTOnDggP7617/qzTff1N69e9WjRw+dOXPmomsFjGEBMN6sWbMsSdbrr79uWZZlFRcXWw0aNLBuv/12r35/+ctfLEnW0qVLvdoffvhhS5I1ffp0T9vPf/5zq1WrVtapU6e8+nbv3t1yuVzWmTNnqqzntddesyRZH3zwgVf70KFDKxxnzJgx1o/fqubPn29JsrZv317l+N9++60lyRozZkyFbWfHe+6556rc9mMJCQmWzWarcLzOnTtb4eHh1rFjxyzLsqzp06dbkqzc3FyvfqtXr7YkWatXr/a0paenWwkJCZXWfm7d/fv3t+x2u3Xw4EGvfmlpaVZoaKh19OhRr+N069bNq9+7775rSbI2bdpU6fGAKwFXdoArwLRp0xQSEqL+/ftLkho0aKB7771X69ev1969ez391q5dq7CwMN15551e+w8YMMBrfd++ffrHP/6hQYMGSZJOnz7tWbp166b8/Pxqb52sXr1aYWFh6tmzp1f7wIEDz3suLVu2VFBQkB566CHNnDlT//znP8+7T2X69OlzwX1vvPFGtWjRwqtt4MCBcrvd2rZt2yUd/0KtWrVKHTt2VHx8vFd7RkaGjh8/XuGq0Lk/05tuukmSdODAgVqtE/BnhB3AcPv27dO6deuUnp4uy7J09OhRHT16VPfcc4+k/3xDS5IOHz6s2NjYCmOc2/bvf/9bkjRq1CgFBgZ6LY888ogk6bvvvquypqqO43Q6z3s+TZs21YoVKxQTE6Nhw4apadOmatq0qSZPnnzefX/M5XJdcN/K6jrbdvjw4Ys67sU6fPhwpbXGxcVVevyoqCivdbvdLumHW4fAlaqerwsAULveeustWZal+fPna/78+RW2z5w5U88//7wCAgIUFRWlTz/9tEKfcycOR0dHS5JGjx6t3r17V3rcZs2aVVnThR6nKrfffrtuv/12nTlzRlu2bNErr7yizMxMxcbGeq5enc/FPLunsrrOtp0NF8HBwZKk0tJSr37Vhb4LERUVpfz8/Art33zzjaT//C4AVI0rO4DBzpw5o5kzZ6pp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eeecbXpQHAJeE2FgAAMBpfPQcAAEYj7AAAAKMRdgAAgNGYoCypvLxc33zzjcLCwi7qEfIAAMB3LMtScXGx4uLivB56ei7Cjn74GzPn/kVhAABQNxw6dKjaR2MQdiTP3/A5dOiQwsPDfVwNAAC4EG63W/Hx8dX+LT6JsCPpP3/9ODw8nLADAEAdc74pKExQBgAARiPsAAAAoxF2AACA0Zizc4Esy9Lp06d15swZX5dyxQsICFC9evV4TAAA4IIQdi5AWVmZ8vPzdfz4cV+Xgv8vNDRULpdLQUFBvi4FAODnCDvnUV5ertzcXAUEBCguLk5BQUFcUfAhy7JUVlamb7/9Vrm5uUpKSqr2QVIAABB2zqOsrEzl5eWKj49XaGior8uBpJCQEAUGBurAgQMqKytTcHCwr0sCAPgx/pf4AnH1wL/w+wAAXCg+MQAAgNEIOwAAwGjM2blETZ5cfFmPlzc+/aL3SU1NVcuWLTVp0qS
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
2024-06-07 15:16:29 +02:00
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"201\n"
]
2024-05-08 08:48:17 +02:00
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"\n",
2024-06-07 15:16:29 +02:00
"counts_male = sum(X['sex'] == 'male')\n",
"counts_female = sum(X['sex'] == 'female')\n",
2024-06-07 11:20:34 +02:00
"\n",
2024-06-07 15:16:29 +02:00
"counts_male_sick = sum(np.all([X['sex'] == 'male',\n",
2024-06-07 11:20:34 +02:00
" y > 0], axis=0))\n",
2024-06-07 15:16:29 +02:00
"counts_female_sick = sum(np.all([X['sex'] == 'female',\n",
2024-06-07 11:20:34 +02:00
" y > 0], axis=0))\n",
2024-05-08 08:48:17 +02:00
"\n",
2024-06-07 15:16:29 +02:00
"plt.bar([1, 0], [counts_male, counts_female])\n",
"plt.bar([1, 0], [counts_male_sick, counts_female_sick])\n",
"plt.xticks([1, 0],['male', 'female'])\n",
"plt.ylabel('n')\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-06-07 15:16:29 +02:00
"plt.show()\n",
"print(counts_male)"
2024-05-08 08:48:17 +02:00
]
},
{
"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/l8L7iMMUYAAACWusTpAgAAAH4LwgwAALAaYQYAAFiNMAMAAKxGmAEAAFYjzAAAAKsRZgAAgNUIMwAAwGqEGQAAYDXCDFBHvPzyy3K5XOrYsaPTpVRqz549crlcWrJkia8tKSlJLperSsc5fPiwkpKStHnz5ip9rrJztW7dWrfeemuVjnMuy5Yt05w5cyrtc7lcSkpKqtHzASDMAHXGokWLJEm5ubn63//9X4erOT9jx47Vli1bqvSZw4cPa/r06VUOM9U5V3WcLcxs2bJFY8eOrfUagIsNYQaoA7Zt26YvvvhC8fHxkqSFCxc6XNH5ufLKK3X99dfX6jkOHz58wc51Ltdff72uvPJKR2sA6iLCDFAHnAovM2bMUExMjJYvX+77JX667777TnfddZdCQkJ02WWXaeTIkcrKyqpw+Uf6JSDdfvvtatq0qRo2b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HDgrJc2Nm3apJCQEN1+++1+7SNGjDjnd+natasaNGigP/3pT0pLS9Pu3bvP+ZnKDBky5LzHdujQQV26dPFrGzFihEpLS/X5559X6/zna+PGjerfv78iIyP92kePHq3Dhw9XWNX59Zx27txZkrR3795arRMIdIQZwGLffvutPvroI8XHx8sYo+LiYhUXF+uuu+6S9H9POEnSwYMH5fF4Khzj123//ve/JUmPP/646tev77eNHz9ekvTDDz+csaYzncfr9Z7z+7Rp00YffvihWrRooQkTJqhNmzZq06aNXnrppXN+9nTh4eHnPbayuk61HTx4sErnraqDBw9WWmtERESl52/WrJnfvtvtlvTLpT3gYlbP6QIAVN+iRYtkjNGKFSu0YsWKCv1paWl67rnndOmll6pZs2baunVrhTG/vjH38ssvlyQlJiZq8ODBlZ63Xbt2Z6zpfM9zJn369FGfPn104sQJbdu2Ta+88ooSEhLk8Xh8q0/nUpV311RW16m2U+GhYcOGkqTy8nK/cWcLdeejWbNmOnDgQIX2/fv3S/q//y0AnB0rM4ClTpw4obS0NLVp00abNm2qsD322GM6cOCA1q5dK0nq27evysrKfPunLF++3G+/Xbt2io6O1hdffKHu3btXuoWEhJyxrhtvvFFlZWVavXq1X/uyZcuq9P0uvfRS9ezZU3/9618lyXfJp6ZXI3Jzc/XFF1/4tS1btkwhISG69tprJf3ycj1J2rFjh9+4X3/HU/Wdb239+/fXxo0bfeHllKVLlyo4ONjxR8kBW7AyA1hq7dq12r9/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": [
2024-06-07 15:16:29 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-07 15:16:29 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB9RklEQVR4nO3dd3hUZdrH8e+ZmkwaIYEUCCFAqAGpIk2KgCugrl3EgoC4UhRQwSBgRCUCCqi4qKyyuMq6Nl4LKihSVEBBQOm9RCAEQnoyM5mZ8/4xzGgAkZLkTLk/1zUXnDPtztTfPOcpiqqqKkIIIYQQfkqndQFCCCGEEJdD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oqhDCr7399tsqoL722muqqqpqUVGRGh4ernbr1q3C5V599VUVUL/88ssK+x988EEVUBcsWODd17RpU7VNmzZqeXl5hcsOGDBATUhIUJ1O55/WM2/ePBVQP/nkkwr7H3jggbPu56mnnlL/+DH04YcfqoC6efPmP739EydOqID61FNPnXWe5/amTJnyp+f9UXJysqooyln316dPHzUyMlItKSlRVVVVFyxYoALqgQMHKlxuxYoVKqCuWLHCu69///5qcnLyOWs/s+4777xTNZvN6uHDhytc7rrrrlMtFouan59f4X769etX4XLvv/++Cqhr16495/0JESykZUYIP/fmm28SGhrKnXfeCUB4eDi33XYb3333HXv27PFebtWqVURERPC3v/2twvUHDhxYYXvv3r3s3LmTQYMGAeBwOLynfv36cezYsfMe2lixYgURERHccMMNFfbfddddf/m3tG7dGpPJxPDhw1m4cCH79+//y+ucyy233HLBl23RogVXXHFFhX133XUXhYWFbNy48ZLu/0J9++23XHPNNSQlJVXYP3jwYEpLS89q1TnzMW3VqhUAhw4dqtI6hfB1EmaE8GN79+5l9erV9O/fH1VVyc/PJz8/n1tvvRX4fYQTQG5uLnFxcWfdxpn7jh8/DsBjjz2G0WiscBoxYgQAJ0+e/NOa/ux+4uPj//LvadiwId988w21a9dm5MiRNGzYkIYNG/LSSy/95XX/KCEh4YIve666PPtyc3Mv6n4vVm5u7jlrTUxMPOf9x8TEVNg2m82A+9CeEMHMoHUBQohL99Zbb6GqKh9++CEffvjhWecvXLiQZ599Fr1eT0xMDD/99NNZlzmzY25sbCwA6enp3Hzzzee83yZNmvxpTRd6P3+mW7dudOvWDafTyYYNG3jllVcYM2YMcXFx3tanv3Ixc9ecqy7PPk94CAkJAcBms1W43PlC3YWIiYnh2LFjZ+0/evQo8PtzIYQ4P2mZEcJPOZ1OFi5cSMOGDVmxYsVZp0cffZRjx47x5ZdfAtC9e3eKioq82x7vvfdehe0mTZqQmprKL7/8Qvv27c95ioiI+NO6evbsSVFREZ9++mmF/YsWLbqov0+v19OxY0deffVVAO8hn8pujdi2bRu//PJLhX2LFi0iIiKCtm3bAu7J9QB+/fXXCpc782/01HehtV1zzTV8++233vDi8fbbb2OxWDQfSi6Ev5CWGSH81JdffsnRo0eZPn06PXr0OOv8tLQ05s6dy5tvvsmAAQO47777mD17NnfffTfPPvssjRo14ssvv2Tp0qUA6HS//7Z5/fXXue6667j22msZPHgwderU4dSpU+zYsYONGzeeNVLqj+69915mz57Nvffey3PPPUdqaipffPGF937O57XXXuPbb7+lf//+1KtXD6vV6j1U1rt3bwAiIiJITk7mk08+4ZprrqFmzZrExsZ6A8fFSkxM5IYbbiAjI4OEhATeeecdvv76a6ZPn47FYgGgQ4cONGnShMceewyHw0F0dDSLFy/m+++/P+v2WrZsyccff8y8efNo164dOp2O9u3bn/O+n3rqKT7//HN69uzJlClTqFmzJu+++y5LlixhxowZREVFXdLfJETQ0boHshDi0vz9739XTSaTmpOT86eXufPOO1WDwaBmZ2erqqqqhw8fVm+++WY1PDxcjYiIUG+55Rb1iy++OOfoo19++UW9/fbb1dq1a6tGo1GNj49Xe/Xq5R01dT6//fabesstt1S4nzVr1vzlaKa1a9eqN910k5qcnKyazWY1JiZG7d69u/rpp59WuP1vvvlGbdOmjWo2m1VAve+++yrc3okTJ86q6c9GM/Xv31/98MMP1RYtWqgmk0mtX7++OmvWrLOuv3v3brVv375qZGSkWqtWLXX06NHqkiVLzhrNdOrUKfXWW29Va9SooSqKUuE+OccorC1btqjXX3+9GhUVpZpMJvWKK66o8Bip6u+jmT744IMK+w8cOHDWYypEMFJUVVU1ylFCCB8wbdo0Jk2axOHDh2V2WiGEX5LDTEIEkblz5wLQtGlTysvL+fbbb3n55Ze5++67JcgIIfyWhBkhgojFYmH27NkcPHgQm81GvXr1mDBhApMmTdK6NCGEuGRymEkIIYQQfk2GZgshhBDCr0mYEUIIIYRfkzAjhBBCCL8W8B2AXS4XR48eJSIi4qKmOBdCCCGEdlRVpaioiMTExAqTep5LwIeZo0ePnrUirRBCCCH8Q1ZW1l9OHRHwYcazhkxWVhaRkZEaVyOEEEKIC1FYWEhSUtJ514LzCPgw4zm0FBkZKWFGCCGE8DMX0kVEOgALIYQQwq9JmBFCCCGEX5MwI4QQQgi/JmFGCCGEEH5NwowQQggh/JqEGSGEEEL4NQkzQgghhPBrEmaEEEII4dckzAghhBDCr0mYEUIIIYRfkzAjhBBCCL8mYUYIIYQQfk3CjBBCCCH8WsCvmi2EECIwrFixgh9//JE2bdpw7bXXal2O8CGKqqqq1kVUpcLCQqKioigoKCAyMlLrcoQQQlwCVVXp06cPDocDgKVLl2I2mzWuSlSli/n+lsNMIqCoqkpWVhYul0vrUoQQlaisrMwbZACKi4s1rEb4Ggk
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+wAAACrEXYAAIDVCDsAAMBqhB0AAGA1wg4AALAaYQcAAFiNsAOc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ysLI0ZM0ZXX321Dh06pE2bNrkvWd19993atWuXnn/+ec2bN0/NmjWTJF100UWSfg16Y8aM0Z133qkxY8aooqJCTz31lP7whz9o5cqV7n6SVFFRoeuvv1733HOPRo8ercOHD5/wNVqwYIHy8/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/68i98vBw8erNA4CQkJWr58eYWeU9qxoqOj1a5duwqNcymrV68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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-06-07 15:16:29 +02:00
"id": "abe0020f-8588-48bf-af58-f67b326cdd25",
"metadata": {},
2024-05-08 08:48:17 +02:00
"outputs": [
2024-06-07 15:16:29 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-07 15:16:29 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArcAAAIhCAYAAABUopIpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwg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Qlu2bNH1119vt0/jxo1122236ZdfflFKSor27Nmj1q1bq0WLFjp48KAOHDhgu2tdVlamFStWOPSzGzZsqG7dumnLli1q06aNPD09z7rvwoULdd1116l58+Zn3efyyy/Xk08+qYULF2rz5s2SpPj4eLm7u2v37t1/WFJPf0gvLi5OK1eu1IABAzR06FBdc801Dv8+AdRNlFsAF43t27ervLxc0u9vc3/00UdauXKl+vfvf85C8vTTT2vJkiXq1q2bJk2apMDAQM2fP19Lly7V1KlTFRAQIEkaPXq03nnnHf3lL3/Rs88+q6ioKC1dulSvvvqqHn74YV1++eWSpHvuuUfTp0/XPffco+eff16tWrXSsmXLHC56p23cuFH333+/br/9duXl5WnixIlq3ry5hg0b9oevTUlJ0cKFC9WlSxeNHj1abdq0UWVlpXJzc/X5559r7Nix6tSpkyZNmqT8/Hz16NFD4eHhOnr0qGbOnCkPDw/FxcVJkvr162dbQ7hp06bau3evZsyYoaioKLVq1UqSlJSUpEmTJumOO+7Qo48+qpKSEr3yyiuqqKhw+Hxnzpypzp0768Ybb9TDDz+sFi1a6NixY/rpp5/06aef6ssvv1RFRYU+/vhjTZgwwe6
2024-05-08 08:48:17 +02:00
"text/plain": [
2024-06-07 15:16:29 +02:00
"<Figure size 800x600 with 1 Axes>"
2024-05-08 08:48:17 +02:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-07 15:16:29 +02:00
"plt.figure(figsize=(8, 6))\n",
"sns.boxplot(x='sex', y='trestbps', data=df)\n",
"plt.title('Blood pressure/sex')\n",
"plt.xlabel('sex')\n",
2024-05-08 08:48:17 +02:00
"plt.ylabel('Blood pressure (rest)')\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": [
2024-06-07 15:16:29 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-07 15:16:29 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADo8ElEQVR4nOzdd3hUZfbA8e/0STKT3iuh995RqoioWLBRFsGu2FDcte0qrv50rYtr72DFjqKCiBSV3qX3GtJ7m35/f1wyYchMSCAQiOfzPHkk971z7ztjkjnzlnM0iqIoCCGEEEI0UdrG7oAQQgghxOkkwY4QQgghmjQJdoQQQgjRpEmwI4QQQogmTYIdIYQQQjRpEuwIIYQQokmTYEcIIYQQTZoEO0IIIYRo0iTYEUIIIUSTJsGOEI3ozz//5IYbbiA9PR2z2YzFYqF79+4899xzFBQUeM9r1qwZl156aYPdd//+/Wg0GmbMmFHnx4wePZrLL7+8Tud+//33aDQaoqKisNvtJ9nLs8+0adPQaDQ+xwYPHszgwYO931dUVDBt2jQWL15cp2suXrwYjUbDV1991YA9FUIcS9/YHRDir+qdd95h8uTJtGnThr///e+0b98ep9PJmjVrePPNN1m+fDnffvttY3cTgPLycubNm8ebb75Zp/Pfe+89AAoKCpg9ezbXXXfd6exeo3r99dd9vq+oqOCJJ54A8AmChBCNR4IdIRrB8uXLueOOOxg+fDizZ8/GZDJ524YPH87UqVOZN29eI/bQ108//YTL5WLUqFEnPDcrK4uffvqJoUOHsmzZMt57770mHey0b9++sbsghDgBmcYSohE8/fTTaDQa3n77bZ9Ap4rRaOSyyy6rcXzevHl0796doKAg2rZty/vvv1/jnM2bN3P55ZcTERGB2Wyma9euzJw585T6+/XXXzN06FAiIiJOeO7MmTNxuVzcd999jB49ml9//ZUDBw7UOK+oqIibbrqJyMhILBYLl1xyCXv37kWj0TBt2jSfc3ft2sW4ceOIjY3FZDLRrl07XnvttTr1/csvv6RPnz6EhYURHBxM8+bNufHGG73tVdNIH3/8Mffffz/x8fEEBQUxaNAg1q9ff8LrHzuNtX//fmJiYgB44okn0Gg0aDQaJk2adMLr2Gy2Wu//0UcfodFoWL58eY3H/vvf/8ZgMHDkyJGA18/NzeXWW28lJSUFk8lETEwMAwYMYMGCBT7nLViwgGHDhhEaGkpwcDADBgzg119/9bbv2rWL0NBQrrnmGp/HLVy4EJ1Ox7/+9a8TPlchzjhFCHFGuVwuJTg4WOnTp0+dH5OWlqYkJycr7du3Vz788EPl559/Vq655hoFUJYsWeI9b/v27YrValVatGihfPjhh8qPP/6ojB07VgGUZ5991nvevn37FED54IMPTnjvyspKxWKxKG+//Xad+tq6dWslISFBcblcyoIFCxRAmTZtms85brdbOe+88xSz2az85z//UebPn6888cQ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jvX444/zww8/MGTIEB577DEiIyP55JNP+PHHH3nuuecICwur87XcbjffffcdDz300AnP3bx5M6tWreKOO+5g6NChNdoHDBjAiy++yHvvvcddd93FRRddxIABA5g6dSolJSX06NGD5cuX8+GHHwKg1VZ/Dnv55Zc577zzOP/887njjjto1qwZpaWl7N69mzlz5rBw4cKA/Xrsscc4fPgww4YNIzk5maKiIl5++WUMBoM34KqSk5PDlVdeyS233EJxcTGPP/44ZrOZhx9+uK4vGQBWq5W0tDS+++47hg0bRmRkJNHR0TRr1qzWx9Xn/vfeey/XXXcdGo2GyZMnn7BPxcXFDBkyhHHjxtG2bVu
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",
"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.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": [
2024-06-07 15:16:29 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-07 15:16:29 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADcKElEQVR4nOzdd3hTZfvA8W9207136WBD2XsomwIKKAgoDgTUVwQVFOfPra+8DlwogqggLlRQRGTvvUVkz0KB7t2m2ef3RyQQkpQWunk+19VLe56Tc+6kobn7rFsmSZKEIAiCIAhCHSWv7gAEQRAEQRAqk0h2BEEQBEGo00SyIwiCIAhCnSaSHUEQBEEQ6jSR7AiCIAiCUKeJZEcQBEEQhDpNJDuCIAiCINRpItkRBEEQBKFOE8mOIAiCIAh1mkh2hDph3rx5yGQyh6+QkBB69uzJ0qVLnc6XyWS89tprVR5ncnIyMpmMefPmVfm9byaffPIJQUFBmM3ma56blZWFRqNBJpOxZ8+eKoiuamzYsAGZTMaGDRvsx1577TVkMpnDeTNnzizX+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4fEx8f7/I4QH5+PmvXri3TMurjx4+zZcsWAOrVq+fynJUrVzJo0CCCgoIAWyJztbS0NIfenfK85q60aNGCBQsWIEkSBw4cYN68ebzxxhtotVqef/55h/u6igWwx1uZynr/0aNH89xzz/HZZ5/RuXNn0tLS3P5sr3St91t53yvFxcXcf//9NGrUiPT0dB566CF+//3
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",
"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.show()"
2024-05-08 08:48:17 +02:00
]
},
{
"cell_type": "code",
2024-06-07 15:16:29 +02:00
"execution_count": 47,
2024-05-08 08:48:17 +02:00
"id": "3a6dc91a-f3e9-4d7e-9e4b-58c59d24463c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-07 15:16:29 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAHNCAYAAAAXN9H8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABzXUlEQVR4nO3deVyN6f8/8Ndp30NR2VoUimTJUvZBWQaDGQYTxj52IdMn2U3DWArDjG0wYwZjG4OJ7BRGKWu2SIZibJHltJz794df5+tMOcR9d3eO13Me9+NR17nO/b7uw+TdtSoEQRBAREREpIcM5G4AERERkVSY6BAREZHeYqJDREREeouJDhEREektJjpERESkt5joEBERkd5iokNERER6i4kOERER6S0mOkR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aOjI0qVKoVFixZJ8iz5mOgQERHpMhFXXRW20vjVUZH/+u+qZUEQXruS+cKFCxg1ahQmT56MhIQEREdH4/r16xrTS6Sgd3N0XsfFxQWCIMjdDCIiInGJuP+NqakpTE1N31jP3t4ehoaGBXpv7t69W6CXJ19ERAQaN26MCRMmAABq1aoFS0tLNG3aFDNnzoSTk9P7P0Ah2KNDRERERWJiYoJ69eohJiZGozwmJgb+/v6FvufZs2cwMNBMOwwNX27XImVHxAfTo0NERKSXZNrRODg4GEFBQfD19YWfnx+WLVuGtLQ09VBUaGgobt26hbVr1wIAOnbsiEGDBmHp0qUIDAxEeno6xowZgwYNGqB
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-07 15:16:29 +02:00
"corr = df.loc[:,df.columns!='sex'].corr()\n",
2024-05-08 08:48:17 +02:00
"\n",
2024-06-07 11:20:34 +02:00
"sns.heatmap(corr)\n",
"plt.show()"
2024-05-08 08:48:17 +02:00
]
2024-06-07 15:16:29 +02:00
},
{
"cell_type": "markdown",
"id": "038d8abb-e88f-472d-95c4-bc0c51695196",
"metadata": {},
"source": [
"### Cholesterinwerte im Vergleich Frauen/Männer"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "48e6d986-b7f9-45e6-8bf2-32e687eb132d",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArcAAAIhCAYAAABUopIpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABGy0lEQVR4nO3dd3xUVf7/8fclbdITAiQEQi/Sq7BENGCAUKWorGCBhe/KGmBBQBRRigWU3UVYUFwR6cjqCsqiAUJ1MaCRogiKSkcJUVooSYDk/P7gxzwcQ8mkMHB5PR+PeTwy556593PvTCbvnDlzr2WMMQIAAABsoISnCwAAAACKCuEWAAAAtkG4BQAAgG0QbgEAAGAbhFsAAADYBuEWAAAAtkG4BQAAgG0QbgEAAGAbhFsAAADYBuEWuIV8/fXX+tOf/qTKlSvL4XAoKChIjRs31qRJk3T8+HFnv0qVKqlz585Ftt39+/fLsizNmTOnyNb5WykpKRo3bpxOnjxZLOvv27evKlWqVCzrLk6LFi3SlClTPF1GkWnVqpXq1q1bqHVkZ2fr9ddfV1xcnCIiIuTj46OIiAi1atVK//rXv3T69OkiqrZgLMvSoEGDrttvzpw5sixL+/fvL5Y6Lq//yy+/vG7fN954o9h+twFPINwCt4iZM2eqSZMmSk1N1VNPPaUVK1Zo6dKlevDBB/Xmm2+qf//+ni6xwFJSUjR+/PhiC7fPP/+8li5dWizrLk52C7eF9csvvyg2NlbDhg1TzZo19dZbb2nt2rWaNWuW6tevr5EjRyoxMdHTZd5yCLewG29PFwDg+jZt2qQnnnhCbdu21Ycffig/Pz/nsrZt22r48OFasWKFByu8OZ07d04BAQGqWrWqp0txy+W64eqRRx7Rjh07tHr1at1zzz0uy7p166axY8cqKSnJQ9UBuFkwcgvcAiZMmCDLsvTWW2+5BNvLfH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CwMJOenn7VOi6vPzEx0aV90qRJRpI5cuSIs61OnTomLi7umvsF3EqYlgDYVMOGDVWhQgXnfYfDoRo1aujAgQPOtrVr1yo+Pl4xMTEuj+3bt6/OnTunTZs2XXHdWVlZWrNmjbp3766AgABdvHjReevYsaOysrK0efNmSVKzZs301VdfKTExUStXrlRGRka+92HlypW6ePGiHnvsMZdtOBwOxcXFuUxduOz+++/P9/pbt26t4OBg5/3IyEiVKVPG5RjFx8dr79692rdvn7KysrRx40a1b99erVu3VnJysqRLHyX7+fmpZcuWN6Tu5cuXKywsTF26dHFZf8OGDRUVFXXF9f+eZVnq0qWLS1v9+vVd9l269Bpp06aNQkND5eXlJR8fH40ZM0bHjh1Tenq6JCk5OVk5OTkaOHDgdbcbFRWlZs2aXXe7+fXRRx/Jx8fHeQsNDXUuy+9xatiwoXx9ffX4449r7ty52rt3b57tJCUlyeFwqF+/ftetKT+vq99LSUnR8ePH1adPH5dac3Nz1b59e6Wmpurs2bM6d+6cNmzYoJ49e6p06dLXreX305Xq168vSQU+3sCtgC+UATe5UqVKKSAgQPv27XPrcREREXna/Pz8lJmZ6bx/7NgxlS1bNk+/6Oho5/IrOXbsmC5evKhp06Zp2rRpV+zz66+/SpJGjRqlwMBALViwQG+++aa8vLx0zz336NVXX1XTpk2vuQ9Hjx6VJN15551XXF6ihOv/5wEBAQoJCbnmOn8rP8eoTZs2ki4F2MqVK+vChQu69957dfToUb344ovOZXfddZf8/f1vSN1Hjx7VyZMn5evre8Xll4/9tQQEBMjhcLi0+fn5KSsry3n/iy++ULt27dSqVSv
"text/plain": [
"<Figure size 800x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"df['sex'] = df['sex'].replace({0: 'female', 1: 'male'})\n",
"plt.figure(figsize=(8, 6))\n",
"sns.boxplot(x='sex', y='chol', data=df)\n",
"plt.title('Cholesterinwerte nach Geschlecht')\n",
"plt.xlabel('Geschlecht')\n",
"plt.ylabel('Cholesterin in mg/dl')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "3e85fdf6-3a77-41b0-bbc7-a407fbb1374f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Geschlecht Untere_Grenze Obere_Grenze\n",
"0 Männer 234.288517 246.199046\n",
"1 Frauen 249.044612 275.413721\n"
]
}
],
"source": [
"# Konfidenzintervall (95%) für Cholesterin Level jeweils für Männer und Frauen\n",
"from scipy import stats\n",
"\n",
"# Filtern nach Geschlecht und Berechnen des Konfidenzintervalls\n",
"conf_level = 0.95\n",
"chol_men = df.loc[df['sex'] == 'male', 'chol']\n",
"chol_women = df.loc[df['sex'] == 'female', 'chol']\n",
"conf_int_men = stats.t.interval(conf_level, len(chol_men) - 1, loc=chol_men.mean(), scale=stats.sem(chol_men))\n",
"conf_int_women = stats.t.interval(conf_level, len(chol_women) - 1, loc=chol_women.mean(), scale=stats.sem(chol_women))\n",
"\n",
"result_table_men_vs_women = pd.DataFrame({\n",
" 'Geschlecht': ['Männer', 'Frauen'],\n",
" 'Untere_Grenze': [conf_int_men[0], conf_int_women[0]],\n",
" 'Obere_Grenze': [conf_int_men[1], conf_int_women[1]]\n",
"})\n",
"\n",
"print(result_table_men_vs_women)"
]
},
{
"cell_type": "markdown",
"id": "4d6ef765-3785-4263-a72f-6e3ab5822d61",
"metadata": {},
"source": [
"### Cholesterin im Vergleich zur Erkrankung"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "fb8d7c02-936a-49c1-adfe-43943f7111d0",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
{
"data": {
"image/png": "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bubPn68HHnhAbdu21bx581S5cmX98MMP+u6771z6nTt3Tr1799bw4cM1fvx4ffXVV3r22WcVFBSkp59+Os/9X5xOeKlNmzZp3LhxqlevXr6OLzf9+/fXvffeqwcffFBnzpy5av/s7Oxc35OXjxTt2LFDe/fu1eTJk1WjRg2VKVMmx3MyMzM1dOhQffrpp/r4449zfJ8mTpyo1q1ba968eSpVqpQqV66sP/74Q5I0depUhYaG6vTp01qxYoXatWunNWvWOEPlRa+99ppuueUWvfzyy5IuTJHt3r27Dhw4oKCgoFyP8f3339fgwYM1bNgwvfrqq7lOSb2a/Pzs2rVrlzp16qTatWtr0aJF8vf317x587RkyRLj1wNQRGwAKGJJSUm2JPvee+/N93OqVatmOxwO+9dff3W2paen2xUqVLBHjBjhbLv33nttX19f++DBgy7P79atm+3v72+fOnXKtm3bPnDggC3JXrBggbNPly5d7PDwcDslJcXluQ8//LDtcDjsEydO2LZt2z179rQbN258xXpffPFFW5J94MABl/aDBw/a3t7e9ujRo13a09LS7NDQUHvAgAHOtiFDhtiS7LfffjvH/ocMGWJXq1bNpU2SHRISYqempjrbkpKS7FKlStkzZ868Yr25nY+pU6fakuyXXnrJpW/jxo1tSfby5cudbefOnbMrVapk9+/f/4qvY9u2vW7dOluSHRcX52xLTk62fX197YEDB9q2XTDn6dNPP7Ul2XPnznVpnzlzpi3Jnjp1qrNtwYIFLt+vM2fO2BUqVLB79erl8tysrCy7UaNGdsuWLfN8blpamh0YGGjffvvtdnZ2dp7n4WLd77//vkt79+7d7Tp16uT5vNz897//tYODg+327dvbmZmZtm3n/j296PLjv/i9fvrpp/P1ehe/h3k9Dh065OxbrVo128vLy963b1+udYwaNcpOTk62b7/9drtq1ar2N998k+trtWnT5qp1nT9/3j537pzdoUMHu1+/fs72i+eiQYMG9vnz553tW7ZssSXZ7777rrNtyJAhdpkyZWzbtu3nn3/e9vLysl944QWX17l4vi53+Xvh4vHn52fXX/7yF7tMmTL2H3/84WzLysqyo6Kicv1ZAsD9mNoHoNho3LixIiMjnV87HA7Vrl1bv/76q7Nt7dq16tChQ46RrqFDh+rPP//M8Vf8izIyMrRmzRr169dP/v7+On/+vPPRvXt3ZWRkOKcAtWzZUt9++61Gjhypzz//XKmpqfk+hs8//1znz5/X4MGDXV7D4XCobdu2LtP/Lrrrrrvyvf/27durbNmyzq9DQkJUuXJll3Nk6vJrmerWrSvLstStWzdnm7e3t2rWrJmv12nbtq1uvvlml+l9S5cuVWZmpnNaX0Gcp/Xr10u6MKJ2qb/+9a9XrTExMVEnTpzQkCFDXF4/OztbXbt21datW/McsUlMTFRqaqpGjhyZ6/SvS1mWpV69erm0NWzY0Oj7lZSUpK5du6pKlSpasWKFSpcune/nXs7kvSZJL7zwgrZu3ZrjERIS4tKvYcOGql27dq77OHDggFq3bq3U1FRt3rw5z+vj8qpt3rx5atq0qRwOh7y9veXj46M1a9Zo7969Ofr26NHDZUSpYcOGkpTjfNu2rREjRmjq1KmKj4+/4kh2fuTnZ9f69et
"text/plain": [
"<Figure size 1000x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Boxplot gruppiert nach Diagnose\n",
"plt.figure(figsize=(10, 6))\n",
"sns.boxplot(x='goal', y='chol', data=df)\n",
"plt.title('Cholesterin im Vergleich zur Erkrankung')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Cholesterin in mg/dl')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "f5d1a57a-8d24-4a23-a035-3e6d7fd7eb89",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"t-Statistik: -1.3834015443480652\n",
"p-Wert: 0.9162061164262881\n",
"Der p-Wert ist größer als oder gleich 0.05, daher wird die Nullhypothese nicht abgelehnt.\n",
"Es gibt keine signifikanten Hinweise darauf, dass der Cholesterinwert bei kranken Personen höher ist als bei gesunden Personen.\n"
]
}
],
"source": [
"# t-Test\n",
"# Nullhypothese (HO) = Cholesterinwert bei Kranken ist gleich oder kleiner wie bei Gesunden\n",
"# Alternativhypothese (H1) Cholesterinwert bei Kranken ist höher als bei Gesunden\n",
"\n",
"from scipy.stats import ttest_ind\n",
"\n",
"# Daten für gesunde und kranke Personen\n",
"chol_healthy = df.loc[df['goal'] == 0, 'chol']\n",
"chol_sick = df.loc[df['goal'] == 1, 'chol']\n",
"\n",
"# Durchführung des t-Tests\n",
"t_statistic, p_value = ttest_ind(chol_sick, chol_healthy, alternative='greater')\n",
"\n",
"# Ausgabe der Ergebnisse\n",
"print(\"t-Statistik:\", t_statistic)\n",
"print(\"p-Wert:\", p_value)\n",
"\n",
"# Überprüfung der Nullhypothese\n",
"if p_value < 0.05:\n",
" print(\"Der p-Wert ist kleiner als 0.05, daher wird die Nullhypothese abgelehnt.\")\n",
" print(\"Es gibt signifikante Hinweise darauf, dass der Cholesterinwert bei kranken Personen höher ist als bei gesunden Personen.\")\n",
"else:\n",
" print(\"Der p-Wert ist größer als oder gleich 0.05, daher wird die Nullhypothese nicht abgelehnt.\")\n",
" print(\"Es gibt keine signifikanten Hinweise darauf, dass der Cholesterinwert bei kranken Personen höher ist als bei gesunden Personen.\")"
]
},
{
"cell_type": "markdown",
"id": "362223d0-efaf-426c-8bb7-81108c065ccf",
"metadata": {},
"source": [
"### Systolischer Ruheblutdruck"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "1574b038-0941-4473-a968-adca7f5ec26e",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n",
"/Users/nicole/anaconda3/lib/python3.11/site-packages/seaborn/_oldcore.py:1498: FutureWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, CategoricalDtype) instead\n",
" if pd.api.types.is_categorical_dtype(vector):\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArcAAAIhCAYAAABUopIpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABk+klEQVR4nO3dd3hU1f7+/XsS0oAkkEJCIASlCRKKBFBEem8Kfg0alOo5KopUUVCaegQ5ShHOEQsQiogNsNBBqhQpIiKdAwQwMQIhgZACmf38wcP8HBNwdjLDhPB+Xddczl57z557Amw/WbP2WhbDMAwBAAAARYCHuwMAAAAAzkJxCwAAgCKD4hYAAABFBsUtAAAAigyKWwAAABQZFLcAnObq1au6PgHLn58DAHCrUNwCcIqdO3fKy8tLc+bM0YkTJ+Tl5aV3333X3bEAAHcYC/PcAnCGy5cva//+/brrrrvk7++vvXv3KjIyUmFhYe6OBgC4g1DcAgAAoMhgWAKAAhk7dqwsFovOnj2b5/6aNWuqWbNmtu3169fLYrHoyy+/LBT5/qxZs2Z2WSXJYrFo7Nixpt7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U6ePKkxY8aoWbNm2rlzp13P5e7du3XgwAG99tpruuuuu1SiRIm/zXH16lXbf48ePaqXXnpJpUuXVseOHQv8GcuWLasVK1aoXbt26tevn55++mlJshW8a9eu1cMPP6wHHnhACxcuVE5OjiZOnHjDXzaWLFmiTZs2afTo0QoPD1eZMmUc+kXnupUrV6pz586qXr26Jk2apAoVKujEiRNatWrVDV+zYcMGde3aVU2aNNGCBQtUvHhxEz8BAGZQ3AJwi9DQUC1evNh2w0/jxo1VpUoVjR8/Xh999JEkqX///rr33nv1/fff28actm3bVmfPntXIkSPVs2dPeXj8vy+gWrZsqQ8++CDP9+vWrZsmTpwoSWrTpo3CwsLUo0cPff755+rRo4fDuUePHq2zZ8/q559/VvXq1W3tsbGxeR6/Z88edezYUZUqVdKSJUsUFBTk8Hs54ty5c/r666/VpUsXSdc+W0ZGht5//30NHz5cFSpU0Oeff64VK1boq6++Urdu3WyvrV27turXr6/4+Hg999xztvbk5GTt379fVatWdSjDX3+RkK4VpN9++63KlClT4M/o4+OjevXqSZLKly+fa6jIq6++qrCwMK1evdo2FKVt27a2nt+/unTpkn755ReVLl3a1mbmRrXnn39eFSpU0Pbt2+2GvvTp0yfP4+fPn69+/frp2Wef1eTJk+3+zgJwPv6FAXCLuLg4uzvZo6Ki1KhRI61bt06SdPToUR08eNBWeF69etX26NChgxITE3Xo0CG7cz766KM3fL+/FrCxsbEqVqyY7f0ctXz5cjVv3tyusL2RlStX6qGHHlKTJk20evVqpxe2kuTv728rbK+Li4uT1WrVxo0bJUnfffedSpUqpc6dO9v9HOvUqaPw8PBchV2tWrUcLmylazeU7dixQzt27ND27du1aNEiVa1aVR06dNDWrVsL/BlvJj09XTt27FC3bt3sCk1/f3917tw5z9e0aNHCrrA14/Dhwzp27Jj69evn0Jjuf/3rX+rdu7cmTJigqVOnUtgCtwA9twAK5HqP6l/HeF539erVPL/2vz4TwF/bfv75Z0myfaU8bNgwDRs2LM9z/3WapbJly94w51/fr1ixYgoODta5c+du+Jq8/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iee+6xO97Ly0uffvqpnn76af3f//2f5s6dqyeeeOKG569fv76qVaumYcOG6erVqypdurQWL16szZs353l8cHCwnnvuOSUkJKhq1apatmyZPvroIz333HOqUKGCJOn
"text/plain": [
"<Figure size 800x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(8, 6))\n",
"sns.boxplot(x='sex', y='trestbps', data=df)\n",
"plt.title('Überblick über Blutdruck')\n",
"plt.xlabel('Geschlecht')\n",
"plt.ylabel('Systolischer Ruheblutdruck (in mmHg bei Aufnahme ins Krankenhaus)')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "0a359020-86f6-4d8c-9144-d2977674e51d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Diagnose Untere_Grenze Obere_Grenze\n",
"0 Gesund 131.442350 137.827723\n",
"1 Krank 126.618412 131.731588\n"
]
}
],
"source": [
"# Filtern nach goal und Berechnen des Konfidenzintervalls\n",
"conf_level = 0.95\n",
"blutdruck_gesund = df.loc[df['goal'] == 0, 'trestbps']\n",
"blutdruck_krank = df.loc[df['goal'] == 1, 'trestbps']\n",
"conf_int_gesund = stats.t.interval(conf_level, len(blutdruck_gesund) - 1, loc=blutdruck_gesund.mean(), scale=stats.sem(blutdruck_gesund))\n",
"conf_int_krank = stats.t.interval(conf_level, len(blutdruck_krank) - 1, loc=blutdruck_krank.mean(), scale=stats.sem(blutdruck_krank))\n",
"\n",
"# Erstellen der Tabelle\n",
"result_table_blutdruck = pd.DataFrame({\n",
" 'Diagnose': ['Gesund', 'Krank'],\n",
" 'Untere_Grenze': [conf_int_gesund[0], conf_int_krank[0]],\n",
" 'Obere_Grenze': [conf_int_gesund[1], conf_int_krank[1]]\n",
"})\n",
"\n",
"# Anzeige der Tabelle\n",
"print(result_table_blutdruck)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "003e4148-8318-41f4-8e38-af74c5ad54fa",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"t-Statistik: -2.6678917570482685\n",
"p-Wert: 0.9959726018205624\n",
"Der p-Wert ist größer als oder gleich 0.05, daher wird die Nullhypothese nicht abgelehnt.\n",
"Es gibt keine signifikanten Hinweise darauf, dass der Blutdruck bei kranken Personen höher ist als bei gesunden Personen.\n"
]
}
],
"source": [
"# t-Test\n",
"# H0 Kranke haben einen niedrigeren oder gleichen Blutdruck wie Gesunde\n",
"# H1 Kranke haben einen höheren BLutdruck als Gesunde\n",
"\n",
"# Daten für gesunde und kranke Personen\n",
"blutdruck_healthy = df.loc[df['goal'] == 0, 'trestbps']\n",
"blutdruck_sick = df.loc[df['goal'] == 1, 'trestbps']\n",
"\n",
"# Durchführung des t-Tests\n",
"t_statistic, p_value = ttest_ind(blutdruck_sick, blutdruck_healthy, alternative='greater')\n",
"\n",
"print(\"t-Statistik:\", t_statistic)\n",
"print(\"p-Wert:\", p_value)\n",
"\n",
"# Überprüfung Nullhypothese\n",
"if p_value < 0.05:\n",
" print(\"Der p-Wert ist kleiner als 0.05, daher wird die Nullhypothese abgelehnt.\")\n",
" print(\"Es gibt signifikante Hinweise darauf, dass der Blutdruck bei kranken Personen höher ist als bei gesunden Personen.\")\n",
"else:\n",
" print(\"Der p-Wert ist größer als oder gleich 0.05, daher wird die Nullhypothese nicht abgelehnt.\")\n",
" print(\"Es gibt keine signifikanten Hinweise darauf, dass der Blutdruck bei kranken Personen höher ist als bei gesunden Personen.\")"
]
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",
2024-06-07 15:16:29 +02:00
"version": "3.11.5"
2024-05-08 08:48:17 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 5
}