{ "cells": [ { "cell_type": "markdown", "id": "7abd29b8", "metadata": {}, "source": [ "# Health Status Classification\n", "\n", "This notebook classifies individuals into \"Healthy\" or \"Patient\" categories using SVM and Random Forest classifiers. It includes:\n", "- Data preprocessing\n", "- Training of classifiers\n", "- Comparison of performance metrics\n", "- Visualization of results\n" ] }, { "cell_type": "markdown", "id": "299604b4", "metadata": {}, "source": [ "## Data Preprocessing" ] }, { "cell_type": "markdown", "id": "22ee7ce2", "metadata": {}, "source": [ "### 1. Import Dependecies" ] }, { "cell_type": "code", "execution_count": 252, "id": "76a44a0d", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import StandardScaler, LabelEncoder\n", "from sklearn.svm import SVC\n", "from sklearn.ensemble import RandomForestClassifier\n", "from sklearn.metrics import classification_report, confusion_matrix, accuracy_score\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns" ] }, { "cell_type": "markdown", "id": "a27c6dc7", "metadata": {}, "source": [ "### 2. Load Dataset" ] }, { "cell_type": "code", "execution_count": 253, "id": "3772870e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Patient No. | \n", "Gender | \n", "Age | \n", "Family history | \n", "Height | \n", "Weight | \n", "BMI | \n", "Obese/non obese | \n", "Cholesterol | \n", "Triglycerides level | \n", "HDL level | \n", "LDL level | \n", "VLDL level | \n", "Health_status | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1 | \n", "Female | \n", "65 | \n", "No | \n", "1.64 | \n", "64 | \n", "23.80 | \n", "Non-obese | \n", "145 | \n", "119 | \n", "60 | \n", "66.0 | \n", "19.0 | \n", "healthy | \n", "
1 | \n", "2 | \n", "Female | \n", "50 | \n", "Yes | \n", "1.70 | \n", "70 | \n", "24.22 | \n", "Non-obese | \n", "220 | \n", "107 | \n", "69 | \n", "134.0 | \n", "17.0 | \n", "healthy | \n", "
2 | \n", "3 | \n", "Female | \n", "45 | \n", "No | \n", "1.67 | \n", "63 | \n", "22.59 | \n", "Non-obese | \n", "190 | \n", "251 | \n", "42 | \n", "108.0 | \n", "40.0 | \n", "healthy | \n", "
3 | \n", "4 | \n", "Female | \n", "48 | \n", "No | \n", "1.61 | \n", "79 | \n", "30.48 | \n", "Obese | \n", "228 | \n", "185 | \n", "65 | \n", "134.0 | \n", "29.0 | \n", "healthy | \n", "
4 | \n", "5 | \n", "Male | \n", "74 | \n", "No | \n", "1.76 | \n", "83 | \n", "26.79 | \n", "Non-obese | \n", "157 | \n", "113 | \n", "49 | \n", "90.0 | \n", "18.0 | \n", "healthy | \n", "