Commit c24e0cd8 authored by Kasuni IT19154954's avatar Kasuni IT19154954

Upload New File

parent 8859787c
{
"cells": [
{
"cell_type": "markdown",
"id": "1c344846",
"metadata": {},
"source": [
"# Import Libraries"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "7c57c318",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"from sklearn.preprocessing import StandardScaler\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn import svm\n",
"from sklearn.metrics import accuracy_score "
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "6b18b06d",
"metadata": {},
"outputs": [],
"source": [
"##LOADING DATA SET\n",
"dataset=pd.read_csv('diabetes.csv')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "d01a25fa",
"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>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>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>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>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>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>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": [
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
"0 6 148 72 35 0 33.6 \n",
"1 1 85 66 29 0 26.6 \n",
"2 8 183 64 0 0 23.3 \n",
"3 1 89 66 23 94 28.1 \n",
"4 0 137 40 35 168 43.1 \n",
"\n",
" DiabetesPedigreeFunction Age Outcome \n",
"0 0.627 50 1 \n",
"1 0.351 31 0 \n",
"2 0.672 32 1 \n",
"3 0.167 21 0 \n",
"4 2.288 33 1 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"##PRINTING THE FIRST 5 ROWS OF THE DATASET\n",
"dataset.head()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "b6487f5d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(768, 9)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"##NUMBER OF ROWS AND COLUMNS IN THIS DATASET\n",
"dataset.shape"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4ce676db",
"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>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>count</th>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" <td>768.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>3.845052</td>\n",
" <td>120.894531</td>\n",
" <td>69.105469</td>\n",
" <td>20.536458</td>\n",
" <td>79.799479</td>\n",
" <td>31.992578</td>\n",
" <td>0.471876</td>\n",
" <td>33.240885</td>\n",
" <td>0.348958</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>3.369578</td>\n",
" <td>31.972618</td>\n",
" <td>19.355807</td>\n",
" <td>15.952218</td>\n",
" <td>115.244002</td>\n",
" <td>7.884160</td>\n",
" <td>0.331329</td>\n",
" <td>11.760232</td>\n",
" <td>0.476951</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.078000</td>\n",
" <td>21.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>1.000000</td>\n",
" <td>99.000000</td>\n",
" <td>62.000000</td>\n",
" <td>0.000000</td>\n",
" <td>0.000000</td>\n",
" <td>27.300000</td>\n",
" <td>0.243750</td>\n",
" <td>24.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>3.000000</td>\n",
" <td>117.000000</td>\n",
" <td>72.000000</td>\n",
" <td>23.000000</td>\n",
" <td>30.500000</td>\n",
" <td>32.000000</td>\n",
" <td>0.372500</td>\n",
" <td>29.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>6.000000</td>\n",
" <td>140.250000</td>\n",
" <td>80.000000</td>\n",
" <td>32.000000</td>\n",
" <td>127.250000</td>\n",
" <td>36.600000</td>\n",
" <td>0.626250</td>\n",
" <td>41.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>17.000000</td>\n",
" <td>199.000000</td>\n",
" <td>122.000000</td>\n",
" <td>99.000000</td>\n",
" <td>846.000000</td>\n",
" <td>67.100000</td>\n",
" <td>2.420000</td>\n",
" <td>81.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Pregnancies Glucose BloodPressure SkinThickness Insulin \\\n",
"count 768.000000 768.000000 768.000000 768.000000 768.000000 \n",
"mean 3.845052 120.894531 69.105469 20.536458 79.799479 \n",
"std 3.369578 31.972618 19.355807 15.952218 115.244002 \n",
"min 0.000000 0.000000 0.000000 0.000000 0.000000 \n",
"25% 1.000000 99.000000 62.000000 0.000000 0.000000 \n",
"50% 3.000000 117.000000 72.000000 23.000000 30.500000 \n",
"75% 6.000000 140.250000 80.000000 32.000000 127.250000 \n",
"max 17.000000 199.000000 122.000000 99.000000 846.000000 \n",
"\n",
" BMI DiabetesPedigreeFunction Age Outcome \n",
"count 768.000000 768.000000 768.000000 768.000000 \n",
"mean 31.992578 0.471876 33.240885 0.348958 \n",
"std 7.884160 0.331329 11.760232 0.476951 \n",
"min 0.000000 0.078000 21.000000 0.000000 \n",
"25% 27.300000 0.243750 24.000000 0.000000 \n",
"50% 32.000000 0.372500 29.000000 0.000000 \n",
"75% 36.600000 0.626250 41.000000 1.000000 \n",
"max 67.100000 2.420000 81.000000 1.000000 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"##GETTING THE STATITICAL MEASURE OF THE DATA\n",
"dataset.describe()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d48c30a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0 500\n",
"1 268\n",
"Name: Outcome, dtype: int64"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataset['Outcome'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5845e03a",
"metadata": {},
"outputs": [],
"source": [
"# 0 -->Non_Diabetic\n",
"# 1 -->Diabetic"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "22e11b5f",
"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>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",
" </tr>\n",
" <tr>\n",
" <th>Outcome</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>3.298000</td>\n",
" <td>109.980000</td>\n",
" <td>68.184000</td>\n",
" <td>19.664000</td>\n",
" <td>68.792000</td>\n",
" <td>30.304200</td>\n",
" <td>0.429734</td>\n",
" <td>31.190000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>4.865672</td>\n",
" <td>141.257463</td>\n",
" <td>70.824627</td>\n",
" <td>22.164179</td>\n",
" <td>100.335821</td>\n",
" <td>35.142537</td>\n",
" <td>0.550500</td>\n",
" <td>37.067164</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Pregnancies Glucose BloodPressure SkinThickness Insulin \\\n",
"Outcome \n",
"0 3.298000 109.980000 68.184000 19.664000 68.792000 \n",
"1 4.865672 141.257463 70.824627 22.164179 100.335821 \n",
"\n",
" BMI DiabetesPedigreeFunction Age \n",
"Outcome \n",
"0 30.304200 0.429734 31.190000 \n",
"1 35.142537 0.550500 37.067164 "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataset.groupby('Outcome').mean()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "c884acc2",
"metadata": {},
"outputs": [],
"source": [
"# SEPERATING THE DATA AND LABELS\n",
"X = dataset.drop(columns='Outcome',axis=1)\n",
"Y = dataset['Outcome']"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "dcaac27a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Pregnancies Glucose BloodPressure SkinThickness Insulin BMI \\\n",
"0 6 148 72 35 0 33.6 \n",
"1 1 85 66 29 0 26.6 \n",
"2 8 183 64 0 0 23.3 \n",
"3 1 89 66 23 94 28.1 \n",
"4 0 137 40 35 168 43.1 \n",
".. ... ... ... ... ... ... \n",
"763 10 101 76 48 180 32.9 \n",
"764 2 122 70 27 0 36.8 \n",
"765 5 121 72 23 112 26.2 \n",
"766 1 126 60 0 0 30.1 \n",
"767 1 93 70 31 0 30.4 \n",
"\n",
" DiabetesPedigreeFunction Age \n",
"0 0.627 50 \n",
"1 0.351 31 \n",
"2 0.672 32 \n",
"3 0.167 21 \n",
"4 2.288 33 \n",
".. ... ... \n",
"763 0.171 63 \n",
"764 0.340 27 \n",
"765 0.245 30 \n",
"766 0.349 47 \n",
"767 0.315 23 \n",
"\n",
"[768 rows x 8 columns]\n"
]
}
],
"source": [
"print(X)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "c686c20b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 1\n",
"1 0\n",
"2 1\n",
"3 0\n",
"4 1\n",
" ..\n",
"763 0\n",
"764 0\n",
"765 0\n",
"766 1\n",
"767 0\n",
"Name: Outcome, Length: 768, dtype: int64\n"
]
}
],
"source": [
"print(Y)"
]
},
{
"cell_type": "markdown",
"id": "336e1c55",
"metadata": {},
"source": [
"# Data Standardization"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "e3ca26f7",
"metadata": {},
"outputs": [],
"source": [
"scaler=StandardScaler()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "aa60bff9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"StandardScaler()"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"scaler.fit(X)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "5080d110",
"metadata": {},
"outputs": [],
"source": [
" standardized_data=scaler.transform(X)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "1af19dcf",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.63994726 0.84832379 0.14964075 ... 0.20401277 0.46849198\n",
" 1.4259954 ]\n",
" [-0.84488505 -1.12339636 -0.16054575 ... -0.68442195 -0.36506078\n",
" -0.19067191]\n",
" [ 1.23388019 1.94372388 -0.26394125 ... -1.10325546 0.60439732\n",
" -0.10558415]\n",
" ...\n",
" [ 0.3429808 0.00330087 0.14964075 ... -0.73518964 -0.68519336\n",
" -0.27575966]\n",
" [-0.84488505 0.1597866 -0.47073225 ... -0.24020459 -0.37110101\n",
" 1.17073215]\n",
" [-0.84488505 -0.8730192 0.04624525 ... -0.20212881 -0.47378505\n",
" -0.87137393]]\n"
]
}
],
"source": [
"print(standardized_data)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "58534dd5",
"metadata": {},
"outputs": [],
"source": [
"X = standardized_data\n",
"Y = dataset['Outcome']"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "b52c7737",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.63994726 0.84832379 0.14964075 ... 0.20401277 0.46849198\n",
" 1.4259954 ]\n",
" [-0.84488505 -1.12339636 -0.16054575 ... -0.68442195 -0.36506078\n",
" -0.19067191]\n",
" [ 1.23388019 1.94372388 -0.26394125 ... -1.10325546 0.60439732\n",
" -0.10558415]\n",
" ...\n",
" [ 0.3429808 0.00330087 0.14964075 ... -0.73518964 -0.68519336\n",
" -0.27575966]\n",
" [-0.84488505 0.1597866 -0.47073225 ... -0.24020459 -0.37110101\n",
" 1.17073215]\n",
" [-0.84488505 -0.8730192 0.04624525 ... -0.20212881 -0.47378505\n",
" -0.87137393]]\n",
"0 1\n",
"1 0\n",
"2 1\n",
"3 0\n",
"4 1\n",
" ..\n",
"763 0\n",
"764 0\n",
"765 0\n",
"766 1\n",
"767 0\n",
"Name: Outcome, Length: 768, dtype: int64\n"
]
}
],
"source": [
"print(X)\n",
"print(Y)"
]
},
{
"cell_type": "markdown",
"id": "19a149b7",
"metadata": {},
"source": [
"# Train Test Split"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "7b8fdbae",
"metadata": {},
"outputs": [],
"source": [
"X_train, X_test, Y_train, Y_test = train_test_split(X,Y,test_size=0.2,stratify=Y, random_state=2)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "b0c39f29",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(768, 8) (614, 8) (154, 8)\n"
]
}
],
"source": [
"print(X.shape,X_train.shape,X_test.shape)"
]
},
{
"cell_type": "markdown",
"id": "fcdc074e",
"metadata": {},
"source": [
"# Training the model"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "0310e412",
"metadata": {},
"outputs": [],
"source": [
"classifier = svm.SVC(kernel='linear')"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "e83bef0d",
"metadata": {},
"outputs": [],
"source": [
"#TRAINING THE SUPPORT VECTOR MACHINE CLASSIFIER"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "ef645549",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"SVC(kernel='linear')"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"classifier.fit(X_train,Y_train)"
]
},
{
"cell_type": "markdown",
"id": "0a476885",
"metadata": {},
"source": [
"# Model Evaluation"
]
},
{
"cell_type": "markdown",
"id": "3d356bed",
"metadata": {},
"source": [
"## Accuracy Score on the training data"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "a596f7d0",
"metadata": {},
"outputs": [],
"source": [
"X_train_prediction = classifier.predict(X_train)\n",
"training_data_accuracy = accuracy_score(X_train_prediction,Y_train)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "b06a2604",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Accuracy score of the training data: 0.7866449511400652\n"
]
}
],
"source": [
"print('Accuracy score of the training data: ',training_data_accuracy)"
]
},
{
"cell_type": "markdown",
"id": "a15e73df",
"metadata": {},
"source": [
"## Accuracy Score of the test data"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "a9ccffd8",
"metadata": {},
"outputs": [],
"source": [
"X_test_prediction = classifier.predict(X_test)\n",
"test_data_accuracy = accuracy_score(X_test_prediction,Y_test)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "a86ef03a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Accuracy score of the test data: 0.7727272727272727\n"
]
}
],
"source": [
"print('Accuracy score of the test data: ',test_data_accuracy)"
]
},
{
"cell_type": "markdown",
"id": "0567c4a4",
"metadata": {},
"source": [
"# Making Predictive System"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "459de276",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.3429808 1.41167241 0.14964075 -0.09637905 0.82661621 -0.78595734\n",
" 0.34768723 1.51108316]]\n",
"[1]\n",
"Person is diabetic\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\SHEHAN\\anaconda3\\lib\\site-packages\\sklearn\\base.py:450: UserWarning: X does not have valid feature names, but StandardScaler was fitted with feature names\n",
" warnings.warn(\n"
]
}
],
"source": [
"input_data = (5,166,72,19,175,25.8,0.587,51)\n",
"\n",
"# CHANGING THE INPUT DATA TO NUMPY ARRAY\n",
"input_data_as_numpy_array = np.asarray(input_data)\n",
"\n",
"# RESHAPE THE ARRAYAS WE ARE PREDICTING FOR ONE INSTANCE\n",
"input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)\n",
"\n",
"# STANDARDIZE THE INPUT DATA\n",
"std_data = scaler.transform(input_data_reshaped)\n",
"print(std_data)\n",
"\n",
"prediction = classifier.predict(std_data)\n",
"print(prediction)\n",
"\n",
"if (prediction[0]==0):\n",
" print('Person is not diabetic')\n",
"else:\n",
" print('Person is diabetic')"
]
},
{
"cell_type": "markdown",
"id": "e82d89db",
"metadata": {},
"source": [
"# Saving the trained Model"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "717224d5",
"metadata": {},
"outputs": [],
"source": [
"import pickle"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "92feb934",
"metadata": {},
"outputs": [],
"source": [
"filename = 'Diabetes_Trained_Model.pkl'\n",
"pickle.dump(classifier,open(filename,'wb'))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment