Skip to content

Commit fc07942

Browse files
Created using Colaboratory
1 parent 232312c commit fc07942

File tree

1 file changed

+38
-42
lines changed

1 file changed

+38
-42
lines changed

03_Bivariate_Analysis.ipynb

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"name": "03 Bivariate Analysis.ipynb",
77
"provenance": [],
88
"collapsed_sections": [],
9-
"authorship_tag": "ABX9TyP3h+N6kET0tCX6FWRHCXPT",
9+
"authorship_tag": "ABX9TyNitj9yWnY1UKfAQWw62lDF",
1010
"include_colab_link": true
1111
},
1212
"kernelspec": {
@@ -48,7 +48,7 @@
4848
"colab": {
4949
"base_uri": "https://localhost:8080/"
5050
},
51-
"outputId": "8467200f-f18a-450e-ffb6-2dfe3e309771"
51+
"outputId": "30fe1223-c639-45a3-f9b3-ef39fcd02141"
5252
},
5353
"source": [
5454
"# Libraries \n",
@@ -62,7 +62,7 @@
6262
"import warnings\n",
6363
"warnings.simplefilter('ignore')"
6464
],
65-
"execution_count": null,
65+
"execution_count": 1,
6666
"outputs": [
6767
{
6868
"output_type": "stream",
@@ -99,7 +99,7 @@
9999
"boston_pd.columns = boston.feature_names\n",
100100
"boston_pd[\"MEDV\"] = boston.target"
101101
],
102-
"execution_count": 8,
102+
"execution_count": 2,
103103
"outputs": []
104104
},
105105
{
@@ -229,9 +229,9 @@
229229
"id": "4Z8WGscQvAJd",
230230
"colab": {
231231
"base_uri": "https://localhost:8080/",
232-
"height": 483
232+
"height": 452
233233
},
234-
"outputId": "a7694c3c-844b-4a11-f4ea-974e34ad2b6e"
234+
"outputId": "30f5ffab-fe34-4530-8010-385a1d6d1d2b"
235235
},
236236
"source": [
237237
"# Import library for VIF\n",
@@ -246,9 +246,11 @@
246246
"\n",
247247
" return(vif)\n",
248248
"\n",
249-
"calc_vif(boston_pd)"
249+
"# Remove Dependent Column first and then apply VIF\n",
250+
"X = boston_pd.iloc[:,:-1]\n",
251+
"calc_vif(X)"
250252
],
251-
"execution_count": 10,
253+
"execution_count": 3,
252254
"outputs": [
253255
{
254256
"output_type": "execute_result",
@@ -280,97 +282,91 @@
280282
" <tr>\n",
281283
" <th>0</th>\n",
282284
" <td>CRIM</td>\n",
283-
" <td>2.131404</td>\n",
285+
" <td>2.100373</td>\n",
284286
" </tr>\n",
285287
" <tr>\n",
286288
" <th>1</th>\n",
287289
" <td>ZN</td>\n",
288-
" <td>2.910004</td>\n",
290+
" <td>2.844013</td>\n",
289291
" </tr>\n",
290292
" <tr>\n",
291293
" <th>2</th>\n",
292294
" <td>INDUS</td>\n",
293-
" <td>14.485874</td>\n",
295+
" <td>14.485758</td>\n",
294296
" </tr>\n",
295297
" <tr>\n",
296298
" <th>3</th>\n",
297299
" <td>CHAS</td>\n",
298-
" <td>1.176266</td>\n",
300+
" <td>1.152952</td>\n",
299301
" </tr>\n",
300302
" <tr>\n",
301303
" <th>4</th>\n",
302304
" <td>NOX</td>\n",
303-
" <td>74.004269</td>\n",
305+
" <td>73.894947</td>\n",
304306
" </tr>\n",
305307
" <tr>\n",
306308
" <th>5</th>\n",
307309
" <td>RM</td>\n",
308-
" <td>136.101743</td>\n",
310+
" <td>77.948283</td>\n",
309311
" </tr>\n",
310312
" <tr>\n",
311313
" <th>6</th>\n",
312314
" <td>AGE</td>\n",
313-
" <td>21.398863</td>\n",
315+
" <td>21.386850</td>\n",
314316
" </tr>\n",
315317
" <tr>\n",
316318
" <th>7</th>\n",
317319
" <td>DIS</td>\n",
318-
" <td>15.430455</td>\n",
320+
" <td>14.699652</td>\n",
319321
" </tr>\n",
320322
" <tr>\n",
321323
" <th>8</th>\n",
322324
" <td>RAD</td>\n",
323-
" <td>15.369980</td>\n",
325+
" <td>15.167725</td>\n",
324326
" </tr>\n",
325327
" <tr>\n",
326328
" <th>9</th>\n",
327329
" <td>TAX</td>\n",
328-
" <td>61.939713</td>\n",
330+
" <td>61.227274</td>\n",
329331
" </tr>\n",
330332
" <tr>\n",
331333
" <th>10</th>\n",
332334
" <td>PTRATIO</td>\n",
333-
" <td>87.227233</td>\n",
335+
" <td>85.029547</td>\n",
334336
" </tr>\n",
335337
" <tr>\n",
336338
" <th>11</th>\n",
337339
" <td>B</td>\n",
338-
" <td>21.351015</td>\n",
340+
" <td>20.104943</td>\n",
339341
" </tr>\n",
340342
" <tr>\n",
341343
" <th>12</th>\n",
342344
" <td>LSTAT</td>\n",
343-
" <td>12.615188</td>\n",
344-
" </tr>\n",
345-
" <tr>\n",
346-
" <th>13</th>\n",
347-
" <td>MEDV</td>\n",
348-
" <td>24.503206</td>\n",
345+
" <td>11.102025</td>\n",
349346
" </tr>\n",
350347
" </tbody>\n",
351348
"</table>\n",
352349
"</div>"
353350
],
354351
"text/plain": [
355-
" variables VIF\n",
356-
"0 CRIM 2.131404\n",
357-
"1 ZN 2.910004\n",
358-
"2 INDUS 14.485874\n",
359-
"3 CHAS 1.176266\n",
360-
"4 NOX 74.004269\n",
361-
"5 RM 136.101743\n",
362-
"6 AGE 21.398863\n",
363-
"7 DIS 15.430455\n",
364-
"8 RAD 15.369980\n",
365-
"9 TAX 61.939713\n",
366-
"10 PTRATIO 87.227233\n",
367-
"11 B 21.351015\n",
368-
"12 LSTAT 12.615188\n",
369-
"13 MEDV 24.503206"
352+
" variables VIF\n",
353+
"0 CRIM 2.100373\n",
354+
"1 ZN 2.844013\n",
355+
"2 INDUS 14.485758\n",
356+
"3 CHAS 1.152952\n",
357+
"4 NOX 73.894947\n",
358+
"5 RM 77.948283\n",
359+
"6 AGE 21.386850\n",
360+
"7 DIS 14.699652\n",
361+
"8 RAD 15.167725\n",
362+
"9 TAX 61.227274\n",
363+
"10 PTRATIO 85.029547\n",
364+
"11 B 20.104943\n",
365+
"12 LSTAT 11.102025"
370366
]
371367
},
372368
"metadata": {},
373-
"execution_count": 10
369+
"execution_count": 3
374370
}
375371
]
376372
},

0 commit comments

Comments
 (0)