{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b0b3d976-4364-4dd6-be0b-92029da02a1b",
   "metadata": {},
   "outputs": [],
   "source": [
    "#import libraries\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "from sklearn.naive_bayes import GaussianNB\n",
    "from sklearn.decomposition import PCA\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "\n",
    "from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3cf136e0-2e7b-4c62-a5de-f4c034f4db34",
   "metadata": {},
   "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>PatientId</th>\n",
       "      <th>Pregnancies</th>\n",
       "      <th>Glucose</th>\n",
       "      <th>BloodPressure</th>\n",
       "      <th>SkinThickness</th>\n",
       "      <th>Insulin</th>\n",
       "      <th>BMI</th>\n",
       "      <th>DiabetesPedigreeFunction</th>\n",
       "      <th>Age</th>\n",
       "      <th>Outcome</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>6</td>\n",
       "      <td>148</td>\n",
       "      <td>72</td>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>33.6</td>\n",
       "      <td>0.627</td>\n",
       "      <td>50</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>85</td>\n",
       "      <td>66</td>\n",
       "      <td>29</td>\n",
       "      <td>0</td>\n",
       "      <td>26.6</td>\n",
       "      <td>0.351</td>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>8</td>\n",
       "      <td>183</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>23.3</td>\n",
       "      <td>0.672</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>89</td>\n",
       "      <td>66</td>\n",
       "      <td>23</td>\n",
       "      <td>94</td>\n",
       "      <td>28.1</td>\n",
       "      <td>0.167</td>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>40</td>\n",
       "      <td>35</td>\n",
       "      <td>168</td>\n",
       "      <td>43.1</td>\n",
       "      <td>2.288</td>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PatientId  Pregnancies  Glucose  BloodPressure  SkinThickness  Insulin  \\\n",
       "0          1            6      148             72             35        0   \n",
       "1          2            1       85             66             29        0   \n",
       "2          3            8      183             64              0        0   \n",
       "3          4            1       89             66             23       94   \n",
       "4          5            0      137             40             35      168   \n",
       "\n",
       "    BMI  DiabetesPedigreeFunction  Age  Outcome  \n",
       "0  33.6                     0.627   50        1  \n",
       "1  26.6                     0.351   31        0  \n",
       "2  23.3                     0.672   32        1  \n",
       "3  28.1                     0.167   21        0  \n",
       "4  43.1                     2.288   33        1  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#load dataset\n",
    "# Load Diabetes dataset\n",
    "df = pd.read_csv(\"diabetes.csv\")\n",
    "\n",
    "# Display first rows\n",
    "df.head()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "bf5ab28d-361b-4a6f-bb82-10bbc86662bc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 768 entries, 0 to 767\n",
      "Data columns (total 10 columns):\n",
      " #   Column                    Non-Null Count  Dtype  \n",
      "---  ------                    --------------  -----  \n",
      " 0   PatientId                 768 non-null    int64  \n",
      " 1   Pregnancies               768 non-null    int64  \n",
      " 2   Glucose                   768 non-null    int64  \n",
      " 3   BloodPressure             768 non-null    int64  \n",
      " 4   SkinThickness             768 non-null    int64  \n",
      " 5   Insulin                   768 non-null    int64  \n",
      " 6   BMI                       768 non-null    float64\n",
      " 7   DiabetesPedigreeFunction  768 non-null    float64\n",
      " 8   Age                       768 non-null    int64  \n",
      " 9   Outcome                   768 non-null    int64  \n",
      "dtypes: float64(2), int64(8)\n",
      "memory usage: 60.1 KB\n"
     ]
    }
   ],
   "source": [
    "# Check basic information\n",
    "df.info()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "61943fd3-c3bc-4b75-9df5-0eb08957af4c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PatientId                   0\n",
       "Pregnancies                 0\n",
       "Glucose                     0\n",
       "BloodPressure               0\n",
       "SkinThickness               0\n",
       "Insulin                     0\n",
       "BMI                         0\n",
       "DiabetesPedigreeFunction    0\n",
       "Age                         0\n",
       "Outcome                     0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Check missing values\n",
    "df.isnull().sum()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "05c484b5-d485-46da-82b7-faa35d9b7b43",
   "metadata": {},
   "outputs": [],
   "source": [
    "#split features and target\n",
    "\n",
    "X = df.drop(\"Outcome\", axis=1)\n",
    "y = df[\"Outcome\"]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "650fa64e-3488-4779-8000-b31cb75298b5",
   "metadata": {},
   "outputs": [],
   "source": [
    "#train-test split\n",
    "X_train, X_test, y_train, y_test = train_test_split(\n",
    "    X, y, test_size=0.2, random_state=42\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "896494cb-6075-4a65-8d13-6896cec394fa",
   "metadata": {},
   "outputs": [],
   "source": [
    "#PART 1: Random Forest Classifier\n",
    "#Random Forest\n",
    "\n",
    "rf = RandomForestClassifier(random_state=42)\n",
    "rf.fit(X_train, y_train)\n",
    "\n",
    "y_pred_rf = rf.predict(X_test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "867b37c2-8ed9-4d32-a675-f094159fc1e9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Accuracy': 0.7532467532467533,\n",
       " 'Precision': 0.6440677966101694,\n",
       " 'Recall': 0.6909090909090909,\n",
       " 'F1-score': 0.6666666666666665}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rf_results = {\n",
    "    \"Accuracy\": accuracy_score(y_test, y_pred_rf),\n",
    "    \"Precision\": precision_score(y_test, y_pred_rf),\n",
    "    \"Recall\": recall_score(y_test, y_pred_rf),\n",
    "    \"F1-score\": f1_score(y_test, y_pred_rf)\n",
    "}\n",
    "\n",
    "rf_results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "debcd430-0caa-435f-8782-e0c24628c486",
   "metadata": {},
   "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>Feature</th>\n",
       "      <th>Importance</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Glucose</td>\n",
       "      <td>0.267089</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>BMI</td>\n",
       "      <td>0.153334</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Age</td>\n",
       "      <td>0.129185</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>DiabetesPedigreeFunction</td>\n",
       "      <td>0.102934</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>PatientId</td>\n",
       "      <td>0.090048</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BloodPressure</td>\n",
       "      <td>0.075748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Pregnancies</td>\n",
       "      <td>0.065340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Insulin</td>\n",
       "      <td>0.060622</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>SkinThickness</td>\n",
       "      <td>0.055700</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    Feature  Importance\n",
       "2                   Glucose    0.267089\n",
       "6                       BMI    0.153334\n",
       "8                       Age    0.129185\n",
       "7  DiabetesPedigreeFunction    0.102934\n",
       "0                 PatientId    0.090048\n",
       "3             BloodPressure    0.075748\n",
       "1               Pregnancies    0.065340\n",
       "5                   Insulin    0.060622\n",
       "4             SkinThickness    0.055700"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Manual Feature Selection using Feature Importance\n",
    "# Get feature importances\n",
    "importances = rf.feature_importances_\n",
    "\n",
    "feature_importance_df = pd.DataFrame({\n",
    "    \"Feature\": X.columns,\n",
    "    \"Importance\": importances\n",
    "}).sort_values(by=\"Importance\", ascending=False)\n",
    "\n",
    "feature_importance_df\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "87165ef9-b106-4ec7-a75f-ce4bbcd17d33",
   "metadata": {},
   "outputs": [],
   "source": [
    "top_features = feature_importance_df[\"Feature\"].head(5).values\n",
    "\n",
    "X_train_top = X_train[top_features]\n",
    "X_test_top = X_test[top_features]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "c361f9f2-5b81-4a6f-bf02-3e4394c8c752",
   "metadata": {},
   "outputs": [],
   "source": [
    "rf_top = RandomForestClassifier(random_state=42)\n",
    "rf_top.fit(X_train_top, y_train)\n",
    "\n",
    "y_pred_rf_top = rf_top.predict(X_test_top)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "13a2d9ad-1288-49b9-a5b4-5631ddfaaf1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Accuracy': 0.7727272727272727,\n",
       " 'Precision': 0.6785714285714286,\n",
       " 'Recall': 0.6909090909090909,\n",
       " 'F1-score': 0.6846846846846847}"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rf_top_results = {\n",
    "    \"Accuracy\": accuracy_score(y_test, y_pred_rf_top),\n",
    "    \"Precision\": precision_score(y_test, y_pred_rf_top),\n",
    "    \"Recall\": recall_score(y_test, y_pred_rf_top),\n",
    "    \"F1-score\": f1_score(y_test, y_pred_rf_top)\n",
    "}\n",
    "\n",
    "rf_top_results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d2df04dd-dee5-45eb-aa6c-ba3f788391d6",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Feature Selection using PCA\n",
    "#Standardize Data\n",
    "scaler = StandardScaler()\n",
    "X_scaled = scaler.fit_transform(X)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "717f9507-96c0-43c5-98f4-66fe859da6bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Apply PCA\n",
    "pca = PCA(n_components=5)\n",
    "X_pca = pca.fit_transform(X_scaled)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "f0311870-b352-45a7-819b-271389faf3e2",
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train_pca, X_test_pca, y_train_pca, y_test_pca = train_test_split(\n",
    "    X_pca, y, test_size=0.2, random_state=42\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "e89ac73e-feea-4afd-9b5b-11de7f42cbe6",
   "metadata": {},
   "outputs": [],
   "source": [
    "rf_pca = RandomForestClassifier(random_state=42)\n",
    "rf_pca.fit(X_train_pca, y_train_pca)\n",
    "\n",
    "y_pred_rf_pca = rf_pca.predict(X_test_pca)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "1d178683-990b-43ae-835e-34e519fc3bac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Accuracy': 0.6688311688311688,\n",
       " 'Precision': 0.54,\n",
       " 'Recall': 0.4909090909090909,\n",
       " 'F1-score': 0.5142857142857142}"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rf_pca_results = {\n",
    "    \"Accuracy\": accuracy_score(y_test_pca, y_pred_rf_pca),\n",
    "    \"Precision\": precision_score(y_test_pca, y_pred_rf_pca),\n",
    "    \"Recall\": recall_score(y_test_pca, y_pred_rf_pca),\n",
    "    \"F1-score\": f1_score(y_test_pca, y_pred_rf_pca)\n",
    "}\n",
    "\n",
    "rf_pca_results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "7fad4bfe-6388-4b6c-966d-385cdd03cae5",
   "metadata": {},
   "outputs": [],
   "source": [
    "#PART 2: Comparing with Other Classifiers\n",
    "#Logistic Regression\n",
    "lr = LogisticRegression(max_iter=1000)\n",
    "lr.fit(X_train, y_train)\n",
    "\n",
    "y_pred_lr = lr.predict(X_test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "afb395e6-9038-48fd-b9ea-a3bf4ff484a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Accuracy': 0.7532467532467533,\n",
       " 'Precision': 0.6491228070175439,\n",
       " 'Recall': 0.6727272727272727,\n",
       " 'F1-score': 0.6607142857142858}"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lr_results = {\n",
    "    \"Accuracy\": accuracy_score(y_test, y_pred_lr),\n",
    "    \"Precision\": precision_score(y_test, y_pred_lr),\n",
    "    \"Recall\": recall_score(y_test, y_pred_lr),\n",
    "    \"F1-score\": f1_score(y_test, y_pred_lr)\n",
    "}\n",
    "\n",
    "lr_results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "78d3066d-6929-473e-aa46-4876dbce112c",
   "metadata": {},
   "outputs": [],
   "source": [
    "#Naive Bayes\n",
    "nb = GaussianNB()\n",
    "nb.fit(X_train, y_train)\n",
    "\n",
    "y_pred_nb = nb.predict(X_test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "f0db597e-3721-4db9-a95d-55b84d87d794",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Accuracy': 0.7597402597402597,\n",
       " 'Precision': 0.65,\n",
       " 'Recall': 0.7090909090909091,\n",
       " 'F1-score': 0.6782608695652174}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nb_results = {\n",
    "    \"Accuracy\": accuracy_score(y_test, y_pred_nb),\n",
    "    \"Precision\": precision_score(y_test, y_pred_nb),\n",
    "    \"Recall\": recall_score(y_test, y_pred_nb),\n",
    "    \"F1-score\": f1_score(y_test, y_pred_nb)\n",
    "}\n",
    "\n",
    "nb_results\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "695fd3ad-e932-4a4b-a244-4c33ed8fd679",
   "metadata": {},
   "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>Model</th>\n",
       "      <th>Accuracy</th>\n",
       "      <th>Precision</th>\n",
       "      <th>Recall</th>\n",
       "      <th>F1-score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Random Forest (Original)</td>\n",
       "      <td>0.753247</td>\n",
       "      <td>0.644068</td>\n",
       "      <td>0.690909</td>\n",
       "      <td>0.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Random Forest (Top Features)</td>\n",
       "      <td>0.772727</td>\n",
       "      <td>0.678571</td>\n",
       "      <td>0.690909</td>\n",
       "      <td>0.684685</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Random Forest (PCA)</td>\n",
       "      <td>0.668831</td>\n",
       "      <td>0.540000</td>\n",
       "      <td>0.490909</td>\n",
       "      <td>0.514286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Logistic Regression</td>\n",
       "      <td>0.753247</td>\n",
       "      <td>0.649123</td>\n",
       "      <td>0.672727</td>\n",
       "      <td>0.660714</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Naïve Bayes</td>\n",
       "      <td>0.759740</td>\n",
       "      <td>0.650000</td>\n",
       "      <td>0.709091</td>\n",
       "      <td>0.678261</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          Model  Accuracy  Precision    Recall  F1-score\n",
       "0      Random Forest (Original)  0.753247   0.644068  0.690909  0.666667\n",
       "1  Random Forest (Top Features)  0.772727   0.678571  0.690909  0.684685\n",
       "2           Random Forest (PCA)  0.668831   0.540000  0.490909  0.514286\n",
       "3           Logistic Regression  0.753247   0.649123  0.672727  0.660714\n",
       "4                   Naïve Bayes  0.759740   0.650000  0.709091  0.678261"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Final Model Comparison Table\n",
    "results_df = pd.DataFrame({\n",
    "    \"Model\": [\n",
    "        \"Random Forest (Original)\",\n",
    "        \"Random Forest (Top Features)\",\n",
    "        \"Random Forest (PCA)\",\n",
    "        \"Logistic Regression\",\n",
    "        \"Naïve Bayes\"\n",
    "    ],\n",
    "    \"Accuracy\": [\n",
    "        rf_results[\"Accuracy\"],\n",
    "        rf_top_results[\"Accuracy\"],\n",
    "        rf_pca_results[\"Accuracy\"],\n",
    "        lr_results[\"Accuracy\"],\n",
    "        nb_results[\"Accuracy\"]\n",
    "    ],\n",
    "    \"Precision\": [\n",
    "        rf_results[\"Precision\"],\n",
    "        rf_top_results[\"Precision\"],\n",
    "        rf_pca_results[\"Precision\"],\n",
    "        lr_results[\"Precision\"],\n",
    "        nb_results[\"Precision\"]\n",
    "    ],\n",
    "    \"Recall\": [\n",
    "        rf_results[\"Recall\"],\n",
    "        rf_top_results[\"Recall\"],\n",
    "        rf_pca_results[\"Recall\"],\n",
    "        lr_results[\"Recall\"],\n",
    "        nb_results[\"Recall\"]\n",
    "    ],\n",
    "    \"F1-score\": [\n",
    "        rf_results[\"F1-score\"],\n",
    "        rf_top_results[\"F1-score\"],\n",
    "        rf_pca_results[\"F1-score\"],\n",
    "        lr_results[\"F1-score\"],\n",
    "        nb_results[\"F1-score\"]\n",
    "    ]\n",
    "})\n",
    "\n",
    "results_df\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e26b2a93-bd7d-4a5c-b425-a025f4b88edd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "anaconda-panel-2023.05-py310",
   "language": "python",
   "name": "conda-env-anaconda-panel-2023.05-py310-py"
  },
  "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
}
