DETECTION OF DIABETIC INFLUENCE AMONG PREGNANT WOMEN USING MACHINE LEARNING
Create New

DETECTION OF DIABETIC INFLUENCE AMONG PREGNANT WOMEN USING MACHINE LEARNING

Project period

02/05/2020 - 03/05/2020

Views

82

2



DETECTION OF DIABETIC INFLUENCE  AMONG PREGNANT WOMEN USING  MACHINE LEARNING
DETECTION OF DIABETIC INFLUENCE  AMONG PREGNANT WOMEN USING  MACHINE LEARNING

Nowadays, Diabetes is considered a  chronic disease. But it causes great damage to the health of our people. When the glucose level in blood is higher than the usual limit, then it leads to diabetes which means the secretion of insulin is affected, thereby affecting almost every organ of the human body. Among pregnant women, diabetes is termed as gestational diabetes mellitus (GDM) which means the glucose intolerance of variable degree with the appearance of symptoms or first detection during pregnancy. A survey result shows that abnormalities of glucose regulation either pregestational or gestational occur in 3-8% of pregnant women. By predicting the disease earlier, proper treatments can be administered to the patients before the case becomes critical. The goal of this project is to develop a system that will help in the prediction of the diabetic risk levels of a patient with higher accuracy. We have decided to find the solution to the existing problem by Data Analysis and Machine Learning which helps to predict if the patient has diabetes or not. 

Why: Problem statement

Usually, to test diabetes, the person has to visit the nearby medical lab and spend almost a day waiting at the diagnostic centre to get the result. The patient has to pay in order to get the result each time. 

How: Solution description

DATASET COLLECTION:

Detailed antenatal history regarding present and past pregnancies were noted. Special attention was given to diabetic status, time of onset of diabetes, treatment details, history of LGA and fetal loss in past pregnancies.

The diabetic mothers were divided into 3 categories. 

Group A: Gestational diabetes, 

Group B: Diabetic status not known

Group C: Pregestational diabetes

The dataset for the diagnosis of gestational diabetes is obtained from medical reports of the patients collected from maternity hospitals in Pondicherry. There are 51 instances with 19 different attributes related to gestational diabetes like age, parity, diabetic status, treatment details, fetal loss, mode of delivery, liquor, Apgar, gender, the weight of baby, gestational age, Agalgasga, symptoms in baby, cardiovascular findings, chest x-ray, Echo and followup.

DATA CLEANING:

We have undergone three processes for data cleaning.

Ø  Data Preprocessing

Ø  Checking for missing data

Ø  Replacing missing ("?") and ("t?") data with NaN values

SPLITTING DATA FOR TRAINING AND TESTING:

This dataset contains 51 diabetic Mellitus pregnant patient records. We split the training and testing data with a ratio of 7:3. That is 70% of data is for training and 30% is for testing. We used the train_test_split method from sklearn to split the data.

TRAINING USING MACHINE LEARNING MODELS:

First, we tried Naive Bayes Classifier. A Naive Bayes classifier is a simple probabilistic classifier based on applying Bayes theorem (from Bayesian statistics) with strong (naive) independence assumptions. A more descriptive term for the underlying probability model would be an independent feature model. We got the testing accuracy of 87.5% with Gaussian Naive Bayes, 72.5% with Multinomial Naive Bayes and 62.5% with Bernoulli Naive Bayes.

Then, we used Random Forest Classifier. It comes under the category of ensemble methods. It employs ‘bagging’ and ‘boosting’ methods to draw a random subset from the data, and train a Decision Tree on that. We got an accuracy of 87.5% with this method.

How is it different from competition

We have boosted our proposed model using xgboost algorithm. The speciality of this powerful algorithm lies in its scalability, which drives fast learning through parallel and distributed computing and offers efficient memory usage. We reached an accuracy of 93.75% with the xgboost algorithm.

Who are your customers

Pregnant women and Gynecologists are our customers. 

Project Phases and Schedule

  • Data collection
  • Data cleaning
  • Splitting data for training and testing
  • Training using machine learning models

Resources Required

  • Anaconda tool
  • Python 3.7
  • Jupyter notebook 

Download:
Project Code Code copy
/* Your file Name : Pregnancy diabetics.ipynb */
/* Your coding Language : python */
/* Your code snippet start here */
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import preprocessing as prep\n",
    "from sklearn import datasets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Bhushan\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:3: FutureWarning: read_table is deprecated, use read_csv instead.\n",
      "  This is separate from the ipykernel package so we can avoid doing imports until\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows and Columns (51, 22)\n"
     ]
    },
    {
     "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>ID</th>\n",
       "      <th>Patient</th>\n",
       "      <th>Age</th>\n",
       "      <th>Residence</th>\n",
       "      <th>Parity</th>\n",
       "      <th>Diastatus</th>\n",
       "      <th>Treatment</th>\n",
       "      <th>Fetalloss</th>\n",
       "      <th>OtherComplications</th>\n",
       "      <th>ModeofDelivery</th>\n",
       "      <th>...</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Babyweight</th>\n",
       "      <th>Gestationalage</th>\n",
       "      <th>Agalgasga</th>\n",
       "      <th>Babysymptoms</th>\n",
       "      <th>Cardiovascularfindings</th>\n",
       "      <th>Othercomplications</th>\n",
       "      <th>Chestxray</th>\n",
       "      <th>Echo</th>\n",
       "      <th>Followup</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2356</td>\n",
       "      <td>Suganthi</td>\n",
       "      <td>21</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>Multi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Present</td>\n",
       "      <td>Murmur</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>VSD</td>\n",
       "      <td>Regressed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2743</td>\n",
       "      <td>Ramya</td>\n",
       "      <td>23</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>primi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3452</td>\n",
       "      <td>Saranya</td>\n",
       "      <td>20</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>primi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Insulin</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>Normal</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.1kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4390</td>\n",
       "      <td>Malar</td>\n",
       "      <td>34</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>Multi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Hypertension</td>\n",
       "      <td>Normal</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>2.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4986</td>\n",
       "      <td>Mangai</td>\n",
       "      <td>32</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>Multi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Present</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     ID   Patient  Age   Residence Parity             Diastatus Treatment  \\\n",
       "0  2356  Suganthi   21  Puducherry  Multi  Gestational diabetes      Diet   \n",
       "1  2743     Ramya   23  Puducherry  primi  Gestational diabetes      Diet   \n",
       "2  3452   Saranya   20  Puducherry  primi  Gestational diabetes   Insulin   \n",
       "3  4390     Malar   34  Puducherry  Multi  Gestational diabetes      Diet   \n",
       "4  4986    Mangai   32  Puducherry  Multi  Gestational diabetes      Diet   \n",
       "\n",
       "  Fetalloss OtherComplications ModeofDelivery  ...     Sex Babyweight  \\\n",
       "0    Absent                 No           LSCS  ...    Male      3.6kg   \n",
       "1    Absent                 No           LSCS  ...    Male      3.7kg   \n",
       "2    Absent                 No         Normal  ...    Male      3.1kg   \n",
       "3    Absent       Hypertension         Normal  ...  Female      2.7kg   \n",
       "4   Present                 No           LSCS  ...  Female      3.6kg   \n",
       "\n",
       "  Gestationalage Agalgasga Babysymptoms Cardiovascularfindings  \\\n",
       "0           Term       AGA      Present                 Murmur   \n",
       "1           Term       AGA       Absent                 Absent   \n",
       "2           Term       AGA       Absent                 Absent   \n",
       "3           Term       AGA       Absent                 Absent   \n",
       "4           Term       AGA       Absent                 Absent   \n",
       "\n",
       "  Othercomplications Chestxray    Echo   Followup  \n",
       "0             Absent    Normal     VSD  Regressed  \n",
       "1             Absent    Normal  Normal   Not done  \n",
       "2             Absent    Normal  Normal   Not done  \n",
       "3                NaN    Normal  Normal   Not done  \n",
       "4             Absent    Normal  Normal   Not done  \n",
       "\n",
       "[5 rows x 22 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "readData = pd.read_table('Book1.csv', ',', header=None,\n",
    "                        names=['ID', 'Patient', 'Age', 'Residence', 'Parity', 'Diastatus', 'Treatment', 'Fetalloss', 'OtherComplications', 'ModeofDelivery', \n",
    "                              'Liqor', 'Apgar', 'Sex', 'Babyweight', 'Gestationalage', 'Agalgasga', 'Babysymptoms', 'Cardiovascularfindings', 'Othercomplications', 'Chestxray', 'Echo', 'Followup'])\n",
    "data = pd.DataFrame(readData);\n",
    "print('Rows and Columns', data.shape)\n",
    "data.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "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>ID</th>\n",
       "      <th>Patient</th>\n",
       "      <th>Age</th>\n",
       "      <th>Residence</th>\n",
       "      <th>Parity</th>\n",
       "      <th>Diastatus</th>\n",
       "      <th>Treatment</th>\n",
       "      <th>Fetalloss</th>\n",
       "      <th>OtherComplications</th>\n",
       "      <th>ModeofDelivery</th>\n",
       "      <th>...</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Babyweight</th>\n",
       "      <th>Gestationalage</th>\n",
       "      <th>Agalgasga</th>\n",
       "      <th>Babysymptoms</th>\n",
       "      <th>Cardiovascularfindings</th>\n",
       "      <th>Othercomplications</th>\n",
       "      <th>Chestxray</th>\n",
       "      <th>Echo</th>\n",
       "      <th>Followup</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2356</td>\n",
       "      <td>Suganthi</td>\n",
       "      <td>21</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>Multi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Present</td>\n",
       "      <td>Murmur</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>VSD</td>\n",
       "      <td>Regressed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2743</td>\n",
       "      <td>Ramya</td>\n",
       "      <td>23</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>primi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3452</td>\n",
       "      <td>Saranya</td>\n",
       "      <td>20</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>primi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Insulin</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>Normal</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.1kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4390</td>\n",
       "      <td>Malar</td>\n",
       "      <td>34</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>Multi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Hypertension</td>\n",
       "      <td>Normal</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>2.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4986</td>\n",
       "      <td>Mangai</td>\n",
       "      <td>32</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>Multi</td>\n",
       "      <td>Gestational diabetes</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Present</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     ID   Patient  Age   Residence Parity             Diastatus Treatment  \\\n",
       "0  2356  Suganthi   21  Puducherry  Multi  Gestational diabetes      Diet   \n",
       "1  2743     Ramya   23  Puducherry  primi  Gestational diabetes      Diet   \n",
       "2  3452   Saranya   20  Puducherry  primi  Gestational diabetes   Insulin   \n",
       "3  4390     Malar   34  Puducherry  Multi  Gestational diabetes      Diet   \n",
       "4  4986    Mangai   32  Puducherry  Multi  Gestational diabetes      Diet   \n",
       "\n",
       "  Fetalloss OtherComplications ModeofDelivery  ...     Sex Babyweight  \\\n",
       "0    Absent                 No           LSCS  ...    Male      3.6kg   \n",
       "1    Absent                 No           LSCS  ...    Male      3.7kg   \n",
       "2    Absent                 No         Normal  ...    Male      3.1kg   \n",
       "3    Absent       Hypertension         Normal  ...  Female      2.7kg   \n",
       "4   Present                 No           LSCS  ...  Female      3.6kg   \n",
       "\n",
       "  Gestationalage Agalgasga Babysymptoms Cardiovascularfindings  \\\n",
       "0           Term       AGA      Present                 Murmur   \n",
       "1           Term       AGA       Absent                 Absent   \n",
       "2           Term       AGA       Absent                 Absent   \n",
       "3           Term       AGA       Absent                 Absent   \n",
       "4           Term       AGA       Absent                 Absent   \n",
       "\n",
       "  Othercomplications Chestxray    Echo   Followup  \n",
       "0             Absent    Normal     VSD  Regressed  \n",
       "1             Absent    Normal  Normal   Not done  \n",
       "2             Absent    Normal  Normal   Not done  \n",
       "3                NaN    Normal  Normal   Not done  \n",
       "4             Absent    Normal  Normal   Not done  \n",
       "\n",
       "[5 rows x 22 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = data.replace('?', np.NaN)\n",
    "data = data.replace('\\t?', np.NaN)\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Columns and Number of missing data \n",
      " ID                        0\n",
      "Patient                   0\n",
      "Age                       0\n",
      "Residence                 0\n",
      "Parity                    0\n",
      "Diastatus                 0\n",
      "Treatment                 0\n",
      "Fetalloss                 0\n",
      "OtherComplications        0\n",
      "ModeofDelivery            0\n",
      "Liqor                     0\n",
      "Apgar                     0\n",
      "Sex                       0\n",
      "Babyweight                0\n",
      "Gestationalage            0\n",
      "Agalgasga                 0\n",
      "Babysymptoms              0\n",
      "Cardiovascularfindings    0\n",
      "Othercomplications        2\n",
      "Chestxray                 0\n",
      "Echo                      0\n",
      "Followup                  0\n",
      "dtype: int64\n"
     ]
    }
   ],
   "source": [
    "missing = data.isnull().sum(axis=0)\n",
    "print('Columns and Number of missing data \\n', missing)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "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>ID</th>\n",
       "      <th>Patient</th>\n",
       "      <th>Age</th>\n",
       "      <th>Residence</th>\n",
       "      <th>Parity</th>\n",
       "      <th>Diastatus</th>\n",
       "      <th>Treatment</th>\n",
       "      <th>Fetalloss</th>\n",
       "      <th>OtherComplications</th>\n",
       "      <th>ModeofDelivery</th>\n",
       "      <th>...</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Babyweight</th>\n",
       "      <th>Gestationalage</th>\n",
       "      <th>Agalgasga</th>\n",
       "      <th>Babysymptoms</th>\n",
       "      <th>Cardiovascularfindings</th>\n",
       "      <th>Othercomplications</th>\n",
       "      <th>Chestxray</th>\n",
       "      <th>Echo</th>\n",
       "      <th>Followup</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2356</td>\n",
       "      <td>Suganthi</td>\n",
       "      <td>21</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Present</td>\n",
       "      <td>Murmur</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>VSD</td>\n",
       "      <td>Regressed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2743</td>\n",
       "      <td>Ramya</td>\n",
       "      <td>23</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3452</td>\n",
       "      <td>Saranya</td>\n",
       "      <td>20</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Insulin</td>\n",
       "      <td>Absent</td>\n",
       "      <td>No</td>\n",
       "      <td>Normal</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.1kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4390</td>\n",
       "      <td>Malar</td>\n",
       "      <td>34</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Hypertension</td>\n",
       "      <td>Normal</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>2.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4986</td>\n",
       "      <td>Mangai</td>\n",
       "      <td>32</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Diet</td>\n",
       "      <td>Present</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Absent</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Normal</td>\n",
       "      <td>Not done</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     ID   Patient  Age   Residence  Parity  Diastatus Treatment Fetalloss  \\\n",
       "0  2356  Suganthi   21  Puducherry       2          3      Diet    Absent   \n",
       "1  2743     Ramya   23  Puducherry       1          3      Diet    Absent   \n",
       "2  3452   Saranya   20  Puducherry       1          3   Insulin    Absent   \n",
       "3  4390     Malar   34  Puducherry       2          3      Diet    Absent   \n",
       "4  4986    Mangai   32  Puducherry       2          3      Diet   Present   \n",
       "\n",
       "  OtherComplications ModeofDelivery  ...     Sex Babyweight Gestationalage  \\\n",
       "0                 No           LSCS  ...    Male      3.6kg           Term   \n",
       "1                 No           LSCS  ...    Male      3.7kg           Term   \n",
       "2                 No         Normal  ...    Male      3.1kg           Term   \n",
       "3       Hypertension         Normal  ...  Female      2.7kg           Term   \n",
       "4                 No           LSCS  ...  Female      3.6kg           Term   \n",
       "\n",
       "  Agalgasga Babysymptoms Cardiovascularfindings Othercomplications Chestxray  \\\n",
       "0       AGA      Present                 Murmur             Absent    Normal   \n",
       "1       AGA       Absent                 Absent             Absent    Normal   \n",
       "2       AGA       Absent                 Absent             Absent    Normal   \n",
       "3       AGA       Absent                 Absent                NaN    Normal   \n",
       "4       AGA       Absent                 Absent             Absent    Normal   \n",
       "\n",
       "     Echo   Followup  \n",
       "0     VSD  Regressed  \n",
       "1  Normal   Not done  \n",
       "2  Normal   Not done  \n",
       "3  Normal   Not done  \n",
       "4  Normal   Not done  \n",
       "\n",
       "[5 rows x 22 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Parity_mapping = {'primi':1, 'Multi':2}\n",
    "data['Parity'] = data['Parity'].map(Parity_mapping)\n",
    "Diastatus_mapping = {'Diabetic status not known':1, 'Pregestational diabetes':2, 'Gestational diabetes':3}\n",
    "data['Diastatus'] = data['Diastatus'].map(Diastatus_mapping)\n",
    "data.head()\n",
    "#Diabeti status_mapping = {'Diabetic status not known':1, 'Pregestational diabetes':2, 'Gestational diabetes':3}\n",
    "#data['Diabetic status'] = data['Diabetic status'].map(Diabetic status_mapping)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "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>ID</th>\n",
       "      <th>Patient</th>\n",
       "      <th>Age</th>\n",
       "      <th>Residence</th>\n",
       "      <th>Parity</th>\n",
       "      <th>Diastatus</th>\n",
       "      <th>Treatment</th>\n",
       "      <th>Fetalloss</th>\n",
       "      <th>OtherComplications</th>\n",
       "      <th>ModeofDelivery</th>\n",
       "      <th>...</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Babyweight</th>\n",
       "      <th>Gestationalage</th>\n",
       "      <th>Agalgasga</th>\n",
       "      <th>Babysymptoms</th>\n",
       "      <th>Cardiovascularfindings</th>\n",
       "      <th>Othercomplications</th>\n",
       "      <th>Chestxray</th>\n",
       "      <th>Echo</th>\n",
       "      <th>Followup</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2356</td>\n",
       "      <td>Suganthi</td>\n",
       "      <td>21</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2743</td>\n",
       "      <td>Ramya</td>\n",
       "      <td>23</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3452</td>\n",
       "      <td>Saranya</td>\n",
       "      <td>20</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>No</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.1kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4390</td>\n",
       "      <td>Malar</td>\n",
       "      <td>34</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Hypertension</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>2.7kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4986</td>\n",
       "      <td>Mangai</td>\n",
       "      <td>32</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5423</td>\n",
       "      <td>Selvi</td>\n",
       "      <td>21</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>3.4kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>5743</td>\n",
       "      <td>Rosemary</td>\n",
       "      <td>34</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.5kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>6453</td>\n",
       "      <td>Nagamani</td>\n",
       "      <td>32</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Anemia</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>2.9kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6634</td>\n",
       "      <td>Deepa</td>\n",
       "      <td>24</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Male</td>\n",
       "      <td>3.2kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6801</td>\n",
       "      <td>Lakshmi</td>\n",
       "      <td>28</td>\n",
       "      <td>Puducherry</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>No</td>\n",
       "      <td>LSCS</td>\n",
       "      <td>...</td>\n",
       "      <td>Female</td>\n",
       "      <td>3.6kg</td>\n",
       "      <td>Term</td>\n",
       "      <td>AGA</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     ID   Patient  Age   Residence  Parity  Diastatus  Treatment  Fetalloss  \\\n",
       "0  2356  Suganthi   21  Puducherry       2          3          2          2   \n",
       "1  2743     Ramya   23  Puducherry       1          3          2          2   \n",
       "2  3452   Saranya   20  Puducherry       1          3          3          2   \n",
       "3  4390     Malar   34  Puducherry       2          3          2          2   \n",
       "4  4986    Mangai   32  Puducherry       2          3          2          1   \n",
       "5  5423     Selvi   21  Puducherry       2          3          2          1   \n",
       "6  5743  Rosemary   34  Puducherry       1          3          2          2   \n",
       "7  6453  Nagamani   32  Puducherry       2          3          2          2   \n",
       "8  6634     Deepa   24  Puducherry       1          3          2          2   \n",
       "9  6801   Lakshmi   28  Puducherry       2          3          3          2   \n",
       "\n",
       "  OtherComplications ModeofDelivery  ...     Sex Babyweight Gestationalage  \\\n",
       "0                 No           LSCS  ...    Male      3.6kg           Term   \n",
       "1                 No           LSCS  ...    Male      3.7kg           Term   \n",
       "2                 No              1  ...    Male      3.1kg           Term   \n",
       "3       Hypertension              1  ...  Female      2.7kg           Term   \n",
       "4                 No           LSCS  ...  Female      3.6kg           Term   \n",
       "5                 No           LSCS  ...  Female      3.4kg           Term   \n",
       "6                 No           LSCS  ...    Male      3.5kg           Term   \n",
       "7             Anemia              1  ...    Male      2.9kg           Term   \n",
       "8                 No           LSCS  ...    Male      3.2kg           Term   \n",
       "9                 No           LSCS  ...  Female      3.6kg           Term   \n",
       "\n",
       "  Agalgasga Babysymptoms Cardiovascularfindings  Othercomplications  \\\n",
       "0       AGA            1                      2                   2   \n",
       "1       AGA            2                      2                   2   \n",
       "2       AGA            2                      2                   2   \n",
       "3       AGA            2                      2                 NaN   \n",
       "4       AGA            2                      2                   2   \n",
       "5       AGA            2                      2                   2   \n",
       "6       AGA            1                      2                   2   \n",
       "7       AGA            2                      2                   2   \n",
       "8       AGA            2                      2                   2   \n",
       "9       AGA            2                      2                   2   \n",
       "\n",
       "   Chestxray Echo  Followup  \n",
       "0          1    7         4  \n",
       "1          1    1         2  \n",
       "2          1    1         2  \n",
       "3          1    1         2  \n",
       "4          1    1         2  \n",
       "5          1    1         2  \n",
       "6          1    5         4  \n",
       "7          1    5         1  \n",
       "8          1    1         2  \n",
       "9          1    5         2  \n",
       "\n",
       "[10 rows x 22 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Diastatus_mappinj = {'Diabetic status not known':1, 'Gestational diabetes':3, 'Pregestational diabetes':2}\n",
    "data.replace(Diastatus_mapping, inplace=True)\n",
    "data['Diastatus'] = data.Diastatus.astype(float)\n",
    "data['Diastatus'].fillna((data['Diastatus'].mean()),inplace=True)\n",
    "data['Diastatus'] = data.Diastatus.astype(int)\n",
    "\n",
    "Treatment_mapping = {'No treatment':1, 'Diet':2, 'Insulin':3, 'OHA':4}\n",
    "data.replace(Treatment_mapping, inplace=True)\n",
    "data['Treatment'] = data.Treatment.astype(float)\n",
    "data['Treatment'].fillna((data['Treatment'].mean()),inplace=True)\n",
    "data['Treatment'] = data.Treatment.astype(int)\n",
    "\n",
    "Fetalloss_mapping = {'Present': 1, 'Absent': 2}\n",
    "data.replace(Fetalloss_mapping, inplace=True)\n",
    "data['Fetalloss'] = data.Fetalloss.astype(float)\n",
    "data['Fetalloss'].fillna((data['Fetalloss'].mean()),inplace=True)\n",
    "data['Fetalloss'] = data.Fetalloss.astype(int)\n",
    "\n",
    "Babysymptoms_mapping = {'Absent':1, 'Present':2, 'Respiratory distress':3}\n",
    "data.replace(Babysymptoms_mapping, inplace=True)\n",
    "data['Babysymptoms'] = data.Babysymptoms.astype(float)\n",
    "data['Babysymptoms'].fillna((data['Babysymptoms'].mean()),inplace=True)\n",
    "data['Babysymptoms'] = data.Babysymptoms.astype(int)\n",
    "\n",
    "Cardiovascularfindings_mapping = {'Absent':1, 'Murmur':2}\n",
    "data.replace(Cardiovascularfindings_mapping, inplace=True)\n",
    "data['Cardiovascularfindings'] = data.Cardiovascularfindings.astype(float)\n",
    "data['Cardiovascularfindings'].fillna((data['Cardiovascularfindings'].mean()),inplace=True)\n",
    "data['Cardiovascularfindings'] = data.Cardiovascularfindings.astype(int)\n",
    "                                      \n",
    "Chestxray_mapping = {'Normal':1, 'Cardiomegaly':2}\n",
    "data.replace(Chestxray_mapping, inplace=True)\n",
    "data['Chestxray'] = data.Chestxray.astype(float)\n",
    "data['Chestxray'].fillna((data['Chestxray'].mean()),inplace=True)\n",
    "data['Chestxray'] = data.Chestxray.astype(int)\n",
    "\n",
    "Echo_mapping = {'Normal':1, 'ASD':2, 'ASD/Dialated RA,RV':3, 'ASH':4, 'PDA':5, 'PDA/PAH':6, 'VSD':7, 'VSD/PAH':8}\n",
    "data.replace(Echo_mapping, inplace=True)\n",
    "data['Echo'] = data.Echo.astype(float)\n",
    "data['Echo'].fillna((data['Echo'].mean()), inplace=True)\n",
    "data['Echo'] = data.Echo.astype(int)\n",
    "\n",
    "Followup_mapping = {'lost follow up':1, 'Not done':2, 'died':3, 'Regressed':4}\n",
    "data.replace(Followup_mapping, inplace=True)\n",
    "data['Followup'] = data.Followup.astype(float)\n",
    "data['Followup'].fillna((data['Followup'].mean()), inplace=True)\n",
    "data['Followup'] = data.Followup.astype(int)\n",
    "\n",
    "data.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgo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QXTH2N7gJvT+z/8eR69sr4jyXuB5aq6HbgR+O0kX6P3PzZXdZnvT/Ix4E+AE8Dbqjd9MzY/KSpJjTgb5tAlSUOw0CWpERa6JDXCQpekRljoktQIC12SGmGhS1IjLHRJasT/A2nO/M5WbtzBAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEVCAYAAADn6Y5lAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAEhBJREFUeJzt3X+MZWV9x/H3x2UFAhsBmSLsrowxRFGURacrdtXUrfwQjaISC1rcppKtCSaakkZsGykqCaQVbeqPuhUUGxSpQKSAwMaC7aZlYZYuyLIgiCjbXWAIIlANuvDtH3O2jvQOc+/M7AzL834lN3PPc57vvd/zz+eeeeacO6kqJEnteN58NyBJmlsGvyQ1xuCXpMYY/JLUGINfkhpj8EtSYwx+SWqMwa8mJbk+yc+S7D7fvUhzzeBXc5IMA28ECnjHvDYjzQODXy36AHAD8DVg1Y7BJC9M8i9JHk1yU5JPJ1k3Yf/Lk6xN8nCSO5O8d+5bl2Zut/luQJoHHwDOBdYDNyQ5oKoeAL4A/A/wImAYuAb4CUCSvYC1wCeAtwKvBq5NsqmqNs35EUgz4Bm/mpLkDcDBwMVVtQH4EfC+JAuA9wBnVNUvqup24IIJpW8H7q2qr1bV9qq6GbgEOGGOD0GaMYNfrVkFXFtVD3Xb3+jGhhj/Dfi+CXMnPj8YeF2SR3Y8gPcz/tuBtEtxqUfNSLIn8F5gQZL7u+HdgX2AA4DtwBLgh92+pRPK7wO+X1VHzVG70k4Tv5ZZrUhyEuPr+MuAX03YdTFwE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wNer6uCqGq6qpcCPGf9Ctvd0a/0HAL/fzb8TGEryf0s/SV45H41LgzL4pXEn8f/P7i8BDgK2ALcBXwbWAz+vql8x/mFxTpJbgI3A781du9L0eeeuNIUke1fV491y0I3Aiqq6f777kqbLNX5palck2Qd4PvApQ1+7Os/4JakxrvFLUmMMfklqjMEvSY0x+CWpMQa/JDXG4JekxvwvCl0lIoUwnTcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAEVCAYAAADARw+NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAESRJREFUeJzt3X1wpWV5x/Hv1V2EdRcBhUZc0KDjaBnXQUmpFXWyahGB0b5QC1pcfJmdvmhtu067jq3YTp1CW6jO1NahKjhKjQo4UqECU42tf4BmEVyWBXlxBXlZdRR0kZGJXv3jPNE0nJM82d3nnFzO9zNzJslz7nvz2ztPfnly55wkMhNJUh2/NOoAkqTlsbglqRiLW5KKsbglqRiLW5KKsbglqRiLW5KKsbhVUkRMR8T3I+LAUWeRhs3iVjkRMQ68GEjgVSMNI42Axa2KXg9cB1wMbJo7GBFPioj/jIgfRMRXIuLvIuJL8+5/dkRcGxHfi4jbIuI1w48u7bvVow4g7YXXAxcA1wPXRcRYZu4G3g88DDwZGAeuBr4JEBFrgWuBdwGvBJ4LXBMROzJzx9D/B9I+8IpbpUTEi4CnAZ/MzG3AncBrI2IV8DvAOZn5o8y8BfjIvKmnAbsy86LMnM3MG4DLgNOH/F+Q9pnFrWo2Addk5nebt/+jOXYEve8g75k3dv7rTwN+LSIenLsBr6N3dS6V4laJyoiINcBrgFUR8UBz+E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8SMnijoh1wGXAn2bmD9pO63NsaA+pGZQ5It4JzAKXDJh6YmY+n95vZ/zjiHhJ52F/nm1h5n8DngEcB9xPb+vhMdP6HBv5OgNnsvjV9tDXOTN/kpnH0btCPQH4lX7D+hwb2RovzBwRz5l3978C/5OZ/ztg+lOz9+zE1wLvjYhndBwXGJj5HcCzgV+ltxXyl32mjvRcXky54m6+ql8GXJKZlzeHd0fEkc39R9L7yrpQq6fud2FAZpofdpwGvK75NvMxMvO+5uW3gU8zhG+Jm2yPyZyZu5tPgp8C/z4gy0pc59XAbwOfGDR3VOvcvM8HgWl6e6+HNnlh8NqNbI3nzMt8MkBEnAMcAfz5InPm1viuZu7zus654P3/LHOztZaZ+WPgIlbYubyUUsXd7FN+CNiZmRfMu+sKYO4nvpuAz/SZfjVwUkQc1nyLf1JzrFODMkfEyfS+yr8qM380YO7aiDh47vUm880jzHzkvGG/NSDLSH5FwiLnBsDLgVsz81sD5g59nSPiiGgeSRQRa5qMO4EvAKc3wwady1cAZ0TEgRFxDPBMenvLnRqQ+daIeDO9/eAzmy/q/eYeNrcdERGHAycCt4ww89yFXtD7OUK/j/dIOqOVUf90dDk34EX0vlX5GnBjczsFeBLw38DtzcsnNuMngA/Om/9Gej/IuQN4w4gz30Fv/2zu2Aea8U8Brmpefzq9Rw/cBOwA3jnizB8FtjfHrwCOXJi5efsUeo/quHPUmZv7Lgb+YMH4ka4z8Fzgq03em2ke7dJk+XJzfnwKOLA5/irgb+fNf2ezvrcBrxzSGg/KPNtkmVv3ueM/+/wDXticOzc1L9804syfb3LcDHyMnz/yZOSd0ebmMyclqZhSWyWSJItbksqxuCWpGItbkoqxuCWpGItbkoqxuCWpGItbkor5P0iGjdR6nKz2AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "data['Diastatus'].hist(grid=True)\n",
    "plt.suptitle('Diastatus')\n",
    "plt.show()\n",
    "\n",
    "data['Age'].plot(kind='box', subplots=True, sharex=False, sharey=False)\n",
    "plt.suptitle('Age')\n",
    "plt.show()\n",
    "\n",
    "data['Age'].hist(grid=True)\n",
    "plt.suptitle('Age')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "del data['ID']\n",
    "del data['Patient']\n",
    "del data['Age']\n",
    "del data['Residence']\n",
    "del data['OtherComplications']\n",
    "del data['ModeofDelivery']\n",
    "del data['Liqor']\n",
    "del data['Apgar']\n",
    "del data['Sex']\n",
    "del data['Babyweight']\n",
    "del data['Gestationalage']\n",
    "del data['Agalgasga']\n",
    "del data['Othercomplications']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "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>Parity</th>\n",
       "      <th>Diastatus</th>\n",
       "      <th>Treatment</th>\n",
       "      <th>Fetalloss</th>\n",
       "      <th>Babysymptoms</th>\n",
       "      <th>Cardiovascularfindings</th>\n",
       "      <th>Chestxray</th>\n",
       "      <th>Echo</th>\n",
       "      <th>Followup</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>8</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Parity  Diastatus  Treatment  Fetalloss  Babysymptoms  \\\n",
       "0        2          3          2          2             1   \n",
       "1        1          3          2          2             2   \n",
       "2        1          3          3          2             2   \n",
       "3        2          3          2          2             2   \n",
       "4        2          3          2          1             2   \n",
       "5        2          3          2          1             2   \n",
       "6        1          3          2          2             1   \n",
       "7        2          3          2          2             2   \n",
       "8        1          3          2          2             2   \n",
       "9        2          3          3          2             2   \n",
       "10       1          3          3          2             2   \n",
       "11       2          3          3          1             3   \n",
       "12       1          3          3          2             1   \n",
       "13       2          3          3          1             1   \n",
       "14       1          2          3          2             2   \n",
       "15       1          2          4          2             3   \n",
       "16       2          2          3          1             1   \n",
       "17       2          2          3          1             1   \n",
       "18       2          3          3          1             2   \n",
       "19       1          3          2          2             2   \n",
       "\n",
       "    Cardiovascularfindings  Chestxray  Echo  Followup  \n",
       "0                        2          1     7         4  \n",
       "1                        2          1     1         2  \n",
       "2                        2          1     1         2  \n",
       "3                        2          1     1         2  \n",
       "4                        2          1     1         2  \n",
       "5                        2          1     1         2  \n",
       "6                        2          1     5         4  \n",
       "7                        2          1     5         1  \n",
       "8                        2          1     1         2  \n",
       "9                        2          1     5         2  \n",
       "10                       2          1     1         2  \n",
       "11                       2          2     3         3  \n",
       "12                       2          1     5         4  \n",
       "13                       2          1     5         4  \n",
       "14                       2          1     1         2  \n",
       "15                       2          2     6         1  \n",
       "16                       2          1     7         2  \n",
       "17                       2          2     8         3  \n",
       "18                       2          1     2         1  \n",
       "19                       2          1     1         2  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape\n",
    "data.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv('Data_Gestational_Diabetes',sep='\\t')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of DSN cases: 10 (19.61%)\n",
      "Number of PD cases: 14 (27.45%)\n",
      "Number of GD cases: 27 (52.94%)\n"
     ]
    }
   ],
   "source": [
    "num_obs = len(data)\n",
    "num_DSN = len(data.loc[data['Diastatus'] == 1.0])\n",
    "num_PD = len(data.loc[data['Diastatus'] == 2.0])\n",
    "num_GD = len(data.loc[data['Diastatus'] == 3.0])\n",
    "print('Number of DSN cases: {0} ({1:2.2f}%)'.format(num_DSN,(num_DSN/num_obs) * 100))\n",
    "print('Number of PD cases: {0} ({1:2.2f}%)'.format(num_PD,(num_PD/num_obs) * 100))\n",
    "print('Number of GD cases: {0} ({1:2.2f}%)'.format(num_GD,(num_GD/num_obs) * 100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "feature_col_names = ['Parity','Treatment','Cardiovascularfindings','Fetalloss','Babysymptoms','Chestxray','Echo','Followup']\n",
    "predicted_class_names = ['Diastatus']\n",
    "X = data[feature_col_names].values\n",
    "Y = data[predicted_class_names].values\n",
    "split_test_size = 0.3\n",
    "X_train, X_test, Y_train, Y_test = train_test_split(X,Y, test_size=split_test_size, random_state=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "68.63% in training set\n",
      "31.37% in test set\n"
     ]
    }
   ],
   "source": [
    "print('{0:0.2f}% in training set'.format((len(X_train)/len(data.index)) * 100))\n",
    "print('{0:0.2f}% in test set'.format((len(X_test)/len(data.index)) * 100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Original DSN : 10 (19.61)\n",
      "Original PD : 14 (27.45)\n",
      "Original GD : 27 (52.94)\n",
      "\n",
      "Training DSN : 8 (22.86%)\n",
      "Training PD : 10 (28.57%)\n",
      "Training GD : 17 (48.57%)\n",
      "\n",
      "Test DSN  :2 (12.50%)\n",
      "Test PD  :4 (25.00%)\n",
      "Test GD  :10 (62.50%)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print('Original DSN : {0} ({1:0.2f})'.format(len(data.loc[data['Diastatus']==1]), (len(data.loc[data['Diastatus']==1])/len(data.index))* 100.0))\n",
    "print('Original PD : {0} ({1:0.2f})'.format(len(data.loc[data['Diastatus']==2]), (len(data.loc[data['Diastatus']==2])/len(data.index))* 100.0))\n",
    "print('Original GD : {0} ({1:0.2f})'.format(len(data.loc[data['Diastatus']==3]), (len(data.loc[data['Diastatus']==3])/len(data.index))* 100.0))\n",
    "print('')\n",
    "print('Training DSN : {0} ({1:.2f}%)'.format(len(Y_train[Y_train[:]==1]),(len(Y_train[Y_train[:]==1])/len(Y_train)*100.0)))\n",
    "print('Training PD : {0} ({1:.2f}%)'.format(len(Y_train[Y_train[:]==2]),(len(Y_train[Y_train[:]==2])/len(Y_train)*100.0)))\n",
    "print('Training GD : {0} ({1:.2f}%)'.format(len(Y_train[Y_train[:]==3]),(len(Y_train[Y_train[:]==3])/len(Y_train)*100.0)))\n",
    "print('')\n",
    "print('Test DSN  :{0} ({1:0.2f}%)'.format(len(Y_test[Y_test[:]==1]), (len(Y_test[Y_test[:]==1])/len(Y_test)*100.0)))\n",
    "print('Test PD  :{0} ({1:0.2f}%)'.format(len(Y_test[Y_test[:]==2]), (len(Y_test[Y_test[:]==2])/len(Y_test)*100.0)))\n",
    "print('Test GD  :{0} ({1:0.2f}%)'.format(len(Y_test[Y_test[:]==3]), (len(Y_test[Y_test[:]==3])/len(Y_test)*100.0)))\n",
    "print('')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GaussianNB(priors=None, var_smoothing=1e-09)"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Gaussian Naive Bayes\n",
    "from sklearn.naive_bayes import GaussianNB\n",
    "nb_model = GaussianNB()\n",
    "nb_model.fit(X_train, Y_train.ravel())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy: 0.8750\n"
     ]
    }
   ],
   "source": [
    "nb_predict_test = nb_model.predict(X_test)\n",
    "from sklearn import metrics\n",
    "print('Accuracy: {0:.4f}'.format(metrics.accuracy_score(Y_test,nb_predict_test)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MultinomialNB(alpha=1.0, class_prior=None, fit_prior=True)"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Multinomial Naive Bayes\n",
    "from sklearn.naive_bayes import MultinomialNB\n",
    "nb_model = MultinomialNB()\n",
    "nb_model.fit(X_train, Y_train.ravel())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy: 0.6250\n"
     ]
    }
   ],
   "source": [
    "nb_predict_test = nb_model.predict(X_test)\n",
    "from sklearn import metrics\n",
    "print('Accuracy: {0:.4f}'.format(metrics.accuracy_score(Y_test,nb_predict_test)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "BernoulliNB(alpha=1.0, binarize=0.0, class_prior=None, fit_prior=True)"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Bernoulli Naive Bayes\n",
    "from sklearn.naive_bayes import BernoulliNB\n",
    "nb_model = BernoulliNB()\n",
    "nb_model.fit(X_train, Y_train.ravel())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy: 0.6250\n"
     ]
    }
   ],
   "source": [
    "nb_predict_test = nb_model.predict(X_test)\n",
    "from sklearn import metrics\n",
    "print('Accuracy: {0:.4f}'.format(metrics.accuracy_score(Y_test,nb_predict_test)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Confusion Matrix\n",
      "[[ 0  0  2]\n",
      " [ 0  0  4]\n",
      " [ 0  0 10]]\n",
      "\n",
      "Classification Report\n",
      "              precision    recall  f1-score   support\n",
      "\n",
      "           1       0.00      0.00      0.00         2\n",
      "           2       0.00      0.00      0.00         4\n",
      "           3       0.62      1.00      0.77        10\n",
      "\n",
      "   micro avg       0.62      0.62      0.62        16\n",
      "   macro avg       0.21      0.33      0.26        16\n",
      "weighted avg       0.39      0.62      0.48        16\n",
      "\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Bhushan\\Anaconda3\\lib\\site-packages\\sklearn\\metrics\\classification.py:1143: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no predicted samples.\n",
      "  'precision', 'predicted', average, warn_for)\n"
     ]
    }
   ],
   "source": [
    "# Confusion Matrix\n",
    "print('Confusion Matrix')\n",
    "print('{0}'.format(metrics.confusion_matrix(Y_test, nb_predict_test)))\n",
    "print('')\n",
    "\n",
    "print('Classification Report')\n",
    "print(metrics.classification_report(Y_test, nb_predict_test))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Bhushan\\Anaconda3\\lib\\site-packages\\sklearn\\ensemble\\forest.py:246: FutureWarning: The default value of n_estimators will change from 10 in version 0.20 to 100 in 0.22.\n",
      "  \"10 in version 0.20 to 100 in 0.22.\", FutureWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',\n",
       "            max_depth=None, max_features='auto', max_leaf_nodes=None,\n",
       "            min_impurity_decrease=0.0, min_impurity_split=None,\n",
       "            min_samples_leaf=1, min_samples_split=2,\n",
       "            min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=None,\n",
       "            oob_score=False, random_state=42, verbose=0, warm_start=False)"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "rf_model = RandomForestClassifier(random_state=42)\n",
    "rf_model.fit(X_train, Y_train.ravel())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy: 0.9429\n"
     ]
    }
   ],
   "source": [
    "rf_predict_train = rf_model.predict(X_train)\n",
    "print('Accuracy: {0:.4f}'.format(metrics.accuracy_score(Y_train, rf_predict_train)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy:  0.8750\n"
     ]
    }
   ],
   "source": [
    "rf_predict_test = rf_model.predict(X_test)\n",
    "print('Accuracy: {0: .4f}'.format(metrics.accuracy_score(Y_test, rf_predict_test)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[2 0 0]\n",
      " [0 4 0]\n",
      " [0 2 8]]\n",
      "\n",
      "Classification Report\n",
      "              precision    recall  f1-score   support\n",
      "\n",
      "           1       1.00      1.00      1.00         2\n",
      "           2       0.67      1.00      0.80         4\n",
      "           3       1.00      0.80      0.89        10\n",
      "\n",
      "   micro avg       0.88      0.88      0.88        16\n",
      "   macro avg       0.89      0.93      0.90        16\n",
      "weighted avg       0.92      0.88      0.88        16\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(metrics.confusion_matrix(Y_test, rf_predict_test))\n",
    "print('')\n",
    "print('Classification Report')\n",
    "print(metrics.classification_report(Y_test, rf_predict_test))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Training Accuracy 0.9411764705882353\n",
      "Testing Accuracy 0.9375\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Bhushan\\Anaconda3\\lib\\site-packages\\sklearn\\preprocessing\\label.py:219: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n",
      "C:\\Users\\Bhushan\\Anaconda3\\lib\\site-packages\\sklearn\\preprocessing\\label.py:252: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n"
     ]
    }
   ],
   "source": [
    "from xgboost import XGBClassifier\n",
    "model = XGBClassifier()\n",
    "model.fit(X,Y)\n",
    "print('Training Accuracy {}'.format(model.score(X,Y)))\n",
    "print('Testing Accuracy {}'.format(model.score(X_test,Y_test)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
View on Github
Thulassi

Comments

Leave a Comment

Post a Comment