├── 1. Intro & LA ├── 1.png ├── 2.jpeg └── Intro_and _linear_algebra.ipynb ├── 10. Linear Regression ├── lin_reg.ipynb ├── petrol_consumption.csv └── student_scores.csv ├── 11. Logistic Regression ├── Iris.csv ├── log_reg.ipynb └── new_log_reg.ipynb ├── 12. K-NN ├── Iris.csv └── knn.ipynb ├── 13. NB ├── img │ ├── 1.PNG │ ├── 2.PNG │ ├── 3.PNG │ ├── 4.PNG │ ├── 5.PNG │ └── 6.PNG └── naive_bayes.ipynb ├── 14. SVM ├── ML_Classification.ipynb └── img │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── AI-ML-DL-DS.png │ ├── AmazonReview.PNG │ ├── convex-hull.png │ ├── questions.jpg │ └── train-test.png ├── 15. Decision Trees ├── 1.png ├── DT1.PNG ├── DT2.PNG └── DT3.PNG ├── 16. PCA ├── Iris.csv └── pca.ipynb ├── 17. Ensembles ├── Iris.csv └── ensembles.ipynb ├── 18. Clustering - K Means ├── K-Means.ipynb └── img │ ├── 0.jpg │ ├── 1.png │ ├── 2.png │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ └── Algo.jpg ├── 19. Deep Learning ├── 1.png ├── 10.jpeg ├── 11.jpeg ├── 12.PNG ├── 2.png ├── 3.jpeg ├── 4.jpeg ├── 5.jpg ├── 6.jpg ├── 7.png ├── 8.png └── 9.jpg ├── 2. Stats & numpy └── stat_numpy.ipynb ├── 20. Extras ├── Missing_values, Duplicates, Word_cloud │ ├── missing_values-duplicates-wordcloud.ipynb │ └── spam.csv ├── Resources │ ├── Contents.pdf │ ├── Make Your Own Neural Network (Tariq Rashid) - {CHB Books}.pdf │ └── seven_databases_in_seven_weeks_Database.pdf └── Write Equations in IPython Notebook.txt ├── 3. Probability └── prob.ipynb ├── 4. Pandas - 1 ├── Pandas_1.ipynb ├── data │ ├── Iris.csv │ ├── nyc_weather.csv │ ├── temp │ │ ├── new_excel_file.xlsx │ │ └── new_excel_file_noIndex.xlsx │ └── weather_data.xlsx └── image │ └── 1.jpg ├── 5. Pandas - 2 └── pandas_2.ipynb ├── 6. Viz └── visualization.ipynb ├── 7. EDA-1 ├── eda-1.ipynb └── tel_churn.csv ├── 8. EDA-2 ├── eda-2.ipynb └── tel_churn.csv ├── 9. Feature Engineering ├── 1.png ├── feature_eng.ipynb └── image │ └── 1.png ├── Case Studies ├── Airline Sentiment Analysis │ ├── Tweets.csv │ └── airline_sentiment.ipynb ├── Car Price Prediction │ ├── 1.1. CarPrice_Data.csv │ ├── 1.2. Data Dictionary - carprices.xlsx │ └── Car Price Prediction.ipynb └── Credit Card Fraud │ ├── credit-card-fraud-analysis.ipynb │ └── dataset.txt ├── LICENSE ├── README.md └── cheat_sheets ├── Graphs.jpeg ├── LaTeX_sheet.pdf ├── ML_cheatsheet-01.png ├── Matplotlib.pdf ├── Pandas.pdf ├── Python.pdf ├── Scikit_Learn_Cheat_Sheet_Python.pdf └── numpy-cheat-sheet.pdf /1. Intro & LA/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/1. Intro & LA/1.png -------------------------------------------------------------------------------- /1. Intro & LA/2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/1. Intro & LA/2.jpeg -------------------------------------------------------------------------------- /1. Intro & LA/Intro_and _linear_algebra.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Intro to Machine Learning" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Why AI?" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Applications" 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "Autonomous Checkout, Real Time System \n", 36 | "https://www.youtube.com/watch?v=yeS8TJwBAFs\n", 37 | "\n", 38 | "drive.ai Rainy Night Autonomous Drive\n", 39 | "https://www.youtube.com/watch?v=GMvgtPN2IBU\n", 40 | "\n", 41 | "Google Duplex I/O '18\n", 42 | "https://www.youtube.com/watch?v=2V6NHKmfnW0" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### AI vs ML vs DL" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 9, 62 | "metadata": { 63 | "ExecuteTime": { 64 | "end_time": "2018-06-03T17:45:21.374236Z", 65 | "start_time": "2018-06-03T17:45:21.355340Z" 66 | } 67 | }, 68 | "outputs": [], 69 | "source": [ 70 | "# Ven Diagram" 71 | ] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "metadata": { 76 | "ExecuteTime": { 77 | "end_time": "2018-06-03T15:34:16.182602Z", 78 | "start_time": "2018-06-03T15:34:16.151840Z" 79 | } 80 | }, 81 | "source": [ 82 | "## Lists" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 1, 88 | "metadata": { 89 | "ExecuteTime": { 90 | "end_time": "2018-06-04T07:21:14.603194Z", 91 | "start_time": "2018-06-04T07:21:14.581136Z" 92 | }, 93 | "scrolled": true 94 | }, 95 | "outputs": [ 96 | { 97 | "name": "stdout", 98 | "output_type": "stream", 99 | "text": [ 100 | "['shark', 'cuttlefish', 'squid', 'mantisshrimp', 'anemone']\n", 101 | "\n", 102 | "5\n" 103 | ] 104 | } 105 | ], 106 | "source": [ 107 | "sea_creatures = ['shark', 'cuttlefish', 'squid', 'mantisshrimp', 'anemone']\n", 108 | "\n", 109 | "print(sea_creatures)\n", 110 | "\n", 111 | "print(type(sea_creatures))\n", 112 | "\n", 113 | "print(len(sea_creatures))" 114 | ] 115 | }, 116 | { 117 | "cell_type": "code", 118 | "execution_count": 5, 119 | "metadata": { 120 | "ExecuteTime": { 121 | "end_time": "2018-06-04T07:24:26.258255Z", 122 | "start_time": "2018-06-04T07:24:26.240525Z" 123 | } 124 | }, 125 | "outputs": [ 126 | { 127 | "name": "stdout", 128 | "output_type": "stream", 129 | "text": [ 130 | "shark\n", 131 | "cuttlefish\n", 132 | "squid\n", 133 | "mantisshrimp\n", 134 | "anemone\n", 135 | "********************\n", 136 | "anemone\n", 137 | "mantisshrimp\n", 138 | "squid\n", 139 | "cuttlefish\n", 140 | "shark\n" 141 | ] 142 | }, 143 | { 144 | "ename": "IndexError", 145 | "evalue": "list index out of range", 146 | "output_type": "error", 147 | "traceback": [ 148 | "\u001b[1;31m------------------------------------------------------------------\u001b[0m", 149 | "\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", 150 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 24\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msea_creatures\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 25\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 26\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msea_creatures\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m6\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 27\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[0mx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 151 | "\u001b[1;31mIndexError\u001b[0m: list index out of range" 152 | ] 153 | } 154 | ], 155 | "source": [ 156 | "print(sea_creatures[0])\n", 157 | "\n", 158 | "print(sea_creatures[1])\n", 159 | "\n", 160 | "print(sea_creatures[2])\n", 161 | "\n", 162 | "print(sea_creatures[3])\n", 163 | "\n", 164 | "print(sea_creatures[4])\n", 165 | "\n", 166 | "# try print(sea_creatures[5]) it will throw out of range error\n", 167 | "\n", 168 | "print('*'*20)\n", 169 | "\n", 170 | "\n", 171 | "print(sea_creatures[-1])\n", 172 | "\n", 173 | "print(sea_creatures[-2])\n", 174 | "\n", 175 | "print(sea_creatures[-3])\n", 176 | "\n", 177 | "print(sea_creatures[-4])\n", 178 | "\n", 179 | "print(sea_creatures[-5])\n", 180 | "\n", 181 | "print(sea_creatures[-6])\n", 182 | "\n", 183 | "x = input()\n", 184 | "\n", 185 | "prin(x)\n", 186 | "\n", 187 | "# try print(sea_creatures[-6]) it will throw out of range error" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": 4, 193 | "metadata": { 194 | "ExecuteTime": { 195 | "end_time": "2018-06-03T15:34:52.467729Z", 196 | "start_time": "2018-06-03T15:34:52.452102Z" 197 | } 198 | }, 199 | "outputs": [ 200 | { 201 | "name": "stdout", 202 | "output_type": "stream", 203 | "text": [ 204 | "[10, 'Hi', 20.2, True]\n" 205 | ] 206 | }, 207 | { 208 | "data": { 209 | "text/plain": [ 210 | "\"\\nThis is a multi line comment demonstrated by using triple single-quote\\n\\nAbove mentioned list 'l' is a collection of heterogeneous data types.\\n\"" 211 | ] 212 | }, 213 | "execution_count": 4, 214 | "metadata": {}, 215 | "output_type": "execute_result" 216 | } 217 | ], 218 | "source": [ 219 | "l = []\n", 220 | "\n", 221 | "l.append(10)\n", 222 | "\n", 223 | "l.append('Hi')\n", 224 | "\n", 225 | "l.append(20.20)\n", 226 | "\n", 227 | "l.append(True)\n", 228 | "\n", 229 | "print(l)\n", 230 | "\n", 231 | "'''\n", 232 | "This is a multi line comment demonstrated by using triple single-quote\n", 233 | "\n", 234 | "Above mentioned list 'l' is a collection of heterogeneous data types.\n", 235 | "'''" 236 | ] 237 | }, 238 | { 239 | "cell_type": "code", 240 | "execution_count": 5, 241 | "metadata": { 242 | "ExecuteTime": { 243 | "end_time": "2018-06-03T15:38:23.142813Z", 244 | "start_time": "2018-06-03T15:38:23.127188Z" 245 | } 246 | }, 247 | "outputs": [ 248 | { 249 | "name": "stdout", 250 | "output_type": "stream", 251 | "text": [ 252 | "a\n", 253 | "5\n" 254 | ] 255 | } 256 | ], 257 | "source": [ 258 | "\"\"\"\n", 259 | "This is a multi line comment demonstrated by using triple double-quote\n", 260 | "\n", 261 | "This is an example for nested lists.\n", 262 | "\"\"\"\n", 263 | "\n", 264 | "nest_list = ['Happy', [2, 0, 1, 5]]\n", 265 | "\n", 266 | "print(nest_list[0][1])\n", 267 | "\n", 268 | "print(nest_list[1][3])" 269 | ] 270 | }, 271 | { 272 | "cell_type": "code", 273 | "execution_count": 6, 274 | "metadata": { 275 | "ExecuteTime": { 276 | "end_time": "2018-06-03T15:38:23.752288Z", 277 | "start_time": "2018-06-03T15:38:23.721376Z" 278 | }, 279 | "scrolled": true 280 | }, 281 | "outputs": [ 282 | { 283 | "name": "stdout", 284 | "output_type": "stream", 285 | "text": [ 286 | "['shark', 'cuttlefish', 'squid', 'mantisshrimp', 'anemone']\n", 287 | "['shark', 'octopus', 'squid', 'mantisshrimp', 'anemone']\n", 288 | "['shark', 'octopus', 'blobfish', 'mantisshrimp', 'anemone']\n" 289 | ] 290 | } 291 | ], 292 | "source": [ 293 | "\"\"\"\n", 294 | "Because lists are mutable, below written code will\n", 295 | "overwrite existing list\n", 296 | "\"\"\"\n", 297 | "\n", 298 | "sea_creatures = ['shark', 'cuttlefish', 'squid', 'mantisshrimp', 'anemone']\n", 299 | "\n", 300 | "print(sea_creatures)\n", 301 | "\n", 302 | "sea_creatures[1] = 'octopus'\n", 303 | "\n", 304 | "print(sea_creatures)\n", 305 | "\n", 306 | "sea_creatures[-3] = 'blobfish'\n", 307 | "\n", 308 | "print(sea_creatures)" 309 | ] 310 | }, 311 | { 312 | "cell_type": "code", 313 | "execution_count": 6, 314 | "metadata": { 315 | "ExecuteTime": { 316 | "end_time": "2018-06-04T07:34:58.952840Z", 317 | "start_time": "2018-06-04T07:34:58.947366Z" 318 | }, 319 | "scrolled": false 320 | }, 321 | "outputs": [ 322 | { 323 | "name": "stdout", 324 | "output_type": "stream", 325 | "text": [ 326 | "['p', 'o', 'r', 'm', 'z']\n" 327 | ] 328 | } 329 | ], 330 | "source": [ 331 | "# Below we are demonstrating the list slicing operation.\n", 332 | "\n", 333 | "my_list = ['p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z']\n", 334 | "\n", 335 | "print(my_list[::2])\n", 336 | "\n", 337 | "# print(my_list[2:5])\n", 338 | "\n", 339 | "# print(my_list[:-5])\n", 340 | "\n", 341 | "# print(my_list[-5:])\n", 342 | "\n", 343 | "# print(my_list[5:])\n", 344 | "\n", 345 | "# print(my_list[:])\n", 346 | "\n", 347 | "# print(my_list[-4:-2])\n", 348 | "\n", 349 | "# print(my_list[-3:])" 350 | ] 351 | }, 352 | { 353 | "cell_type": "code", 354 | "execution_count": 7, 355 | "metadata": { 356 | "ExecuteTime": { 357 | "end_time": "2018-06-03T15:38:26.627598Z", 358 | "start_time": "2018-06-03T15:38:26.611933Z" 359 | } 360 | }, 361 | "outputs": [], 362 | "source": [ 363 | "# append(element)\n", 364 | "\n", 365 | "# insert(index, element) This will insert 'element' at the given 'index'\n", 366 | "\n", 367 | "# list1.extend(list2) appends list2 at the end of list1\n", 368 | "\n", 369 | "# list.index(element) \n", 370 | "\n", 371 | "# list.index(element, index) find next element starting at 'index'\n", 372 | "\n", 373 | "# list.remove(element)\n", 374 | "\n", 375 | "# list.sort() here list should contain one kind of data type\n", 376 | "\n", 377 | "# list.reverse()\n", 378 | "\n", 379 | "# list.pop(index)\n", 380 | "\n", 381 | "# list.count(element)" 382 | ] 383 | }, 384 | { 385 | "cell_type": "markdown", 386 | "metadata": {}, 387 | "source": [ 388 | "## Linear Algebra" 389 | ] 390 | }, 391 | { 392 | "cell_type": "markdown", 393 | "metadata": {}, 394 | "source": [ 395 | "### Why to Learn Linear Algebra?" 396 | ] 397 | } 398 | ], 399 | "metadata": { 400 | "kernelspec": { 401 | "display_name": "Python 3", 402 | "language": "python", 403 | "name": "python3" 404 | }, 405 | "language_info": { 406 | "codemirror_mode": { 407 | "name": "ipython", 408 | "version": 3 409 | }, 410 | "file_extension": ".py", 411 | "mimetype": "text/x-python", 412 | "name": "python", 413 | "nbconvert_exporter": "python", 414 | "pygments_lexer": "ipython3", 415 | "version": "3.6.5" 416 | }, 417 | "toc": { 418 | "nav_menu": {}, 419 | "number_sections": true, 420 | "sideBar": true, 421 | "skip_h1_title": false, 422 | "title_cell": "Table of Contents", 423 | "title_sidebar": "Contents", 424 | "toc_cell": false, 425 | "toc_position": {}, 426 | "toc_section_display": true, 427 | "toc_window_display": false 428 | }, 429 | "varInspector": { 430 | "cols": { 431 | "lenName": 16, 432 | "lenType": 16, 433 | "lenVar": 40 434 | }, 435 | "kernels_config": { 436 | "python": { 437 | "delete_cmd_postfix": "", 438 | "delete_cmd_prefix": "del ", 439 | "library": "var_list.py", 440 | "varRefreshCmd": "print(var_dic_list())" 441 | }, 442 | "r": { 443 | "delete_cmd_postfix": ") ", 444 | "delete_cmd_prefix": "rm(", 445 | "library": "var_list.r", 446 | "varRefreshCmd": "cat(var_dic_list()) " 447 | } 448 | }, 449 | "types_to_exclude": [ 450 | "module", 451 | "function", 452 | "builtin_function_or_method", 453 | "instance", 454 | "_Feature" 455 | ], 456 | "window_display": false 457 | } 458 | }, 459 | "nbformat": 4, 460 | "nbformat_minor": 2 461 | } 462 | -------------------------------------------------------------------------------- /10. Linear Regression/petrol_consumption.csv: -------------------------------------------------------------------------------- 1 | Petrol_tax,Average_income,Paved_Highways,Population_Driver_licence(%),Petrol_Consumption 2 | 9.00,3571,1976,0.5250,541 3 | 9.00,4092,1250,0.5720,524 4 | 9.00,3865,1586,0.5800,561 5 | 7.50,4870,2351,0.5290,414 6 | 8.00,4399,431,0.5440,410 7 | 10.00,5342,1333,0.5710,457 8 | 8.00,5319,11868,0.4510,344 9 | 8.00,5126,2138,0.5530,467 10 | 8.00,4447,8577,0.5290,464 11 | 7.00,4512,8507,0.5520,498 12 | 8.00,4391,5939,0.5300,580 13 | 7.50,5126,14186,0.5250,471 14 | 7.00,4817,6930,0.5740,525 15 | 7.00,4207,6580,0.5450,508 16 | 7.00,4332,8159,0.6080,566 17 | 7.00,4318,10340,0.5860,635 18 | 7.00,4206,8508,0.5720,603 19 | 7.00,3718,4725,0.5400,714 20 | 7.00,4716,5915,0.7240,865 21 | 8.50,4341,6010,0.6770,640 22 | 7.00,4593,7834,0.6630,649 23 | 8.00,4983,602,0.6020,540 24 | 9.00,4897,2449,0.5110,464 25 | 9.00,4258,4686,0.5170,547 26 | 8.50,4574,2619,0.5510,460 27 | 9.00,3721,4746,0.5440,566 28 | 8.00,3448,5399,0.5480,577 29 | 7.50,3846,9061,0.5790,631 30 | 8.00,4188,5975,0.5630,574 31 | 9.00,3601,4650,0.4930,534 32 | 7.00,3640,6905,0.5180,571 33 | 7.00,3333,6594,0.5130,554 34 | 8.00,3063,6524,0.5780,577 35 | 7.50,3357,4121,0.5470,628 36 | 8.00,3528,3495,0.4870,487 37 | 6.58,3802,7834,0.6290,644 38 | 5.00,4045,17782,0.5660,640 39 | 7.00,3897,6385,0.5860,704 40 | 8.50,3635,3274,0.6630,648 41 | 7.00,4345,3905,0.6720,968 42 | 7.00,4449,4639,0.6260,587 43 | 7.00,3656,3985,0.5630,699 44 | 7.00,4300,3635,0.6030,632 45 | 7.00,3745,2611,0.5080,591 46 | 6.00,5215,2302,0.6720,782 47 | 9.00,4476,3942,0.5710,510 48 | 7.00,4296,4083,0.6230,610 49 | 7.00,5002,9794,0.5930,524 50 | -------------------------------------------------------------------------------- /10. Linear Regression/student_scores.csv: -------------------------------------------------------------------------------- 1 | Hours,Scores 2 | 2.5,21 3 | 5.1,47 4 | 3.2,27 5 | 8.5,75 6 | 3.5,30 7 | 1.5,20 8 | 9.2,88 9 | 5.5,60 10 | 8.3,81 11 | 2.7,25 12 | 7.7,85 13 | 5.9,62 14 | 4.5,41 15 | 3.3,42 16 | 1.1,17 17 | 8.9,95 18 | 2.5,30 19 | 1.9,24 20 | 6.1,67 21 | 7.4,69 22 | 2.7,30 23 | 4.8,54 24 | 3.8,35 25 | 6.9,76 26 | 7.8,86 27 | -------------------------------------------------------------------------------- /11. Logistic Regression/Iris.csv: -------------------------------------------------------------------------------- 1 | Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species 2 | 1,5.1,3.5,1.4,0.2,Iris-setosa 3 | 2,4.9,3.0,1.4,0.2,Iris-setosa 4 | 3,4.7,3.2,1.3,0.2,Iris-setosa 5 | 4,4.6,3.1,1.5,0.2,Iris-setosa 6 | 5,5.0,3.6,1.4,0.2,Iris-setosa 7 | 6,5.4,3.9,1.7,0.4,Iris-setosa 8 | 7,4.6,3.4,1.4,0.3,Iris-setosa 9 | 8,5.0,3.4,1.5,0.2,Iris-setosa 10 | 9,4.4,2.9,1.4,0.2,Iris-setosa 11 | 10,4.9,3.1,1.5,0.1,Iris-setosa 12 | 11,5.4,3.7,1.5,0.2,Iris-setosa 13 | 12,4.8,3.4,1.6,0.2,Iris-setosa 14 | 13,4.8,3.0,1.4,0.1,Iris-setosa 15 | 14,4.3,3.0,1.1,0.1,Iris-setosa 16 | 15,5.8,4.0,1.2,0.2,Iris-setosa 17 | 16,5.7,4.4,1.5,0.4,Iris-setosa 18 | 17,5.4,3.9,1.3,0.4,Iris-setosa 19 | 18,5.1,3.5,1.4,0.3,Iris-setosa 20 | 19,5.7,3.8,1.7,0.3,Iris-setosa 21 | 20,5.1,3.8,1.5,0.3,Iris-setosa 22 | 21,5.4,3.4,1.7,0.2,Iris-setosa 23 | 22,5.1,3.7,1.5,0.4,Iris-setosa 24 | 23,4.6,3.6,1.0,0.2,Iris-setosa 25 | 24,5.1,3.3,1.7,0.5,Iris-setosa 26 | 25,4.8,3.4,1.9,0.2,Iris-setosa 27 | 26,5.0,3.0,1.6,0.2,Iris-setosa 28 | 27,5.0,3.4,1.6,0.4,Iris-setosa 29 | 28,5.2,3.5,1.5,0.2,Iris-setosa 30 | 29,5.2,3.4,1.4,0.2,Iris-setosa 31 | 30,4.7,3.2,1.6,0.2,Iris-setosa 32 | 31,4.8,3.1,1.6,0.2,Iris-setosa 33 | 32,5.4,3.4,1.5,0.4,Iris-setosa 34 | 33,5.2,4.1,1.5,0.1,Iris-setosa 35 | 34,5.5,4.2,1.4,0.2,Iris-setosa 36 | 35,4.9,3.1,1.5,0.1,Iris-setosa 37 | 36,5.0,3.2,1.2,0.2,Iris-setosa 38 | 37,5.5,3.5,1.3,0.2,Iris-setosa 39 | 38,4.9,3.1,1.5,0.1,Iris-setosa 40 | 39,4.4,3.0,1.3,0.2,Iris-setosa 41 | 40,5.1,3.4,1.5,0.2,Iris-setosa 42 | 41,5.0,3.5,1.3,0.3,Iris-setosa 43 | 42,4.5,2.3,1.3,0.3,Iris-setosa 44 | 43,4.4,3.2,1.3,0.2,Iris-setosa 45 | 44,5.0,3.5,1.6,0.6,Iris-setosa 46 | 45,5.1,3.8,1.9,0.4,Iris-setosa 47 | 46,4.8,3.0,1.4,0.3,Iris-setosa 48 | 47,5.1,3.8,1.6,0.2,Iris-setosa 49 | 48,4.6,3.2,1.4,0.2,Iris-setosa 50 | 49,5.3,3.7,1.5,0.2,Iris-setosa 51 | 50,5.0,3.3,1.4,0.2,Iris-setosa 52 | 51,7.0,3.2,4.7,1.4,Iris-versicolor 53 | 52,6.4,3.2,4.5,1.5,Iris-versicolor 54 | 53,6.9,3.1,4.9,1.5,Iris-versicolor 55 | 54,5.5,2.3,4.0,1.3,Iris-versicolor 56 | 55,6.5,2.8,4.6,1.5,Iris-versicolor 57 | 56,5.7,2.8,4.5,1.3,Iris-versicolor 58 | 57,6.3,3.3,4.7,1.6,Iris-versicolor 59 | 58,4.9,2.4,3.3,1.0,Iris-versicolor 60 | 59,6.6,2.9,4.6,1.3,Iris-versicolor 61 | 60,5.2,2.7,3.9,1.4,Iris-versicolor 62 | 61,5.0,2.0,3.5,1.0,Iris-versicolor 63 | 62,5.9,3.0,4.2,1.5,Iris-versicolor 64 | 63,6.0,2.2,4.0,1.0,Iris-versicolor 65 | 64,6.1,2.9,4.7,1.4,Iris-versicolor 66 | 65,5.6,2.9,3.6,1.3,Iris-versicolor 67 | 66,6.7,3.1,4.4,1.4,Iris-versicolor 68 | 67,5.6,3.0,4.5,1.5,Iris-versicolor 69 | 68,5.8,2.7,4.1,1.0,Iris-versicolor 70 | 69,6.2,2.2,4.5,1.5,Iris-versicolor 71 | 70,5.6,2.5,3.9,1.1,Iris-versicolor 72 | 71,5.9,3.2,4.8,1.8,Iris-versicolor 73 | 72,6.1,2.8,4.0,1.3,Iris-versicolor 74 | 73,6.3,2.5,4.9,1.5,Iris-versicolor 75 | 74,6.1,2.8,4.7,1.2,Iris-versicolor 76 | 75,6.4,2.9,4.3,1.3,Iris-versicolor 77 | 76,6.6,3.0,4.4,1.4,Iris-versicolor 78 | 77,6.8,2.8,4.8,1.4,Iris-versicolor 79 | 78,6.7,3.0,5.0,1.7,Iris-versicolor 80 | 79,6.0,2.9,4.5,1.5,Iris-versicolor 81 | 80,5.7,2.6,3.5,1.0,Iris-versicolor 82 | 81,5.5,2.4,3.8,1.1,Iris-versicolor 83 | 82,5.5,2.4,3.7,1.0,Iris-versicolor 84 | 83,5.8,2.7,3.9,1.2,Iris-versicolor 85 | 84,6.0,2.7,5.1,1.6,Iris-versicolor 86 | 85,5.4,3.0,4.5,1.5,Iris-versicolor 87 | 86,6.0,3.4,4.5,1.6,Iris-versicolor 88 | 87,6.7,3.1,4.7,1.5,Iris-versicolor 89 | 88,6.3,2.3,4.4,1.3,Iris-versicolor 90 | 89,5.6,3.0,4.1,1.3,Iris-versicolor 91 | 90,5.5,2.5,4.0,1.3,Iris-versicolor 92 | 91,5.5,2.6,4.4,1.2,Iris-versicolor 93 | 92,6.1,3.0,4.6,1.4,Iris-versicolor 94 | 93,5.8,2.6,4.0,1.2,Iris-versicolor 95 | 94,5.0,2.3,3.3,1.0,Iris-versicolor 96 | 95,5.6,2.7,4.2,1.3,Iris-versicolor 97 | 96,5.7,3.0,4.2,1.2,Iris-versicolor 98 | 97,5.7,2.9,4.2,1.3,Iris-versicolor 99 | 98,6.2,2.9,4.3,1.3,Iris-versicolor 100 | 99,5.1,2.5,3.0,1.1,Iris-versicolor 101 | 100,5.7,2.8,4.1,1.3,Iris-versicolor 102 | 101,6.3,3.3,6.0,2.5,Iris-virginica 103 | 102,5.8,2.7,5.1,1.9,Iris-virginica 104 | 103,7.1,3.0,5.9,2.1,Iris-virginica 105 | 104,6.3,2.9,5.6,1.8,Iris-virginica 106 | 105,6.5,3.0,5.8,2.2,Iris-virginica 107 | 106,7.6,3.0,6.6,2.1,Iris-virginica 108 | 107,4.9,2.5,4.5,1.7,Iris-virginica 109 | 108,7.3,2.9,6.3,1.8,Iris-virginica 110 | 109,6.7,2.5,5.8,1.8,Iris-virginica 111 | 110,7.2,3.6,6.1,2.5,Iris-virginica 112 | 111,6.5,3.2,5.1,2.0,Iris-virginica 113 | 112,6.4,2.7,5.3,1.9,Iris-virginica 114 | 113,6.8,3.0,5.5,2.1,Iris-virginica 115 | 114,5.7,2.5,5.0,2.0,Iris-virginica 116 | 115,5.8,2.8,5.1,2.4,Iris-virginica 117 | 116,6.4,3.2,5.3,2.3,Iris-virginica 118 | 117,6.5,3.0,5.5,1.8,Iris-virginica 119 | 118,7.7,3.8,6.7,2.2,Iris-virginica 120 | 119,7.7,2.6,6.9,2.3,Iris-virginica 121 | 120,6.0,2.2,5.0,1.5,Iris-virginica 122 | 121,6.9,3.2,5.7,2.3,Iris-virginica 123 | 122,5.6,2.8,4.9,2.0,Iris-virginica 124 | 123,7.7,2.8,6.7,2.0,Iris-virginica 125 | 124,6.3,2.7,4.9,1.8,Iris-virginica 126 | 125,6.7,3.3,5.7,2.1,Iris-virginica 127 | 126,7.2,3.2,6.0,1.8,Iris-virginica 128 | 127,6.2,2.8,4.8,1.8,Iris-virginica 129 | 128,6.1,3.0,4.9,1.8,Iris-virginica 130 | 129,6.4,2.8,5.6,2.1,Iris-virginica 131 | 130,7.2,3.0,5.8,1.6,Iris-virginica 132 | 131,7.4,2.8,6.1,1.9,Iris-virginica 133 | 132,7.9,3.8,6.4,2.0,Iris-virginica 134 | 133,6.4,2.8,5.6,2.2,Iris-virginica 135 | 134,6.3,2.8,5.1,1.5,Iris-virginica 136 | 135,6.1,2.6,5.6,1.4,Iris-virginica 137 | 136,7.7,3.0,6.1,2.3,Iris-virginica 138 | 137,6.3,3.4,5.6,2.4,Iris-virginica 139 | 138,6.4,3.1,5.5,1.8,Iris-virginica 140 | 139,6.0,3.0,4.8,1.8,Iris-virginica 141 | 140,6.9,3.1,5.4,2.1,Iris-virginica 142 | 141,6.7,3.1,5.6,2.4,Iris-virginica 143 | 142,6.9,3.1,5.1,2.3,Iris-virginica 144 | 143,5.8,2.7,5.1,1.9,Iris-virginica 145 | 144,6.8,3.2,5.9,2.3,Iris-virginica 146 | 145,6.7,3.3,5.7,2.5,Iris-virginica 147 | 146,6.7,3.0,5.2,2.3,Iris-virginica 148 | 147,6.3,2.5,5.0,1.9,Iris-virginica 149 | 148,6.5,3.0,5.2,2.0,Iris-virginica 150 | 149,6.2,3.4,5.4,2.3,Iris-virginica 151 | 150,5.9,3.0,5.1,1.8,Iris-virginica 152 | -------------------------------------------------------------------------------- /11. Logistic Regression/log_reg.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Logistic Regression" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Loading the Data" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 2, 20 | "metadata": { 21 | "ExecuteTime": { 22 | "end_time": "2018-06-27T07:25:58.718167Z", 23 | "start_time": "2018-06-27T07:25:57.551171Z" 24 | } 25 | }, 26 | "outputs": [], 27 | "source": [ 28 | "from sklearn.datasets import load_digits\n", 29 | "digits = load_digits()" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 3, 35 | "metadata": { 36 | "ExecuteTime": { 37 | "end_time": "2018-06-27T02:28:40.716144Z", 38 | "start_time": "2018-06-27T02:28:40.701976Z" 39 | } 40 | }, 41 | "outputs": [ 42 | { 43 | "name": "stdout", 44 | "output_type": "stream", 45 | "text": [ 46 | "(1797, 64)\n", 47 | "(1797,)\n" 48 | ] 49 | } 50 | ], 51 | "source": [ 52 | "print(digits.data.shape)\n", 53 | "\n", 54 | "print(digits.target.shape)" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": 4, 60 | "metadata": { 61 | "ExecuteTime": { 62 | "end_time": "2018-06-27T02:28:40.827330Z", 63 | "start_time": "2018-06-27T02:28:40.760955Z" 64 | } 65 | }, 66 | "outputs": [ 67 | { 68 | "data": { 69 | "text/plain": [ 70 | "array([[ 0., 0., 5., 13., 9., 1., 0., 0., 0., 0., 13., 15., 10.,\n", 71 | " 15., 5., 0., 0., 3., 15., 2., 0., 11., 8., 0., 0., 4.,\n", 72 | " 12., 0., 0., 8., 8., 0., 0., 5., 8., 0., 0., 9., 8.,\n", 73 | " 0., 0., 4., 11., 0., 1., 12., 7., 0., 0., 2., 14., 5.,\n", 74 | " 10., 12., 0., 0., 0., 0., 6., 13., 10., 0., 0., 0.],\n", 75 | " [ 0., 0., 0., 12., 13., 5., 0., 0., 0., 0., 0., 11., 16.,\n", 76 | " 9., 0., 0., 0., 0., 3., 15., 16., 6., 0., 0., 0., 7.,\n", 77 | " 15., 16., 16., 2., 0., 0., 0., 0., 1., 16., 16., 3., 0.,\n", 78 | " 0., 0., 0., 1., 16., 16., 6., 0., 0., 0., 0., 1., 16.,\n", 79 | " 16., 6., 0., 0., 0., 0., 0., 11., 16., 10., 0., 0.]])" 80 | ] 81 | }, 82 | "execution_count": 4, 83 | "metadata": {}, 84 | "output_type": "execute_result" 85 | } 86 | ], 87 | "source": [ 88 | "digits.data[0:2]" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": 5, 94 | "metadata": { 95 | "ExecuteTime": { 96 | "end_time": "2018-06-27T02:28:40.938826Z", 97 | "start_time": "2018-06-27T02:28:40.860805Z" 98 | } 99 | }, 100 | "outputs": [ 101 | { 102 | "name": "stdout", 103 | "output_type": "stream", 104 | "text": [ 105 | "Optical Recognition of Handwritten Digits Data Set\n", 106 | "===================================================\n", 107 | "\n", 108 | "Notes\n", 109 | "-----\n", 110 | "Data Set Characteristics:\n", 111 | " :Number of Instances: 5620\n", 112 | " :Number of Attributes: 64\n", 113 | " :Attribute Information: 8x8 image of integer pixels in the range 0..16.\n", 114 | " :Missing Attribute Values: None\n", 115 | " :Creator: E. Alpaydin (alpaydin '@' boun.edu.tr)\n", 116 | " :Date: July; 1998\n", 117 | "\n", 118 | "This is a copy of the test set of the UCI ML hand-written digits datasets\n", 119 | "http://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits\n", 120 | "\n", 121 | "The data set contains images of hand-written digits: 10 classes where\n", 122 | "each class refers to a digit.\n", 123 | "\n", 124 | "Preprocessing programs made available by NIST were used to extract\n", 125 | "normalized bitmaps of handwritten digits from a preprinted form. From a\n", 126 | "total of 43 people, 30 contributed to the training set and different 13\n", 127 | "to the test set. 32x32 bitmaps are divided into nonoverlapping blocks of\n", 128 | "4x4 and the number of on pixels are counted in each block. This generates\n", 129 | "an input matrix of 8x8 where each element is an integer in the range\n", 130 | "0..16. This reduces dimensionality and gives invariance to small\n", 131 | "distortions.\n", 132 | "\n", 133 | "For info on NIST preprocessing routines, see M. D. Garris, J. L. Blue, G.\n", 134 | "T. Candela, D. L. Dimmick, J. Geist, P. J. Grother, S. A. Janet, and C.\n", 135 | "L. Wilson, NIST Form-Based Handprint Recognition System, NISTIR 5469,\n", 136 | "1994.\n", 137 | "\n", 138 | "References\n", 139 | "----------\n", 140 | " - C. Kaynak (1995) Methods of Combining Multiple Classifiers and Their\n", 141 | " Applications to Handwritten Digit Recognition, MSc Thesis, Institute of\n", 142 | " Graduate Studies in Science and Engineering, Bogazici University.\n", 143 | " - E. Alpaydin, C. Kaynak (1998) Cascading Classifiers, Kybernetika.\n", 144 | " - Ken Tang and Ponnuthurai N. Suganthan and Xi Yao and A. Kai Qin.\n", 145 | " Linear dimensionalityreduction using relevance weighted LDA. School of\n", 146 | " Electrical and Electronic Engineering Nanyang Technological University.\n", 147 | " 2005.\n", 148 | " - Claudio Gentile. A New Approximate Maximal Margin Classification\n", 149 | " Algorithm. NIPS. 2000.\n", 150 | "\n" 151 | ] 152 | } 153 | ], 154 | "source": [ 155 | "print(digits.DESCR)" 156 | ] 157 | }, 158 | { 159 | "cell_type": "code", 160 | "execution_count": 3, 161 | "metadata": { 162 | "ExecuteTime": { 163 | "end_time": "2018-06-27T07:26:09.427848Z", 164 | "start_time": "2018-06-27T07:26:09.206842Z" 165 | } 166 | }, 167 | "outputs": [ 168 | { 169 | "data": { 170 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZsAAAGfCAYAAACJCX/uAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHd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r7vcuuWtuVSd6Q5Fur1z2S5B+7+zMLbtqNZyQ5vroj53FJPtrdG3cL8YZ6epKbzvy8koNJPtTdn1120q68NckHVz/g3p3kzQvv2ZWqelLO3MH7t4tv2ZRbnwHYXJt0GQ2ADSU2AIwTGwDGiQ0A48QGgHFiA8A4sQFgnNgAMO7/AOvsHw7fNra9AAAAAElFTkSuQmCC\n", 171 | "text/plain": [ 172 | "
" 173 | ] 174 | }, 175 | "metadata": {}, 176 | "output_type": "display_data" 177 | }, 178 | { 179 | "name": "stdout", 180 | "output_type": "stream", 181 | "text": [ 182 | "Target: 5\n" 183 | ] 184 | } 185 | ], 186 | "source": [ 187 | "import numpy as np\n", 188 | "import matplotlib.pyplot as plt\n", 189 | "\n", 190 | "plt.figure(figsize=(7, 7))\n", 191 | "idx = 102\n", 192 | "grid_data = np.reshape(digits.data[idx:idx+1], (8,8))\n", 193 | "plt.imshow(grid_data, cmap='gray')\n", 194 | "plt.show()\n", 195 | "\n", 196 | "print('Target: ',digits.target[idx])" 197 | ] 198 | }, 199 | { 200 | "cell_type": "markdown", 201 | "metadata": {}, 202 | "source": [ 203 | "### Test Train Split" 204 | ] 205 | }, 206 | { 207 | "cell_type": "code", 208 | "execution_count": 8, 209 | "metadata": { 210 | "ExecuteTime": { 211 | "end_time": "2018-06-27T02:32:17.107636Z", 212 | "start_time": "2018-06-27T02:32:16.489317Z" 213 | } 214 | }, 215 | "outputs": [], 216 | "source": [ 217 | "from sklearn.model_selection import train_test_split\n", 218 | "X_train, X_test, y_train, y_test = train_test_split(digits.data, \\\n", 219 | " digits.target, \\\n", 220 | " test_size = 0.25, \\\n", 221 | " random_state = 0)" 222 | ] 223 | }, 224 | { 225 | "cell_type": "markdown", 226 | "metadata": {}, 227 | "source": [ 228 | "### Training" 229 | ] 230 | }, 231 | { 232 | "cell_type": "code", 233 | "execution_count": 9, 234 | "metadata": { 235 | "ExecuteTime": { 236 | "end_time": "2018-06-27T02:32:19.731912Z", 237 | "start_time": "2018-06-27T02:32:18.072302Z" 238 | } 239 | }, 240 | "outputs": [ 241 | { 242 | "data": { 243 | "text/plain": [ 244 | "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n", 245 | " intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n", 246 | " penalty='l2', random_state=None, solver='liblinear', tol=0.0001,\n", 247 | " verbose=0, warm_start=False)" 248 | ] 249 | }, 250 | "execution_count": 9, 251 | "metadata": {}, 252 | "output_type": "execute_result" 253 | } 254 | ], 255 | "source": [ 256 | "from sklearn.linear_model import LogisticRegression\n", 257 | "classifier = LogisticRegression()\n", 258 | "classifier.fit(X_train, y_train)" 259 | ] 260 | }, 261 | { 262 | "cell_type": "markdown", 263 | "metadata": {}, 264 | "source": [ 265 | "### Prediction" 266 | ] 267 | }, 268 | { 269 | "cell_type": "code", 270 | "execution_count": 10, 271 | "metadata": { 272 | "ExecuteTime": { 273 | "end_time": "2018-06-27T02:32:21.724056Z", 274 | "start_time": "2018-06-27T02:32:21.716458Z" 275 | } 276 | }, 277 | "outputs": [], 278 | "source": [ 279 | "y_pred = classifier.predict(X_test)" 280 | ] 281 | }, 282 | { 283 | "cell_type": "markdown", 284 | "metadata": {}, 285 | "source": [ 286 | "### Measuring Performance" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": 11, 292 | "metadata": { 293 | "ExecuteTime": { 294 | "end_time": "2018-06-27T02:32:23.238482Z", 295 | "start_time": "2018-06-27T02:32:23.224283Z" 296 | }, 297 | "scrolled": true 298 | }, 299 | "outputs": [ 300 | { 301 | "name": "stdout", 302 | "output_type": "stream", 303 | "text": [ 304 | "0.9533333333333334\n" 305 | ] 306 | } 307 | ], 308 | "source": [ 309 | "score = classifier.score(X_test, y_test)\n", 310 | "print(score)" 311 | ] 312 | } 313 | ], 314 | "metadata": { 315 | "kernelspec": { 316 | "display_name": "Python 3", 317 | "language": "python", 318 | "name": "python3" 319 | }, 320 | "language_info": { 321 | "codemirror_mode": { 322 | "name": "ipython", 323 | "version": 3 324 | }, 325 | "file_extension": ".py", 326 | "mimetype": "text/x-python", 327 | "name": "python", 328 | "nbconvert_exporter": "python", 329 | "pygments_lexer": "ipython3", 330 | "version": "3.6.5" 331 | }, 332 | "toc": { 333 | "nav_menu": {}, 334 | "number_sections": true, 335 | "sideBar": true, 336 | "skip_h1_title": false, 337 | "title_cell": "Table of Contents", 338 | "title_sidebar": "Contents", 339 | "toc_cell": false, 340 | "toc_position": {}, 341 | "toc_section_display": true, 342 | "toc_window_display": false 343 | }, 344 | "varInspector": { 345 | "cols": { 346 | "lenName": 16, 347 | "lenType": 16, 348 | "lenVar": 40 349 | }, 350 | "kernels_config": { 351 | "python": { 352 | "delete_cmd_postfix": "", 353 | "delete_cmd_prefix": "del ", 354 | "library": "var_list.py", 355 | "varRefreshCmd": "print(var_dic_list())" 356 | }, 357 | "r": { 358 | "delete_cmd_postfix": ") ", 359 | "delete_cmd_prefix": "rm(", 360 | "library": "var_list.r", 361 | "varRefreshCmd": "cat(var_dic_list()) " 362 | } 363 | }, 364 | "types_to_exclude": [ 365 | "module", 366 | "function", 367 | "builtin_function_or_method", 368 | "instance", 369 | "_Feature" 370 | ], 371 | "window_display": false 372 | } 373 | }, 374 | "nbformat": 4, 375 | "nbformat_minor": 2 376 | } 377 | -------------------------------------------------------------------------------- /11. Logistic Regression/new_log_reg.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Logistic Regression" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Loading the Data" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [ 23 | "import pandas as pd" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 2, 29 | "metadata": {}, 30 | "outputs": [], 31 | "source": [ 32 | "iris = pd.read_csv('iris.csv')" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": 3, 38 | "metadata": {}, 39 | "outputs": [ 40 | { 41 | "name": "stdout", 42 | "output_type": "stream", 43 | "text": [ 44 | "(150, 6)\n" 45 | ] 46 | } 47 | ], 48 | "source": [ 49 | "print(iris.shape)" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 4, 55 | "metadata": { 56 | "scrolled": false 57 | }, 58 | "outputs": [ 59 | { 60 | "data": { 61 | "text/plain": [ 62 | "Index(['Id', 'SepalLengthCm', 'SepalWidthCm', 'PetalLengthCm', 'PetalWidthCm',\n", 63 | " 'Species'],\n", 64 | " dtype='object')" 65 | ] 66 | }, 67 | "execution_count": 4, 68 | "metadata": {}, 69 | "output_type": "execute_result" 70 | } 71 | ], 72 | "source": [ 73 | "iris.columns" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": 5, 79 | "metadata": { 80 | "scrolled": true 81 | }, 82 | "outputs": [ 83 | { 84 | "data": { 85 | "text/html": [ 86 | "
\n", 87 | "\n", 100 | "\n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | " \n", 127 | " \n", 128 | " \n", 129 | " \n", 130 | " \n", 131 | " \n", 132 | " \n", 133 | " \n", 134 | " \n", 135 | " \n", 136 | " \n", 137 | " \n", 138 | " \n", 139 | " \n", 140 | " \n", 141 | " \n", 142 | " \n", 143 | " \n", 144 | " \n", 145 | " \n", 146 | " \n", 147 | " \n", 148 | " \n", 149 | " \n", 150 | " \n", 151 | " \n", 152 | " \n", 153 | " \n", 154 | " \n", 155 | " \n", 156 | " \n", 157 | " \n", 158 | " \n", 159 | "
IdSepalLengthCmSepalWidthCmPetalLengthCmPetalWidthCmSpecies
015.13.51.40.2Iris-setosa
124.93.01.40.2Iris-setosa
234.73.21.30.2Iris-setosa
344.63.11.50.2Iris-setosa
455.03.61.40.2Iris-setosa
\n", 160 | "
" 161 | ], 162 | "text/plain": [ 163 | " Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species\n", 164 | "0 1 5.1 3.5 1.4 0.2 Iris-setosa\n", 165 | "1 2 4.9 3.0 1.4 0.2 Iris-setosa\n", 166 | "2 3 4.7 3.2 1.3 0.2 Iris-setosa\n", 167 | "3 4 4.6 3.1 1.5 0.2 Iris-setosa\n", 168 | "4 5 5.0 3.6 1.4 0.2 Iris-setosa" 169 | ] 170 | }, 171 | "execution_count": 5, 172 | "metadata": {}, 173 | "output_type": "execute_result" 174 | } 175 | ], 176 | "source": [ 177 | "iris.head()" 178 | ] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": 6, 183 | "metadata": {}, 184 | "outputs": [], 185 | "source": [ 186 | "x = iris[['SepalLengthCm', 'SepalWidthCm', 'PetalLengthCm', 'PetalWidthCm']]\n", 187 | "y = iris['Species']" 188 | ] 189 | }, 190 | { 191 | "cell_type": "markdown", 192 | "metadata": {}, 193 | "source": [ 194 | "### Test Train Split" 195 | ] 196 | }, 197 | { 198 | "cell_type": "code", 199 | "execution_count": 7, 200 | "metadata": { 201 | "ExecuteTime": { 202 | "end_time": "2018-08-24T14:42:24.638088Z", 203 | "start_time": "2018-08-24T14:42:24.630111Z" 204 | } 205 | }, 206 | "outputs": [], 207 | "source": [ 208 | "from sklearn.model_selection import train_test_split\n", 209 | "X_train, X_test, y_train, y_test = train_test_split(x, \\\n", 210 | " y, \\\n", 211 | " test_size = 0.25, \\\n", 212 | " random_state = 0)" 213 | ] 214 | }, 215 | { 216 | "cell_type": "markdown", 217 | "metadata": {}, 218 | "source": [ 219 | "### Training" 220 | ] 221 | }, 222 | { 223 | "cell_type": "code", 224 | "execution_count": 8, 225 | "metadata": { 226 | "ExecuteTime": { 227 | "end_time": "2018-08-24T14:42:27.982991Z", 228 | "start_time": "2018-08-24T14:42:25.444548Z" 229 | }, 230 | "scrolled": true 231 | }, 232 | "outputs": [ 233 | { 234 | "data": { 235 | "text/plain": [ 236 | "LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n", 237 | " intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n", 238 | " penalty='l2', random_state=None, solver='liblinear', tol=0.0001,\n", 239 | " verbose=0, warm_start=False)" 240 | ] 241 | }, 242 | "execution_count": 8, 243 | "metadata": {}, 244 | "output_type": "execute_result" 245 | } 246 | ], 247 | "source": [ 248 | "from sklearn.linear_model import LogisticRegression\n", 249 | "classifier = LogisticRegression()\n", 250 | "classifier.fit(X_train, y_train)" 251 | ] 252 | }, 253 | { 254 | "cell_type": "markdown", 255 | "metadata": {}, 256 | "source": [ 257 | "### Prediction" 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": 9, 263 | "metadata": { 264 | "ExecuteTime": { 265 | "end_time": "2018-08-24T14:42:28.781204Z", 266 | "start_time": "2018-08-24T14:42:28.778211Z" 267 | } 268 | }, 269 | "outputs": [], 270 | "source": [ 271 | "y_pred = classifier.predict(X_test)" 272 | ] 273 | }, 274 | { 275 | "cell_type": "markdown", 276 | "metadata": {}, 277 | "source": [ 278 | "### Measuring Performance" 279 | ] 280 | }, 281 | { 282 | "cell_type": "markdown", 283 | "metadata": {}, 284 | "source": [ 285 | "#### Accuracy" 286 | ] 287 | }, 288 | { 289 | "cell_type": "code", 290 | "execution_count": 10, 291 | "metadata": { 292 | "ExecuteTime": { 293 | "end_time": "2018-08-24T14:44:27.678050Z", 294 | "start_time": "2018-08-24T14:44:27.670097Z" 295 | } 296 | }, 297 | "outputs": [ 298 | { 299 | "data": { 300 | "text/plain": [ 301 | "0.868421052631579" 302 | ] 303 | }, 304 | "execution_count": 10, 305 | "metadata": {}, 306 | "output_type": "execute_result" 307 | } 308 | ], 309 | "source": [ 310 | "# calculate accuracy of class predictions\n", 311 | "from sklearn import metrics\n", 312 | "metrics.accuracy_score(y_test, y_pred)" 313 | ] 314 | }, 315 | { 316 | "cell_type": "markdown", 317 | "metadata": {}, 318 | "source": [ 319 | "#### Confusion Metric" 320 | ] 321 | }, 322 | { 323 | "cell_type": "code", 324 | "execution_count": 11, 325 | "metadata": {}, 326 | "outputs": [ 327 | { 328 | "data": { 329 | "text/plain": [ 330 | "array([[13, 0, 0],\n", 331 | " [ 0, 11, 5],\n", 332 | " [ 0, 0, 9]], dtype=int64)" 333 | ] 334 | }, 335 | "execution_count": 11, 336 | "metadata": {}, 337 | "output_type": "execute_result" 338 | } 339 | ], 340 | "source": [ 341 | "con_metric = metrics.confusion_matrix(y_test, y_pred)\n", 342 | "con_metric" 343 | ] 344 | }, 345 | { 346 | "cell_type": "code", 347 | "execution_count": 14, 348 | "metadata": {}, 349 | "outputs": [ 350 | { 351 | "data": { 352 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAAEICAYAAABoLY4BAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAGSVJREFUeJzt3XuUFfWZ7vHv04AIiHfl0hAxg2NiTNAzSEYdExyX4BWZFaM4XoiHhDHBDK5kTEzG0RMds8zMGiYaHT2ciHcZ8X4jBsajYzSaATnoKBhvaGhoId4veOne/Z4/doGbdnfv3d27u2pXP59Ztdi76tdVrxXm5e23flWliMDMzNLXkHYAZmZW5IRsZpYRTshmZhnhhGxmlhFOyGZmGeGEbGaWEU7ItoWkIZLukfS2pFt6sJ+TJS2pZWxpkPQrSTPTjsP6DyfkOiTpryUtl/SepOYkcfxFDXZ9PDAC2CUivt7dnUTEj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NLFfaIqpeKpgEvBARL0XEx8C/A8e1G3MccG3y+VbgMEnqbuy93kNu/Xhdt4NLi6TZETE/7TjyzOe49/XXc9yVnCNpNjC7ZNX8knPWCKwt2dYEfLndLraMiYhWSW8DuwCvdTVucIXckdmVh1gP+Rz3Pp/jCiJifkRMLFlK/wErl9jbl9XVjKmaE7KZWXlNwNiS72OA9R2NkTQQ2AF4o7sHdEI2MytvGbCXpD0lbQPMAO5uN+ZuYGby+Xjg/0YP5t15HnJ5/a7vlgKf497nc9wDSU/4TODXwABgQUQ8I+kCYHlE3A1cBVwv6QWKlfGMnhxT9TyJ2swsT9yyMDPLCCdkM7OMcEIuUek2Ses5SQskbZT0dNqx5JWksZIelLRa0jOS5qYdk1XHPeREcpvkc8DhFKeyLANOiohVqQaWM5K+ArwHXBcR+6YdTx5JGgWMiogVkoYDTwDT/Xc5+1whf6Ka2ySthyLiYXowT9Mqi4jmiFiRfH4XWE3xjjLLOCfkT5S7TdJ/ia2uJU8f2x/4XbqRWDWckD9R01sgzdImaTvgNuCsiHgn7XisMifkT1Rzm6RZXZA0iGIyvjEibk87HquOE/InqrlN0izzksc/XgWsjoh5acdj1XNCTkREK7D5NsnVwKKIeCbdqPJH0kLgMWBvSU2SZqUdUw4dDJwK/KWklclyVNpBWWWe9mZmlhGukM3MMsIJ2cwsI5yQzcwywgnZzCwjnJDNzDLCCdnMLCOckM3MMuL/A371mM0WVCTIAAAAAElFTkSuQmCC\n", 353 | "text/plain": [ 354 | "
" 355 | ] 356 | }, 357 | "metadata": {}, 358 | "output_type": "display_data" 359 | } 360 | ], 361 | "source": [ 362 | "#ploting heatmap for confusion matrix\n", 363 | "import seaborn as sns\n", 364 | "import matplotlib.pyplot as plt\n", 365 | "\n", 366 | "sns.heatmap(con_metric, annot=True, fmt='d')\n", 367 | "plt.title(\"Confusion Matrix\")\n", 368 | "plt.show()" 369 | ] 370 | }, 371 | { 372 | "cell_type": "markdown", 373 | "metadata": {}, 374 | "source": [ 375 | "#### Precision, Recall & F1 Score" 376 | ] 377 | }, 378 | { 379 | "cell_type": "code", 380 | "execution_count": 22, 381 | "metadata": {}, 382 | "outputs": [ 383 | { 384 | "name": "stdout", 385 | "output_type": "stream", 386 | "text": [ 387 | " precision recall f1-score support\n", 388 | "\n", 389 | " Iris-setosa 1.00 1.00 1.00 13\n", 390 | "Iris-versicolor 1.00 0.69 0.81 16\n", 391 | " Iris-virginica 0.64 1.00 0.78 9\n", 392 | "\n", 393 | " avg / total 0.92 0.87 0.87 38\n", 394 | "\n" 395 | ] 396 | } 397 | ], 398 | "source": [ 399 | "print(metrics.classification_report(y_test, y_pred))" 400 | ] 401 | }, 402 | { 403 | "cell_type": "markdown", 404 | "metadata": {}, 405 | "source": [ 406 | "#### ROC AUC" 407 | ] 408 | }, 409 | { 410 | "cell_type": "code", 411 | "execution_count": 16, 412 | "metadata": {}, 413 | "outputs": [], 414 | "source": [ 415 | "roc_auc = metrics.roc_auc_score(y_test, y_pred)\n", 416 | "print(roc_auc)" 417 | ] 418 | }, 419 | { 420 | "cell_type": "markdown", 421 | "metadata": {}, 422 | "source": [ 423 | "#### Log Loss" 424 | ] 425 | }, 426 | { 427 | "cell_type": "code", 428 | "execution_count": 19, 429 | "metadata": {}, 430 | "outputs": [], 431 | "source": [ 432 | "metrics.log_loss(y_test, y_pred)" 433 | ] 434 | } 435 | ], 436 | "metadata": { 437 | "kernelspec": { 438 | "display_name": "Python 3", 439 | "language": "python", 440 | "name": "python3" 441 | }, 442 | "language_info": { 443 | "codemirror_mode": { 444 | "name": "ipython", 445 | "version": 3 446 | }, 447 | "file_extension": ".py", 448 | "mimetype": "text/x-python", 449 | "name": "python", 450 | "nbconvert_exporter": "python", 451 | "pygments_lexer": "ipython3", 452 | "version": "3.6.5" 453 | }, 454 | "toc": { 455 | "nav_menu": {}, 456 | "number_sections": true, 457 | "sideBar": true, 458 | "skip_h1_title": false, 459 | "title_cell": "Table of Contents", 460 | "title_sidebar": "Contents", 461 | "toc_cell": false, 462 | "toc_position": {}, 463 | "toc_section_display": true, 464 | "toc_window_display": false 465 | }, 466 | "varInspector": { 467 | "cols": { 468 | "lenName": 16, 469 | "lenType": 16, 470 | "lenVar": 40 471 | }, 472 | "kernels_config": { 473 | "python": { 474 | "delete_cmd_postfix": "", 475 | "delete_cmd_prefix": "del ", 476 | "library": "var_list.py", 477 | "varRefreshCmd": "print(var_dic_list())" 478 | }, 479 | "r": { 480 | "delete_cmd_postfix": ") ", 481 | "delete_cmd_prefix": "rm(", 482 | "library": "var_list.r", 483 | "varRefreshCmd": "cat(var_dic_list()) " 484 | } 485 | }, 486 | "types_to_exclude": [ 487 | "module", 488 | "function", 489 | "builtin_function_or_method", 490 | "instance", 491 | "_Feature" 492 | ], 493 | "window_display": false 494 | } 495 | }, 496 | "nbformat": 4, 497 | "nbformat_minor": 2 498 | } 499 | -------------------------------------------------------------------------------- /12. K-NN/Iris.csv: -------------------------------------------------------------------------------- 1 | Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species 2 | 1,5.1,3.5,1.4,0.2,Iris-setosa 3 | 2,4.9,3.0,1.4,0.2,Iris-setosa 4 | 3,4.7,3.2,1.3,0.2,Iris-setosa 5 | 4,4.6,3.1,1.5,0.2,Iris-setosa 6 | 5,5.0,3.6,1.4,0.2,Iris-setosa 7 | 6,5.4,3.9,1.7,0.4,Iris-setosa 8 | 7,4.6,3.4,1.4,0.3,Iris-setosa 9 | 8,5.0,3.4,1.5,0.2,Iris-setosa 10 | 9,4.4,2.9,1.4,0.2,Iris-setosa 11 | 10,4.9,3.1,1.5,0.1,Iris-setosa 12 | 11,5.4,3.7,1.5,0.2,Iris-setosa 13 | 12,4.8,3.4,1.6,0.2,Iris-setosa 14 | 13,4.8,3.0,1.4,0.1,Iris-setosa 15 | 14,4.3,3.0,1.1,0.1,Iris-setosa 16 | 15,5.8,4.0,1.2,0.2,Iris-setosa 17 | 16,5.7,4.4,1.5,0.4,Iris-setosa 18 | 17,5.4,3.9,1.3,0.4,Iris-setosa 19 | 18,5.1,3.5,1.4,0.3,Iris-setosa 20 | 19,5.7,3.8,1.7,0.3,Iris-setosa 21 | 20,5.1,3.8,1.5,0.3,Iris-setosa 22 | 21,5.4,3.4,1.7,0.2,Iris-setosa 23 | 22,5.1,3.7,1.5,0.4,Iris-setosa 24 | 23,4.6,3.6,1.0,0.2,Iris-setosa 25 | 24,5.1,3.3,1.7,0.5,Iris-setosa 26 | 25,4.8,3.4,1.9,0.2,Iris-setosa 27 | 26,5.0,3.0,1.6,0.2,Iris-setosa 28 | 27,5.0,3.4,1.6,0.4,Iris-setosa 29 | 28,5.2,3.5,1.5,0.2,Iris-setosa 30 | 29,5.2,3.4,1.4,0.2,Iris-setosa 31 | 30,4.7,3.2,1.6,0.2,Iris-setosa 32 | 31,4.8,3.1,1.6,0.2,Iris-setosa 33 | 32,5.4,3.4,1.5,0.4,Iris-setosa 34 | 33,5.2,4.1,1.5,0.1,Iris-setosa 35 | 34,5.5,4.2,1.4,0.2,Iris-setosa 36 | 35,4.9,3.1,1.5,0.1,Iris-setosa 37 | 36,5.0,3.2,1.2,0.2,Iris-setosa 38 | 37,5.5,3.5,1.3,0.2,Iris-setosa 39 | 38,4.9,3.1,1.5,0.1,Iris-setosa 40 | 39,4.4,3.0,1.3,0.2,Iris-setosa 41 | 40,5.1,3.4,1.5,0.2,Iris-setosa 42 | 41,5.0,3.5,1.3,0.3,Iris-setosa 43 | 42,4.5,2.3,1.3,0.3,Iris-setosa 44 | 43,4.4,3.2,1.3,0.2,Iris-setosa 45 | 44,5.0,3.5,1.6,0.6,Iris-setosa 46 | 45,5.1,3.8,1.9,0.4,Iris-setosa 47 | 46,4.8,3.0,1.4,0.3,Iris-setosa 48 | 47,5.1,3.8,1.6,0.2,Iris-setosa 49 | 48,4.6,3.2,1.4,0.2,Iris-setosa 50 | 49,5.3,3.7,1.5,0.2,Iris-setosa 51 | 50,5.0,3.3,1.4,0.2,Iris-setosa 52 | 51,7.0,3.2,4.7,1.4,Iris-versicolor 53 | 52,6.4,3.2,4.5,1.5,Iris-versicolor 54 | 53,6.9,3.1,4.9,1.5,Iris-versicolor 55 | 54,5.5,2.3,4.0,1.3,Iris-versicolor 56 | 55,6.5,2.8,4.6,1.5,Iris-versicolor 57 | 56,5.7,2.8,4.5,1.3,Iris-versicolor 58 | 57,6.3,3.3,4.7,1.6,Iris-versicolor 59 | 58,4.9,2.4,3.3,1.0,Iris-versicolor 60 | 59,6.6,2.9,4.6,1.3,Iris-versicolor 61 | 60,5.2,2.7,3.9,1.4,Iris-versicolor 62 | 61,5.0,2.0,3.5,1.0,Iris-versicolor 63 | 62,5.9,3.0,4.2,1.5,Iris-versicolor 64 | 63,6.0,2.2,4.0,1.0,Iris-versicolor 65 | 64,6.1,2.9,4.7,1.4,Iris-versicolor 66 | 65,5.6,2.9,3.6,1.3,Iris-versicolor 67 | 66,6.7,3.1,4.4,1.4,Iris-versicolor 68 | 67,5.6,3.0,4.5,1.5,Iris-versicolor 69 | 68,5.8,2.7,4.1,1.0,Iris-versicolor 70 | 69,6.2,2.2,4.5,1.5,Iris-versicolor 71 | 70,5.6,2.5,3.9,1.1,Iris-versicolor 72 | 71,5.9,3.2,4.8,1.8,Iris-versicolor 73 | 72,6.1,2.8,4.0,1.3,Iris-versicolor 74 | 73,6.3,2.5,4.9,1.5,Iris-versicolor 75 | 74,6.1,2.8,4.7,1.2,Iris-versicolor 76 | 75,6.4,2.9,4.3,1.3,Iris-versicolor 77 | 76,6.6,3.0,4.4,1.4,Iris-versicolor 78 | 77,6.8,2.8,4.8,1.4,Iris-versicolor 79 | 78,6.7,3.0,5.0,1.7,Iris-versicolor 80 | 79,6.0,2.9,4.5,1.5,Iris-versicolor 81 | 80,5.7,2.6,3.5,1.0,Iris-versicolor 82 | 81,5.5,2.4,3.8,1.1,Iris-versicolor 83 | 82,5.5,2.4,3.7,1.0,Iris-versicolor 84 | 83,5.8,2.7,3.9,1.2,Iris-versicolor 85 | 84,6.0,2.7,5.1,1.6,Iris-versicolor 86 | 85,5.4,3.0,4.5,1.5,Iris-versicolor 87 | 86,6.0,3.4,4.5,1.6,Iris-versicolor 88 | 87,6.7,3.1,4.7,1.5,Iris-versicolor 89 | 88,6.3,2.3,4.4,1.3,Iris-versicolor 90 | 89,5.6,3.0,4.1,1.3,Iris-versicolor 91 | 90,5.5,2.5,4.0,1.3,Iris-versicolor 92 | 91,5.5,2.6,4.4,1.2,Iris-versicolor 93 | 92,6.1,3.0,4.6,1.4,Iris-versicolor 94 | 93,5.8,2.6,4.0,1.2,Iris-versicolor 95 | 94,5.0,2.3,3.3,1.0,Iris-versicolor 96 | 95,5.6,2.7,4.2,1.3,Iris-versicolor 97 | 96,5.7,3.0,4.2,1.2,Iris-versicolor 98 | 97,5.7,2.9,4.2,1.3,Iris-versicolor 99 | 98,6.2,2.9,4.3,1.3,Iris-versicolor 100 | 99,5.1,2.5,3.0,1.1,Iris-versicolor 101 | 100,5.7,2.8,4.1,1.3,Iris-versicolor 102 | 101,6.3,3.3,6.0,2.5,Iris-virginica 103 | 102,5.8,2.7,5.1,1.9,Iris-virginica 104 | 103,7.1,3.0,5.9,2.1,Iris-virginica 105 | 104,6.3,2.9,5.6,1.8,Iris-virginica 106 | 105,6.5,3.0,5.8,2.2,Iris-virginica 107 | 106,7.6,3.0,6.6,2.1,Iris-virginica 108 | 107,4.9,2.5,4.5,1.7,Iris-virginica 109 | 108,7.3,2.9,6.3,1.8,Iris-virginica 110 | 109,6.7,2.5,5.8,1.8,Iris-virginica 111 | 110,7.2,3.6,6.1,2.5,Iris-virginica 112 | 111,6.5,3.2,5.1,2.0,Iris-virginica 113 | 112,6.4,2.7,5.3,1.9,Iris-virginica 114 | 113,6.8,3.0,5.5,2.1,Iris-virginica 115 | 114,5.7,2.5,5.0,2.0,Iris-virginica 116 | 115,5.8,2.8,5.1,2.4,Iris-virginica 117 | 116,6.4,3.2,5.3,2.3,Iris-virginica 118 | 117,6.5,3.0,5.5,1.8,Iris-virginica 119 | 118,7.7,3.8,6.7,2.2,Iris-virginica 120 | 119,7.7,2.6,6.9,2.3,Iris-virginica 121 | 120,6.0,2.2,5.0,1.5,Iris-virginica 122 | 121,6.9,3.2,5.7,2.3,Iris-virginica 123 | 122,5.6,2.8,4.9,2.0,Iris-virginica 124 | 123,7.7,2.8,6.7,2.0,Iris-virginica 125 | 124,6.3,2.7,4.9,1.8,Iris-virginica 126 | 125,6.7,3.3,5.7,2.1,Iris-virginica 127 | 126,7.2,3.2,6.0,1.8,Iris-virginica 128 | 127,6.2,2.8,4.8,1.8,Iris-virginica 129 | 128,6.1,3.0,4.9,1.8,Iris-virginica 130 | 129,6.4,2.8,5.6,2.1,Iris-virginica 131 | 130,7.2,3.0,5.8,1.6,Iris-virginica 132 | 131,7.4,2.8,6.1,1.9,Iris-virginica 133 | 132,7.9,3.8,6.4,2.0,Iris-virginica 134 | 133,6.4,2.8,5.6,2.2,Iris-virginica 135 | 134,6.3,2.8,5.1,1.5,Iris-virginica 136 | 135,6.1,2.6,5.6,1.4,Iris-virginica 137 | 136,7.7,3.0,6.1,2.3,Iris-virginica 138 | 137,6.3,3.4,5.6,2.4,Iris-virginica 139 | 138,6.4,3.1,5.5,1.8,Iris-virginica 140 | 139,6.0,3.0,4.8,1.8,Iris-virginica 141 | 140,6.9,3.1,5.4,2.1,Iris-virginica 142 | 141,6.7,3.1,5.6,2.4,Iris-virginica 143 | 142,6.9,3.1,5.1,2.3,Iris-virginica 144 | 143,5.8,2.7,5.1,1.9,Iris-virginica 145 | 144,6.8,3.2,5.9,2.3,Iris-virginica 146 | 145,6.7,3.3,5.7,2.5,Iris-virginica 147 | 146,6.7,3.0,5.2,2.3,Iris-virginica 148 | 147,6.3,2.5,5.0,1.9,Iris-virginica 149 | 148,6.5,3.0,5.2,2.0,Iris-virginica 150 | 149,6.2,3.4,5.4,2.3,Iris-virginica 151 | 150,5.9,3.0,5.1,1.8,Iris-virginica 152 | -------------------------------------------------------------------------------- /12. K-NN/knn.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Loading the Data" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": { 14 | "ExecuteTime": { 15 | "end_time": "2018-08-28T13:18:52.554565Z", 16 | "start_time": "2018-08-28T13:18:42.492777Z" 17 | }, 18 | "scrolled": false 19 | }, 20 | "outputs": [ 21 | { 22 | "data": { 23 | "text/html": [ 24 | "
\n", 25 | "\n", 38 | "\n", 39 | " \n", 40 | " \n", 41 | " \n", 42 | " \n", 43 | " \n", 44 | " \n", 45 | " \n", 46 | " \n", 47 | " \n", 48 | " \n", 49 | " \n", 50 | " \n", 51 | " \n", 52 | " \n", 53 | " \n", 54 | " \n", 55 | " \n", 56 | " \n", 57 | " \n", 58 | " \n", 59 | " \n", 60 | " \n", 61 | " \n", 62 | " \n", 63 | " \n", 64 | " \n", 65 | " \n", 66 | " \n", 67 | " \n", 68 | " \n", 69 | " \n", 70 | " \n", 71 | " \n", 72 | " \n", 73 | " \n", 74 | " \n", 75 | " \n", 76 | " \n", 77 | " \n", 78 | " \n", 79 | " \n", 80 | " \n", 81 | " \n", 82 | " \n", 83 | " \n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | "
IdSepalLengthCmSepalWidthCmPetalLengthCmPetalWidthCmSpecies
015.13.51.40.2Iris-setosa
124.93.01.40.2Iris-setosa
234.73.21.30.2Iris-setosa
344.63.11.50.2Iris-setosa
455.03.61.40.2Iris-setosa
\n", 98 | "
" 99 | ], 100 | "text/plain": [ 101 | " Id SepalLengthCm SepalWidthCm PetalLengthCm PetalWidthCm Species\n", 102 | "0 1 5.1 3.5 1.4 0.2 Iris-setosa\n", 103 | "1 2 4.9 3.0 1.4 0.2 Iris-setosa\n", 104 | "2 3 4.7 3.2 1.3 0.2 Iris-setosa\n", 105 | "3 4 4.6 3.1 1.5 0.2 Iris-setosa\n", 106 | "4 5 5.0 3.6 1.4 0.2 Iris-setosa" 107 | ] 108 | }, 109 | "execution_count": 1, 110 | "metadata": {}, 111 | "output_type": "execute_result" 112 | } 113 | ], 114 | "source": [ 115 | "import pandas as pd\n", 116 | "\n", 117 | "df = pd.read_csv('Iris.csv')\n", 118 | "\n", 119 | "df.head()" 120 | ] 121 | }, 122 | { 123 | "cell_type": "code", 124 | "execution_count": 12, 125 | "metadata": { 126 | "ExecuteTime": { 127 | "end_time": "2018-08-28T13:25:15.259849Z", 128 | "start_time": "2018-08-28T13:25:15.252206Z" 129 | }, 130 | "scrolled": true 131 | }, 132 | "outputs": [ 133 | { 134 | "data": { 135 | "text/plain": [ 136 | "Iris-versicolor 50\n", 137 | "Iris-setosa 50\n", 138 | "Iris-virginica 50\n", 139 | "Name: Species, dtype: int64" 140 | ] 141 | }, 142 | "execution_count": 12, 143 | "metadata": {}, 144 | "output_type": "execute_result" 145 | } 146 | ], 147 | "source": [ 148 | "df['Species'].value_counts()" 149 | ] 150 | }, 151 | { 152 | "cell_type": "code", 153 | "execution_count": 2, 154 | "metadata": { 155 | "ExecuteTime": { 156 | "end_time": "2018-08-28T13:20:44.412954Z", 157 | "start_time": "2018-08-28T13:20:44.406610Z" 158 | } 159 | }, 160 | "outputs": [], 161 | "source": [ 162 | "label = df['Species']\n", 163 | "data = df.drop(\"Species\",axis=1)\n", 164 | "data = data.drop(\"Id\",axis=1)" 165 | ] 166 | }, 167 | { 168 | "cell_type": "code", 169 | "execution_count": 3, 170 | "metadata": { 171 | "ExecuteTime": { 172 | "end_time": "2018-08-28T13:20:48.368033Z", 173 | "start_time": "2018-08-28T13:20:48.363026Z" 174 | } 175 | }, 176 | "outputs": [ 177 | { 178 | "name": "stdout", 179 | "output_type": "stream", 180 | "text": [ 181 | "(150, 4)\n", 182 | "(150,)\n" 183 | ] 184 | } 185 | ], 186 | "source": [ 187 | "print(data.shape)\n", 188 | "print(label.shape)" 189 | ] 190 | }, 191 | { 192 | "cell_type": "code", 193 | "execution_count": 4, 194 | "metadata": { 195 | "ExecuteTime": { 196 | "end_time": "2018-08-28T13:21:12.869461Z", 197 | "start_time": "2018-08-28T13:21:03.190357Z" 198 | }, 199 | "scrolled": true 200 | }, 201 | "outputs": [ 202 | { 203 | "name": "stdout", 204 | "output_type": "stream", 205 | "text": [ 206 | "(150, 4)\n" 207 | ] 208 | } 209 | ], 210 | "source": [ 211 | "# Data-preprocessing: Standardizing the data\n", 212 | "\n", 213 | "from sklearn.preprocessing import StandardScaler\n", 214 | "standardized_data = StandardScaler().fit_transform(data)\n", 215 | "print(standardized_data.shape)\n" 216 | ] 217 | }, 218 | { 219 | "cell_type": "markdown", 220 | "metadata": {}, 221 | "source": [ 222 | "## Test Train Split" 223 | ] 224 | }, 225 | { 226 | "cell_type": "code", 227 | "execution_count": 5, 228 | "metadata": { 229 | "ExecuteTime": { 230 | "end_time": "2018-08-28T13:21:34.456738Z", 231 | "start_time": "2018-08-28T13:21:33.866468Z" 232 | } 233 | }, 234 | "outputs": [], 235 | "source": [ 236 | "from sklearn.model_selection import train_test_split\n", 237 | "X_train, X_test, y_train, y_test = train_test_split(data, \\\n", 238 | " label, \\\n", 239 | " test_size = 0.25, \\\n", 240 | " random_state = 0)" 241 | ] 242 | }, 243 | { 244 | "cell_type": "markdown", 245 | "metadata": {}, 246 | "source": [ 247 | "## Training" 248 | ] 249 | }, 250 | { 251 | "cell_type": "code", 252 | "execution_count": 6, 253 | "metadata": { 254 | "ExecuteTime": { 255 | "end_time": "2018-08-28T13:23:00.800734Z", 256 | "start_time": "2018-08-28T13:23:00.217299Z" 257 | } 258 | }, 259 | "outputs": [ 260 | { 261 | "data": { 262 | "text/plain": [ 263 | "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n", 264 | " metric_params=None, n_jobs=1, n_neighbors=5, p=2,\n", 265 | " weights='uniform')" 266 | ] 267 | }, 268 | "execution_count": 6, 269 | "metadata": {}, 270 | "output_type": "execute_result" 271 | } 272 | ], 273 | "source": [ 274 | "from sklearn.neighbors import KNeighborsClassifier\n", 275 | "classifier = KNeighborsClassifier()\n", 276 | "classifier.fit(X_train, y_train)" 277 | ] 278 | }, 279 | { 280 | "cell_type": "markdown", 281 | "metadata": {}, 282 | "source": [ 283 | "## Predictions" 284 | ] 285 | }, 286 | { 287 | "cell_type": "code", 288 | "execution_count": 7, 289 | "metadata": { 290 | "ExecuteTime": { 291 | "end_time": "2018-08-28T13:23:16.500700Z", 292 | "start_time": "2018-08-28T13:23:16.430890Z" 293 | } 294 | }, 295 | "outputs": [], 296 | "source": [ 297 | "y_pred = classifier.predict(X_test)" 298 | ] 299 | }, 300 | { 301 | "cell_type": "markdown", 302 | "metadata": {}, 303 | "source": [ 304 | "## Measuring Performance" 305 | ] 306 | }, 307 | { 308 | "cell_type": "code", 309 | "execution_count": 8, 310 | "metadata": { 311 | "ExecuteTime": { 312 | "end_time": "2018-08-28T13:23:41.528777Z", 313 | "start_time": "2018-08-28T13:23:41.522759Z" 314 | } 315 | }, 316 | "outputs": [ 317 | { 318 | "data": { 319 | "text/plain": [ 320 | "0.9736842105263158" 321 | ] 322 | }, 323 | "execution_count": 8, 324 | "metadata": {}, 325 | "output_type": "execute_result" 326 | } 327 | ], 328 | "source": [ 329 | "# calculate accuracy of class predictions\n", 330 | "from sklearn import metrics\n", 331 | "metrics.accuracy_score(y_test, y_pred)" 332 | ] 333 | } 334 | ], 335 | "metadata": { 336 | "kernelspec": { 337 | "display_name": "Python 3", 338 | "language": "python", 339 | "name": "python3" 340 | }, 341 | "language_info": { 342 | "codemirror_mode": { 343 | "name": "ipython", 344 | "version": 3 345 | }, 346 | "file_extension": ".py", 347 | "mimetype": "text/x-python", 348 | "name": "python", 349 | "nbconvert_exporter": "python", 350 | "pygments_lexer": "ipython3", 351 | "version": "3.6.5" 352 | }, 353 | "toc": { 354 | "nav_menu": {}, 355 | "number_sections": true, 356 | "sideBar": true, 357 | "skip_h1_title": false, 358 | "title_cell": "Table of Contents", 359 | "title_sidebar": "Contents", 360 | "toc_cell": false, 361 | "toc_position": {}, 362 | "toc_section_display": true, 363 | "toc_window_display": false 364 | }, 365 | "varInspector": { 366 | "cols": { 367 | "lenName": 16, 368 | "lenType": 16, 369 | "lenVar": 40 370 | }, 371 | "kernels_config": { 372 | "python": { 373 | "delete_cmd_postfix": "", 374 | "delete_cmd_prefix": "del ", 375 | "library": "var_list.py", 376 | "varRefreshCmd": "print(var_dic_list())" 377 | }, 378 | "r": { 379 | "delete_cmd_postfix": ") ", 380 | "delete_cmd_prefix": "rm(", 381 | "library": "var_list.r", 382 | "varRefreshCmd": "cat(var_dic_list()) " 383 | } 384 | }, 385 | "types_to_exclude": [ 386 | "module", 387 | "function", 388 | "builtin_function_or_method", 389 | "instance", 390 | "_Feature" 391 | ], 392 | "window_display": false 393 | } 394 | }, 395 | "nbformat": 4, 396 | "nbformat_minor": 2 397 | } 398 | -------------------------------------------------------------------------------- /13. NB/img/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/13. NB/img/1.PNG -------------------------------------------------------------------------------- /13. NB/img/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/13. NB/img/2.PNG -------------------------------------------------------------------------------- /13. NB/img/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/13. NB/img/3.PNG -------------------------------------------------------------------------------- /13. NB/img/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/13. NB/img/4.PNG -------------------------------------------------------------------------------- /13. NB/img/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/13. NB/img/5.PNG -------------------------------------------------------------------------------- /13. NB/img/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/13. NB/img/6.PNG -------------------------------------------------------------------------------- /13. NB/naive_bayes.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Naive Bayes" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "1. Conditional Probability\n", 15 | "2. Independent Events\n", 16 | "3. Bayes Theorem" 17 | ] 18 | }, 19 | { 20 | "cell_type": "markdown", 21 | "metadata": {}, 22 | "source": [ 23 | "## Derivation" 24 | ] 25 | }, 26 | { 27 | "cell_type": "markdown", 28 | "metadata": {}, 29 | "source": [ 30 | "Step-1\n", 31 | "![title](img/1.png)\n", 32 | "Step-2\n", 33 | "![title](img/2.png)\n", 34 | "Step-3\n", 35 | "![title](img/3.png)\n", 36 | "Step-4\n", 37 | "![title](img/4.png)\n", 38 | "Step-5\n", 39 | "![title](img/5.png)\n", 40 | "Step-6\n", 41 | "![title](img/6.png)" 42 | ] 43 | }, 44 | { 45 | "cell_type": "markdown", 46 | "metadata": {}, 47 | "source": [ 48 | "## Example\n", 49 | "\n", 50 | "http://shatterline.com/blog/2013/09/12/not-so-naive-classification-with-the-naive-bayes-classifier/" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": null, 56 | "metadata": {}, 57 | "outputs": [], 58 | "source": [] 59 | } 60 | ], 61 | "metadata": { 62 | "kernelspec": { 63 | "display_name": "Python 3", 64 | "language": "python", 65 | "name": "python3" 66 | }, 67 | "language_info": { 68 | "codemirror_mode": { 69 | "name": "ipython", 70 | "version": 3 71 | }, 72 | "file_extension": ".py", 73 | "mimetype": "text/x-python", 74 | "name": "python", 75 | "nbconvert_exporter": "python", 76 | "pygments_lexer": "ipython3", 77 | "version": "3.6.5" 78 | }, 79 | "toc": { 80 | "nav_menu": {}, 81 | "number_sections": true, 82 | "sideBar": true, 83 | "skip_h1_title": false, 84 | "title_cell": "Table of Contents", 85 | "title_sidebar": "Contents", 86 | "toc_cell": false, 87 | "toc_position": {}, 88 | "toc_section_display": true, 89 | "toc_window_display": false 90 | }, 91 | "varInspector": { 92 | "cols": { 93 | "lenName": 16, 94 | "lenType": 16, 95 | "lenVar": 40 96 | }, 97 | "kernels_config": { 98 | "python": { 99 | "delete_cmd_postfix": "", 100 | "delete_cmd_prefix": "del ", 101 | "library": "var_list.py", 102 | "varRefreshCmd": "print(var_dic_list())" 103 | }, 104 | "r": { 105 | "delete_cmd_postfix": ") ", 106 | "delete_cmd_prefix": "rm(", 107 | "library": "var_list.r", 108 | "varRefreshCmd": "cat(var_dic_list()) " 109 | } 110 | }, 111 | "types_to_exclude": [ 112 | "module", 113 | "function", 114 | "builtin_function_or_method", 115 | "instance", 116 | "_Feature" 117 | ], 118 | "window_display": false 119 | } 120 | }, 121 | "nbformat": 4, 122 | "nbformat_minor": 2 123 | } 124 | -------------------------------------------------------------------------------- /14. SVM/ML_Classification.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Machine Learning" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## AI vs ML vs DL vs DS\n", 15 | "\n", 16 | "" 17 | ] 18 | }, 19 | { 20 | "cell_type": "markdown", 21 | "metadata": {}, 22 | "source": [ 23 | "## What is Machine Learning?\n", 24 | "\n", 25 | "Basically ML is a collection of tools, statistical methods and algorithms which helps computers to learn from data." 26 | ] 27 | }, 28 | { 29 | "cell_type": "markdown", 30 | "metadata": {}, 31 | "source": [ 32 | "## Types of ML Algorithms\n", 33 | "\n", 34 | "Broadly, there are 3 types of ML Algorithms:\n", 35 | "
    \n", 36 | "
  1. Supervised Algorithms
  2. \n", 37 | "
  3. Unsupervised Algorithms
  4. \n", 38 | "
  5. Reinforcement Learning - Learning by trail and error approach.
  6. \n", 39 | "
" 40 | ] 41 | }, 42 | { 43 | "cell_type": "markdown", 44 | "metadata": {}, 45 | "source": [ 46 | "# Classification" 47 | ] 48 | }, 49 | { 50 | "cell_type": "markdown", 51 | "metadata": {}, 52 | "source": [ 53 | "## What is Classification?" 54 | ] 55 | }, 56 | { 57 | "cell_type": "markdown", 58 | "metadata": {}, 59 | "source": [ 60 | "Lets first take an example to understand what a classification problem actually looks like:
\n", 61 | "
\n", 62 | "GIVEN Review text for some product from any e-commerce website.
\n", 63 | "TASK Predict/Guess whether the review is Positive or Negative.
\n", 64 | "\n", 65 | "" 66 | ] 67 | }, 68 | { 69 | "cell_type": "markdown", 70 | "metadata": {}, 71 | "source": [ 72 | "OBSERVATIONS
\n", 73 | "
\n",
 74 |     "a. We have two classes here, Positive & Negative.\n",
 75 |     "b. It is also called 2-class classification or Binary classification.\n",
 76 |     "
\n" 77 | ] 78 | }, 79 | { 80 | "cell_type": "markdown", 81 | "metadata": {}, 82 | "source": [ 83 | "## How does classification actually works?" 84 | ] 85 | }, 86 | { 87 | "cell_type": "markdown", 88 | "metadata": {}, 89 | "source": [ 90 | "

\n", 91 | "Most of the Machine Learning is about finding a function.\n", 92 | "\n", 93 | "Machine Learning is not perfect. It will not learn the perfect function. It tries to do its best job using various techniques like: K-NN, SVM, Logistic Regression, Linear Regression, etc.\n", 94 | "\n", 95 | "Of course some of the techniques would be able to learn a better function compared to others.\n", 96 | "

\n", 97 | "" 98 | ] 99 | }, 100 | { 101 | "cell_type": "markdown", 102 | "metadata": { 103 | "ExecuteTime": { 104 | "end_time": "2018-02-05T10:48:52.713000Z", 105 | "start_time": "2018-02-05T10:48:52.703000Z" 106 | } 107 | }, 108 | "source": [ 109 | "MATHEMATICAL FORMULATION
\n", 110 | "\n", 111 | "Training Stage: \n", 112 | "\\begin{align}\n", 113 | "D & = \\{(x_i, y_i)_{i=1}^n | \\ x_i \\in \\mathbb{R}^d, y_i \\in \\{0, 1\\}\\}\n", 114 | "\\end{align}\n", 115 | "\n", 116 | "Testing Stage:\n", 117 | "\\begin{align}\n", 118 | "y_q & = f(x_q)\n", 119 | "\\end{align}" 120 | ] 121 | }, 122 | { 123 | "cell_type": "markdown", 124 | "metadata": {}, 125 | "source": [ 126 | "## Classification vs Regression" 127 | ] 128 | }, 129 | { 130 | "cell_type": "markdown", 131 | "metadata": {}, 132 | "source": [ 133 | "Observe that in classification $$y_i \\in \\{0, 1\\}$$ \n", 134 | "\n", 135 | "What if? $$y_i \\in \\mathbb{R}$$\n", 136 | "\n", 137 | "$$ i.e. \\ y_i \\ is \\ no \\ more \\ part \\ of \\ a \\ small \\ finite \\ set \\ of \\ classes. $$\n", 138 | "\n", 139 | "Lets take an example to understand this:

\n", 140 | "GIVEN Lets say we have 10K students. Now for each student we have their weight, age, gender, race.
\n", 141 | "TASK Predict height of each student?

\n", 142 | "OBSERVATIONS Height is a Real Number. i.e. $$y_i \\in \\mathbb{R}$$
\n", 143 | "So, we can conclude that above task is a Regression task.\n" 144 | ] 145 | }, 146 | { 147 | "cell_type": "markdown", 148 | "metadata": {}, 149 | "source": [ 150 | "# Classification Algorithm : Support Vector Machine" 151 | ] 152 | }, 153 | { 154 | "cell_type": "markdown", 155 | "metadata": {}, 156 | "source": [ 157 | "## Visualizing a basic plot" 158 | ] 159 | }, 160 | { 161 | "cell_type": "markdown", 162 | "metadata": { 163 | "cell_style": "split" 164 | }, 165 | "source": [ 166 | "Lets have a look at a plot.\n", 167 | "" 168 | ] 169 | }, 170 | { 171 | "cell_type": "markdown", 172 | "metadata": { 173 | "cell_style": "split", 174 | "collapsed": true 175 | }, 176 | "source": [ 177 | "There are multiple hyper planes separating positives from negatives.\n", 178 | "" 179 | ] 180 | }, 181 | { 182 | "cell_type": "markdown", 183 | "metadata": {}, 184 | "source": [ 185 | "## But where is the best hyper plane?\n", 186 | "\n", 187 | "KEY IDEA: SVM tries to find a hyperplane that separates +ves from -ves as widely as possible.\n", 188 | "

\n", 189 | "Also known as MARGIN MAXIMIZING hyper plane." 190 | ] 191 | }, 192 | { 193 | "cell_type": "markdown", 194 | "metadata": { 195 | "cell_style": "split" 196 | }, 197 | "source": [ 198 | "Lets look at this plane. Is this the best hyperplane?\n", 199 | "\n", 200 | "" 201 | ] 202 | }, 203 | { 204 | "cell_type": "markdown", 205 | "metadata": { 206 | "cell_style": "split" 207 | }, 208 | "source": [ 209 | "Lets try to draw a plane parallel to original plane and lets try to move it towards +ve points.\n", 210 | "\n", 211 | "" 212 | ] 213 | }, 214 | { 215 | "cell_type": "markdown", 216 | "metadata": { 217 | "cell_style": "split", 218 | "collapsed": true 219 | }, 220 | "source": [ 221 | "Similarly for -ve points.\n", 222 | "\n", 223 | "" 224 | ] 225 | }, 226 | { 227 | "cell_type": "markdown", 228 | "metadata": { 229 | "cell_style": "split", 230 | "collapsed": true 231 | }, 232 | "source": [ 233 | "We will end up getting this: (Separating, +ve & -ve Hyperplane)\n", 234 | " \n", 235 | "" 236 | ] 237 | }, 238 | { 239 | "cell_type": "markdown", 240 | "metadata": {}, 241 | "source": [ 242 | "## Margin & Support Vectors" 243 | ] 244 | }, 245 | { 246 | "cell_type": "markdown", 247 | "metadata": { 248 | "cell_style": "split" 249 | }, 250 | "source": [ 251 | "Now lets look at the Magin.\n", 252 | "\n", 253 | "" 254 | ] 255 | }, 256 | { 257 | "cell_type": "markdown", 258 | "metadata": { 259 | "cell_style": "split" 260 | }, 261 | "source": [ 262 | "Circled points are called SUPPORT VECTORS.\n", 263 | "\n", 264 | "" 265 | ] 266 | }, 267 | { 268 | "cell_type": "markdown", 269 | "metadata": {}, 270 | "source": [ 271 | "MATHEMATICAL FORMULATION
\n", 272 | "\\begin{align}\n", 273 | "Margin & = distance(\\pi_+, \\pi_-)\n", 274 | "\\end{align}\n", 275 | "$$As \\ MARGIN \\ increases, \\ GENERALIZATION \\ ACCURACY \\ increases.$$" 276 | ] 277 | }, 278 | { 279 | "cell_type": "markdown", 280 | "metadata": {}, 281 | "source": [ 282 | "## Intuition: How to actually find the Margin Maximizing Hyperplane?" 283 | ] 284 | }, 285 | { 286 | "cell_type": "markdown", 287 | "metadata": { 288 | "cell_style": "split" 289 | }, 290 | "source": [ 291 | "Lets first understand the idea behind Convex Hull.\n", 292 | "\n", 293 | "Lets look at some shapes and understand what a convex hull is.\n", 294 | "\n", 295 | "" 296 | ] 297 | }, 298 | { 299 | "cell_type": "markdown", 300 | "metadata": { 301 | "cell_style": "split", 302 | "collapsed": true 303 | }, 304 | "source": [ 305 | "Lets now try to find margin maximizing Hyperplane using previous example.\n", 306 | "\n", 307 | "" 308 | ] 309 | }, 310 | { 311 | "cell_type": "markdown", 312 | "metadata": { 313 | "cell_style": "split" 314 | }, 315 | "source": [ 316 | "STEP-1\n", 317 | "Draw the convex hull for +ve and -ve points.\n", 318 | "\n", 319 | "" 320 | ] 321 | }, 322 | { 323 | "cell_type": "markdown", 324 | "metadata": { 325 | "cell_style": "split" 326 | }, 327 | "source": [ 328 | "STEP-2\n", 329 | "Find the shortest line connecting these hulls.\n", 330 | "\n", 331 | "" 332 | ] 333 | }, 334 | { 335 | "cell_type": "markdown", 336 | "metadata": {}, 337 | "source": [ 338 | "STEP-3\n", 339 | "Bisect the line. i.e break it into two equal parts\n", 340 | "\n", 341 | "" 342 | ] 343 | }, 344 | { 345 | "cell_type": "markdown", 346 | "metadata": {}, 347 | "source": [ 348 | "# That's all, Thank you!\n", 349 | "\n", 350 | "" 351 | ] 352 | } 353 | ], 354 | "metadata": { 355 | "kernelspec": { 356 | "display_name": "Python 3", 357 | "language": "python", 358 | "name": "python3" 359 | }, 360 | "language_info": { 361 | "codemirror_mode": { 362 | "name": "ipython", 363 | "version": 3 364 | }, 365 | "file_extension": ".py", 366 | "mimetype": "text/x-python", 367 | "name": "python", 368 | "nbconvert_exporter": "python", 369 | "pygments_lexer": "ipython3", 370 | "version": "3.6.5" 371 | }, 372 | "toc": { 373 | "nav_menu": {}, 374 | "number_sections": true, 375 | "sideBar": true, 376 | "skip_h1_title": false, 377 | "title_cell": "Table of Contents", 378 | "title_sidebar": "Contents", 379 | "toc_cell": false, 380 | "toc_position": { 381 | "height": "calc(100% - 180px)", 382 | "left": "10px", 383 | "top": "150px", 384 | "width": "176px" 385 | }, 386 | "toc_section_display": true, 387 | "toc_window_display": true 388 | }, 389 | "varInspector": { 390 | "cols": { 391 | "lenName": 16, 392 | "lenType": 16, 393 | "lenVar": 40 394 | }, 395 | "kernels_config": { 396 | "python": { 397 | "delete_cmd_postfix": "", 398 | "delete_cmd_prefix": "del ", 399 | "library": "var_list.py", 400 | "varRefreshCmd": "print(var_dic_list())" 401 | }, 402 | "r": { 403 | "delete_cmd_postfix": ") ", 404 | "delete_cmd_prefix": "rm(", 405 | "library": "var_list.r", 406 | "varRefreshCmd": "cat(var_dic_list()) " 407 | } 408 | }, 409 | "types_to_exclude": [ 410 | "module", 411 | "function", 412 | "builtin_function_or_method", 413 | "instance", 414 | "_Feature" 415 | ], 416 | "window_display": false 417 | } 418 | }, 419 | "nbformat": 4, 420 | "nbformat_minor": 2 421 | } 422 | -------------------------------------------------------------------------------- /14. SVM/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/1.png -------------------------------------------------------------------------------- /14. SVM/img/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/10.png -------------------------------------------------------------------------------- /14. SVM/img/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/11.png -------------------------------------------------------------------------------- /14. SVM/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/2.png -------------------------------------------------------------------------------- /14. SVM/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/3.png -------------------------------------------------------------------------------- /14. SVM/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/4.png -------------------------------------------------------------------------------- /14. SVM/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/5.png -------------------------------------------------------------------------------- /14. SVM/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/6.png -------------------------------------------------------------------------------- /14. SVM/img/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/7.png -------------------------------------------------------------------------------- /14. SVM/img/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/8.png -------------------------------------------------------------------------------- /14. SVM/img/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/9.png -------------------------------------------------------------------------------- /14. SVM/img/AI-ML-DL-DS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/AI-ML-DL-DS.png -------------------------------------------------------------------------------- /14. SVM/img/AmazonReview.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/AmazonReview.PNG -------------------------------------------------------------------------------- /14. SVM/img/convex-hull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/convex-hull.png -------------------------------------------------------------------------------- /14. SVM/img/questions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/questions.jpg -------------------------------------------------------------------------------- /14. SVM/img/train-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/14. SVM/img/train-test.png -------------------------------------------------------------------------------- /15. Decision Trees/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/15. Decision Trees/1.png -------------------------------------------------------------------------------- /15. Decision Trees/DT1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/15. Decision Trees/DT1.PNG -------------------------------------------------------------------------------- /15. Decision Trees/DT2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/15. Decision Trees/DT2.PNG -------------------------------------------------------------------------------- /15. Decision Trees/DT3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/15. Decision Trees/DT3.PNG -------------------------------------------------------------------------------- /16. PCA/Iris.csv: -------------------------------------------------------------------------------- 1 | Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species 2 | 1,5.1,3.5,1.4,0.2,Iris-setosa 3 | 2,4.9,3.0,1.4,0.2,Iris-setosa 4 | 3,4.7,3.2,1.3,0.2,Iris-setosa 5 | 4,4.6,3.1,1.5,0.2,Iris-setosa 6 | 5,5.0,3.6,1.4,0.2,Iris-setosa 7 | 6,5.4,3.9,1.7,0.4,Iris-setosa 8 | 7,4.6,3.4,1.4,0.3,Iris-setosa 9 | 8,5.0,3.4,1.5,0.2,Iris-setosa 10 | 9,4.4,2.9,1.4,0.2,Iris-setosa 11 | 10,4.9,3.1,1.5,0.1,Iris-setosa 12 | 11,5.4,3.7,1.5,0.2,Iris-setosa 13 | 12,4.8,3.4,1.6,0.2,Iris-setosa 14 | 13,4.8,3.0,1.4,0.1,Iris-setosa 15 | 14,4.3,3.0,1.1,0.1,Iris-setosa 16 | 15,5.8,4.0,1.2,0.2,Iris-setosa 17 | 16,5.7,4.4,1.5,0.4,Iris-setosa 18 | 17,5.4,3.9,1.3,0.4,Iris-setosa 19 | 18,5.1,3.5,1.4,0.3,Iris-setosa 20 | 19,5.7,3.8,1.7,0.3,Iris-setosa 21 | 20,5.1,3.8,1.5,0.3,Iris-setosa 22 | 21,5.4,3.4,1.7,0.2,Iris-setosa 23 | 22,5.1,3.7,1.5,0.4,Iris-setosa 24 | 23,4.6,3.6,1.0,0.2,Iris-setosa 25 | 24,5.1,3.3,1.7,0.5,Iris-setosa 26 | 25,4.8,3.4,1.9,0.2,Iris-setosa 27 | 26,5.0,3.0,1.6,0.2,Iris-setosa 28 | 27,5.0,3.4,1.6,0.4,Iris-setosa 29 | 28,5.2,3.5,1.5,0.2,Iris-setosa 30 | 29,5.2,3.4,1.4,0.2,Iris-setosa 31 | 30,4.7,3.2,1.6,0.2,Iris-setosa 32 | 31,4.8,3.1,1.6,0.2,Iris-setosa 33 | 32,5.4,3.4,1.5,0.4,Iris-setosa 34 | 33,5.2,4.1,1.5,0.1,Iris-setosa 35 | 34,5.5,4.2,1.4,0.2,Iris-setosa 36 | 35,4.9,3.1,1.5,0.1,Iris-setosa 37 | 36,5.0,3.2,1.2,0.2,Iris-setosa 38 | 37,5.5,3.5,1.3,0.2,Iris-setosa 39 | 38,4.9,3.1,1.5,0.1,Iris-setosa 40 | 39,4.4,3.0,1.3,0.2,Iris-setosa 41 | 40,5.1,3.4,1.5,0.2,Iris-setosa 42 | 41,5.0,3.5,1.3,0.3,Iris-setosa 43 | 42,4.5,2.3,1.3,0.3,Iris-setosa 44 | 43,4.4,3.2,1.3,0.2,Iris-setosa 45 | 44,5.0,3.5,1.6,0.6,Iris-setosa 46 | 45,5.1,3.8,1.9,0.4,Iris-setosa 47 | 46,4.8,3.0,1.4,0.3,Iris-setosa 48 | 47,5.1,3.8,1.6,0.2,Iris-setosa 49 | 48,4.6,3.2,1.4,0.2,Iris-setosa 50 | 49,5.3,3.7,1.5,0.2,Iris-setosa 51 | 50,5.0,3.3,1.4,0.2,Iris-setosa 52 | 51,7.0,3.2,4.7,1.4,Iris-versicolor 53 | 52,6.4,3.2,4.5,1.5,Iris-versicolor 54 | 53,6.9,3.1,4.9,1.5,Iris-versicolor 55 | 54,5.5,2.3,4.0,1.3,Iris-versicolor 56 | 55,6.5,2.8,4.6,1.5,Iris-versicolor 57 | 56,5.7,2.8,4.5,1.3,Iris-versicolor 58 | 57,6.3,3.3,4.7,1.6,Iris-versicolor 59 | 58,4.9,2.4,3.3,1.0,Iris-versicolor 60 | 59,6.6,2.9,4.6,1.3,Iris-versicolor 61 | 60,5.2,2.7,3.9,1.4,Iris-versicolor 62 | 61,5.0,2.0,3.5,1.0,Iris-versicolor 63 | 62,5.9,3.0,4.2,1.5,Iris-versicolor 64 | 63,6.0,2.2,4.0,1.0,Iris-versicolor 65 | 64,6.1,2.9,4.7,1.4,Iris-versicolor 66 | 65,5.6,2.9,3.6,1.3,Iris-versicolor 67 | 66,6.7,3.1,4.4,1.4,Iris-versicolor 68 | 67,5.6,3.0,4.5,1.5,Iris-versicolor 69 | 68,5.8,2.7,4.1,1.0,Iris-versicolor 70 | 69,6.2,2.2,4.5,1.5,Iris-versicolor 71 | 70,5.6,2.5,3.9,1.1,Iris-versicolor 72 | 71,5.9,3.2,4.8,1.8,Iris-versicolor 73 | 72,6.1,2.8,4.0,1.3,Iris-versicolor 74 | 73,6.3,2.5,4.9,1.5,Iris-versicolor 75 | 74,6.1,2.8,4.7,1.2,Iris-versicolor 76 | 75,6.4,2.9,4.3,1.3,Iris-versicolor 77 | 76,6.6,3.0,4.4,1.4,Iris-versicolor 78 | 77,6.8,2.8,4.8,1.4,Iris-versicolor 79 | 78,6.7,3.0,5.0,1.7,Iris-versicolor 80 | 79,6.0,2.9,4.5,1.5,Iris-versicolor 81 | 80,5.7,2.6,3.5,1.0,Iris-versicolor 82 | 81,5.5,2.4,3.8,1.1,Iris-versicolor 83 | 82,5.5,2.4,3.7,1.0,Iris-versicolor 84 | 83,5.8,2.7,3.9,1.2,Iris-versicolor 85 | 84,6.0,2.7,5.1,1.6,Iris-versicolor 86 | 85,5.4,3.0,4.5,1.5,Iris-versicolor 87 | 86,6.0,3.4,4.5,1.6,Iris-versicolor 88 | 87,6.7,3.1,4.7,1.5,Iris-versicolor 89 | 88,6.3,2.3,4.4,1.3,Iris-versicolor 90 | 89,5.6,3.0,4.1,1.3,Iris-versicolor 91 | 90,5.5,2.5,4.0,1.3,Iris-versicolor 92 | 91,5.5,2.6,4.4,1.2,Iris-versicolor 93 | 92,6.1,3.0,4.6,1.4,Iris-versicolor 94 | 93,5.8,2.6,4.0,1.2,Iris-versicolor 95 | 94,5.0,2.3,3.3,1.0,Iris-versicolor 96 | 95,5.6,2.7,4.2,1.3,Iris-versicolor 97 | 96,5.7,3.0,4.2,1.2,Iris-versicolor 98 | 97,5.7,2.9,4.2,1.3,Iris-versicolor 99 | 98,6.2,2.9,4.3,1.3,Iris-versicolor 100 | 99,5.1,2.5,3.0,1.1,Iris-versicolor 101 | 100,5.7,2.8,4.1,1.3,Iris-versicolor 102 | 101,6.3,3.3,6.0,2.5,Iris-virginica 103 | 102,5.8,2.7,5.1,1.9,Iris-virginica 104 | 103,7.1,3.0,5.9,2.1,Iris-virginica 105 | 104,6.3,2.9,5.6,1.8,Iris-virginica 106 | 105,6.5,3.0,5.8,2.2,Iris-virginica 107 | 106,7.6,3.0,6.6,2.1,Iris-virginica 108 | 107,4.9,2.5,4.5,1.7,Iris-virginica 109 | 108,7.3,2.9,6.3,1.8,Iris-virginica 110 | 109,6.7,2.5,5.8,1.8,Iris-virginica 111 | 110,7.2,3.6,6.1,2.5,Iris-virginica 112 | 111,6.5,3.2,5.1,2.0,Iris-virginica 113 | 112,6.4,2.7,5.3,1.9,Iris-virginica 114 | 113,6.8,3.0,5.5,2.1,Iris-virginica 115 | 114,5.7,2.5,5.0,2.0,Iris-virginica 116 | 115,5.8,2.8,5.1,2.4,Iris-virginica 117 | 116,6.4,3.2,5.3,2.3,Iris-virginica 118 | 117,6.5,3.0,5.5,1.8,Iris-virginica 119 | 118,7.7,3.8,6.7,2.2,Iris-virginica 120 | 119,7.7,2.6,6.9,2.3,Iris-virginica 121 | 120,6.0,2.2,5.0,1.5,Iris-virginica 122 | 121,6.9,3.2,5.7,2.3,Iris-virginica 123 | 122,5.6,2.8,4.9,2.0,Iris-virginica 124 | 123,7.7,2.8,6.7,2.0,Iris-virginica 125 | 124,6.3,2.7,4.9,1.8,Iris-virginica 126 | 125,6.7,3.3,5.7,2.1,Iris-virginica 127 | 126,7.2,3.2,6.0,1.8,Iris-virginica 128 | 127,6.2,2.8,4.8,1.8,Iris-virginica 129 | 128,6.1,3.0,4.9,1.8,Iris-virginica 130 | 129,6.4,2.8,5.6,2.1,Iris-virginica 131 | 130,7.2,3.0,5.8,1.6,Iris-virginica 132 | 131,7.4,2.8,6.1,1.9,Iris-virginica 133 | 132,7.9,3.8,6.4,2.0,Iris-virginica 134 | 133,6.4,2.8,5.6,2.2,Iris-virginica 135 | 134,6.3,2.8,5.1,1.5,Iris-virginica 136 | 135,6.1,2.6,5.6,1.4,Iris-virginica 137 | 136,7.7,3.0,6.1,2.3,Iris-virginica 138 | 137,6.3,3.4,5.6,2.4,Iris-virginica 139 | 138,6.4,3.1,5.5,1.8,Iris-virginica 140 | 139,6.0,3.0,4.8,1.8,Iris-virginica 141 | 140,6.9,3.1,5.4,2.1,Iris-virginica 142 | 141,6.7,3.1,5.6,2.4,Iris-virginica 143 | 142,6.9,3.1,5.1,2.3,Iris-virginica 144 | 143,5.8,2.7,5.1,1.9,Iris-virginica 145 | 144,6.8,3.2,5.9,2.3,Iris-virginica 146 | 145,6.7,3.3,5.7,2.5,Iris-virginica 147 | 146,6.7,3.0,5.2,2.3,Iris-virginica 148 | 147,6.3,2.5,5.0,1.9,Iris-virginica 149 | 148,6.5,3.0,5.2,2.0,Iris-virginica 150 | 149,6.2,3.4,5.4,2.3,Iris-virginica 151 | 150,5.9,3.0,5.1,1.8,Iris-virginica 152 | -------------------------------------------------------------------------------- /17. Ensembles/Iris.csv: -------------------------------------------------------------------------------- 1 | Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species 2 | 1,5.1,3.5,1.4,0.2,Iris-setosa 3 | 2,4.9,3.0,1.4,0.2,Iris-setosa 4 | 3,4.7,3.2,1.3,0.2,Iris-setosa 5 | 4,4.6,3.1,1.5,0.2,Iris-setosa 6 | 5,5.0,3.6,1.4,0.2,Iris-setosa 7 | 6,5.4,3.9,1.7,0.4,Iris-setosa 8 | 7,4.6,3.4,1.4,0.3,Iris-setosa 9 | 8,5.0,3.4,1.5,0.2,Iris-setosa 10 | 9,4.4,2.9,1.4,0.2,Iris-setosa 11 | 10,4.9,3.1,1.5,0.1,Iris-setosa 12 | 11,5.4,3.7,1.5,0.2,Iris-setosa 13 | 12,4.8,3.4,1.6,0.2,Iris-setosa 14 | 13,4.8,3.0,1.4,0.1,Iris-setosa 15 | 14,4.3,3.0,1.1,0.1,Iris-setosa 16 | 15,5.8,4.0,1.2,0.2,Iris-setosa 17 | 16,5.7,4.4,1.5,0.4,Iris-setosa 18 | 17,5.4,3.9,1.3,0.4,Iris-setosa 19 | 18,5.1,3.5,1.4,0.3,Iris-setosa 20 | 19,5.7,3.8,1.7,0.3,Iris-setosa 21 | 20,5.1,3.8,1.5,0.3,Iris-setosa 22 | 21,5.4,3.4,1.7,0.2,Iris-setosa 23 | 22,5.1,3.7,1.5,0.4,Iris-setosa 24 | 23,4.6,3.6,1.0,0.2,Iris-setosa 25 | 24,5.1,3.3,1.7,0.5,Iris-setosa 26 | 25,4.8,3.4,1.9,0.2,Iris-setosa 27 | 26,5.0,3.0,1.6,0.2,Iris-setosa 28 | 27,5.0,3.4,1.6,0.4,Iris-setosa 29 | 28,5.2,3.5,1.5,0.2,Iris-setosa 30 | 29,5.2,3.4,1.4,0.2,Iris-setosa 31 | 30,4.7,3.2,1.6,0.2,Iris-setosa 32 | 31,4.8,3.1,1.6,0.2,Iris-setosa 33 | 32,5.4,3.4,1.5,0.4,Iris-setosa 34 | 33,5.2,4.1,1.5,0.1,Iris-setosa 35 | 34,5.5,4.2,1.4,0.2,Iris-setosa 36 | 35,4.9,3.1,1.5,0.1,Iris-setosa 37 | 36,5.0,3.2,1.2,0.2,Iris-setosa 38 | 37,5.5,3.5,1.3,0.2,Iris-setosa 39 | 38,4.9,3.1,1.5,0.1,Iris-setosa 40 | 39,4.4,3.0,1.3,0.2,Iris-setosa 41 | 40,5.1,3.4,1.5,0.2,Iris-setosa 42 | 41,5.0,3.5,1.3,0.3,Iris-setosa 43 | 42,4.5,2.3,1.3,0.3,Iris-setosa 44 | 43,4.4,3.2,1.3,0.2,Iris-setosa 45 | 44,5.0,3.5,1.6,0.6,Iris-setosa 46 | 45,5.1,3.8,1.9,0.4,Iris-setosa 47 | 46,4.8,3.0,1.4,0.3,Iris-setosa 48 | 47,5.1,3.8,1.6,0.2,Iris-setosa 49 | 48,4.6,3.2,1.4,0.2,Iris-setosa 50 | 49,5.3,3.7,1.5,0.2,Iris-setosa 51 | 50,5.0,3.3,1.4,0.2,Iris-setosa 52 | 51,7.0,3.2,4.7,1.4,Iris-versicolor 53 | 52,6.4,3.2,4.5,1.5,Iris-versicolor 54 | 53,6.9,3.1,4.9,1.5,Iris-versicolor 55 | 54,5.5,2.3,4.0,1.3,Iris-versicolor 56 | 55,6.5,2.8,4.6,1.5,Iris-versicolor 57 | 56,5.7,2.8,4.5,1.3,Iris-versicolor 58 | 57,6.3,3.3,4.7,1.6,Iris-versicolor 59 | 58,4.9,2.4,3.3,1.0,Iris-versicolor 60 | 59,6.6,2.9,4.6,1.3,Iris-versicolor 61 | 60,5.2,2.7,3.9,1.4,Iris-versicolor 62 | 61,5.0,2.0,3.5,1.0,Iris-versicolor 63 | 62,5.9,3.0,4.2,1.5,Iris-versicolor 64 | 63,6.0,2.2,4.0,1.0,Iris-versicolor 65 | 64,6.1,2.9,4.7,1.4,Iris-versicolor 66 | 65,5.6,2.9,3.6,1.3,Iris-versicolor 67 | 66,6.7,3.1,4.4,1.4,Iris-versicolor 68 | 67,5.6,3.0,4.5,1.5,Iris-versicolor 69 | 68,5.8,2.7,4.1,1.0,Iris-versicolor 70 | 69,6.2,2.2,4.5,1.5,Iris-versicolor 71 | 70,5.6,2.5,3.9,1.1,Iris-versicolor 72 | 71,5.9,3.2,4.8,1.8,Iris-versicolor 73 | 72,6.1,2.8,4.0,1.3,Iris-versicolor 74 | 73,6.3,2.5,4.9,1.5,Iris-versicolor 75 | 74,6.1,2.8,4.7,1.2,Iris-versicolor 76 | 75,6.4,2.9,4.3,1.3,Iris-versicolor 77 | 76,6.6,3.0,4.4,1.4,Iris-versicolor 78 | 77,6.8,2.8,4.8,1.4,Iris-versicolor 79 | 78,6.7,3.0,5.0,1.7,Iris-versicolor 80 | 79,6.0,2.9,4.5,1.5,Iris-versicolor 81 | 80,5.7,2.6,3.5,1.0,Iris-versicolor 82 | 81,5.5,2.4,3.8,1.1,Iris-versicolor 83 | 82,5.5,2.4,3.7,1.0,Iris-versicolor 84 | 83,5.8,2.7,3.9,1.2,Iris-versicolor 85 | 84,6.0,2.7,5.1,1.6,Iris-versicolor 86 | 85,5.4,3.0,4.5,1.5,Iris-versicolor 87 | 86,6.0,3.4,4.5,1.6,Iris-versicolor 88 | 87,6.7,3.1,4.7,1.5,Iris-versicolor 89 | 88,6.3,2.3,4.4,1.3,Iris-versicolor 90 | 89,5.6,3.0,4.1,1.3,Iris-versicolor 91 | 90,5.5,2.5,4.0,1.3,Iris-versicolor 92 | 91,5.5,2.6,4.4,1.2,Iris-versicolor 93 | 92,6.1,3.0,4.6,1.4,Iris-versicolor 94 | 93,5.8,2.6,4.0,1.2,Iris-versicolor 95 | 94,5.0,2.3,3.3,1.0,Iris-versicolor 96 | 95,5.6,2.7,4.2,1.3,Iris-versicolor 97 | 96,5.7,3.0,4.2,1.2,Iris-versicolor 98 | 97,5.7,2.9,4.2,1.3,Iris-versicolor 99 | 98,6.2,2.9,4.3,1.3,Iris-versicolor 100 | 99,5.1,2.5,3.0,1.1,Iris-versicolor 101 | 100,5.7,2.8,4.1,1.3,Iris-versicolor 102 | 101,6.3,3.3,6.0,2.5,Iris-virginica 103 | 102,5.8,2.7,5.1,1.9,Iris-virginica 104 | 103,7.1,3.0,5.9,2.1,Iris-virginica 105 | 104,6.3,2.9,5.6,1.8,Iris-virginica 106 | 105,6.5,3.0,5.8,2.2,Iris-virginica 107 | 106,7.6,3.0,6.6,2.1,Iris-virginica 108 | 107,4.9,2.5,4.5,1.7,Iris-virginica 109 | 108,7.3,2.9,6.3,1.8,Iris-virginica 110 | 109,6.7,2.5,5.8,1.8,Iris-virginica 111 | 110,7.2,3.6,6.1,2.5,Iris-virginica 112 | 111,6.5,3.2,5.1,2.0,Iris-virginica 113 | 112,6.4,2.7,5.3,1.9,Iris-virginica 114 | 113,6.8,3.0,5.5,2.1,Iris-virginica 115 | 114,5.7,2.5,5.0,2.0,Iris-virginica 116 | 115,5.8,2.8,5.1,2.4,Iris-virginica 117 | 116,6.4,3.2,5.3,2.3,Iris-virginica 118 | 117,6.5,3.0,5.5,1.8,Iris-virginica 119 | 118,7.7,3.8,6.7,2.2,Iris-virginica 120 | 119,7.7,2.6,6.9,2.3,Iris-virginica 121 | 120,6.0,2.2,5.0,1.5,Iris-virginica 122 | 121,6.9,3.2,5.7,2.3,Iris-virginica 123 | 122,5.6,2.8,4.9,2.0,Iris-virginica 124 | 123,7.7,2.8,6.7,2.0,Iris-virginica 125 | 124,6.3,2.7,4.9,1.8,Iris-virginica 126 | 125,6.7,3.3,5.7,2.1,Iris-virginica 127 | 126,7.2,3.2,6.0,1.8,Iris-virginica 128 | 127,6.2,2.8,4.8,1.8,Iris-virginica 129 | 128,6.1,3.0,4.9,1.8,Iris-virginica 130 | 129,6.4,2.8,5.6,2.1,Iris-virginica 131 | 130,7.2,3.0,5.8,1.6,Iris-virginica 132 | 131,7.4,2.8,6.1,1.9,Iris-virginica 133 | 132,7.9,3.8,6.4,2.0,Iris-virginica 134 | 133,6.4,2.8,5.6,2.2,Iris-virginica 135 | 134,6.3,2.8,5.1,1.5,Iris-virginica 136 | 135,6.1,2.6,5.6,1.4,Iris-virginica 137 | 136,7.7,3.0,6.1,2.3,Iris-virginica 138 | 137,6.3,3.4,5.6,2.4,Iris-virginica 139 | 138,6.4,3.1,5.5,1.8,Iris-virginica 140 | 139,6.0,3.0,4.8,1.8,Iris-virginica 141 | 140,6.9,3.1,5.4,2.1,Iris-virginica 142 | 141,6.7,3.1,5.6,2.4,Iris-virginica 143 | 142,6.9,3.1,5.1,2.3,Iris-virginica 144 | 143,5.8,2.7,5.1,1.9,Iris-virginica 145 | 144,6.8,3.2,5.9,2.3,Iris-virginica 146 | 145,6.7,3.3,5.7,2.5,Iris-virginica 147 | 146,6.7,3.0,5.2,2.3,Iris-virginica 148 | 147,6.3,2.5,5.0,1.9,Iris-virginica 149 | 148,6.5,3.0,5.2,2.0,Iris-virginica 150 | 149,6.2,3.4,5.4,2.3,Iris-virginica 151 | 150,5.9,3.0,5.1,1.8,Iris-virginica 152 | -------------------------------------------------------------------------------- /17. Ensembles/ensembles.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Voting Ensemble" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": { 14 | "ExecuteTime": { 15 | "end_time": "2018-07-16T05:53:07.010303Z", 16 | "start_time": "2018-07-16T05:52:51.448342Z" 17 | } 18 | }, 19 | "outputs": [], 20 | "source": [ 21 | "import pandas as pd" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 2, 27 | "metadata": { 28 | "ExecuteTime": { 29 | "end_time": "2018-07-16T05:55:14.290570Z", 30 | "start_time": "2018-07-16T05:55:14.096880Z" 31 | } 32 | }, 33 | "outputs": [], 34 | "source": [ 35 | "df = pd.read_csv('Iris.csv')\n", 36 | "label = df['Species']\n", 37 | "data = df.drop(\"Species\",axis=1)\n", 38 | "data = data.drop(\"Id\",axis=1)" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": 3, 44 | "metadata": { 45 | "ExecuteTime": { 46 | "end_time": "2018-07-16T05:56:38.814839Z", 47 | "start_time": "2018-07-16T05:56:24.916233Z" 48 | } 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "from sklearn.model_selection import train_test_split\n", 53 | "X_train, X_test, y_train, y_test = train_test_split(data, \\\n", 54 | " label, \\\n", 55 | " test_size = 0.25, \\\n", 56 | " random_state = 0)" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 11, 62 | "metadata": { 63 | "ExecuteTime": { 64 | "end_time": "2018-07-16T06:05:35.590059Z", 65 | "start_time": "2018-07-16T06:05:35.581989Z" 66 | } 67 | }, 68 | "outputs": [ 69 | { 70 | "name": "stdout", 71 | "output_type": "stream", 72 | "text": [ 73 | "(38, 4)\n" 74 | ] 75 | } 76 | ], 77 | "source": [ 78 | "print(X_test.shape)" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 6, 84 | "metadata": { 85 | "ExecuteTime": { 86 | "end_time": "2018-07-16T05:58:53.381803Z", 87 | "start_time": "2018-07-16T05:58:53.375142Z" 88 | } 89 | }, 90 | "outputs": [], 91 | "source": [ 92 | "from sklearn.linear_model import LogisticRegression\n", 93 | "from sklearn.naive_bayes import GaussianNB\n", 94 | "from sklearn.ensemble import VotingClassifier" 95 | ] 96 | }, 97 | { 98 | "cell_type": "code", 99 | "execution_count": 7, 100 | "metadata": { 101 | "ExecuteTime": { 102 | "end_time": "2018-07-16T06:01:33.647892Z", 103 | "start_time": "2018-07-16T06:01:33.599509Z" 104 | }, 105 | "scrolled": true 106 | }, 107 | "outputs": [ 108 | { 109 | "data": { 110 | "text/plain": [ 111 | "VotingClassifier(estimators=[('Log Reg', LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n", 112 | " intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n", 113 | " penalty='l2', random_state=None, solver='liblinear', tol=0.0001,\n", 114 | " verbose=0, warm_start=False)), ('GNB', GaussianNB(priors=None))],\n", 115 | " flatten_transform=None, n_jobs=1, voting='hard', weights=None)" 116 | ] 117 | }, 118 | "execution_count": 7, 119 | "metadata": {}, 120 | "output_type": "execute_result" 121 | } 122 | ], 123 | "source": [ 124 | "clf1 = LogisticRegression()\n", 125 | "clf2 = GaussianNB()\n", 126 | "\n", 127 | "ensemble = VotingClassifier(estimators = [('Log Reg',clf1), ('GNB',clf2)])\n", 128 | "\n", 129 | "ensemble.fit(X_train, y_train)" 130 | ] 131 | }, 132 | { 133 | "cell_type": "code", 134 | "execution_count": 8, 135 | "metadata": { 136 | "ExecuteTime": { 137 | "end_time": "2018-07-16T06:04:16.318615Z", 138 | "start_time": "2018-07-16T06:04:16.230233Z" 139 | }, 140 | "scrolled": true 141 | }, 142 | "outputs": [ 143 | { 144 | "name": "stderr", 145 | "output_type": "stream", 146 | "text": [ 147 | "c:\\users\\kanav\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sklearn\\preprocessing\\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.\n", 148 | " if diff:\n" 149 | ] 150 | } 151 | ], 152 | "source": [ 153 | "y_pred = ensemble.predict(X_test)" 154 | ] 155 | }, 156 | { 157 | "cell_type": "code", 158 | "execution_count": 9, 159 | "metadata": { 160 | "ExecuteTime": { 161 | "end_time": "2018-07-16T06:04:19.761753Z", 162 | "start_time": "2018-07-16T06:04:19.752638Z" 163 | } 164 | }, 165 | "outputs": [ 166 | { 167 | "data": { 168 | "text/plain": [ 169 | "1.0" 170 | ] 171 | }, 172 | "execution_count": 9, 173 | "metadata": {}, 174 | "output_type": "execute_result" 175 | } 176 | ], 177 | "source": [ 178 | "from sklearn import metrics\n", 179 | "metrics.accuracy_score(y_test, y_pred)" 180 | ] 181 | }, 182 | { 183 | "cell_type": "code", 184 | "execution_count": 10, 185 | "metadata": { 186 | "ExecuteTime": { 187 | "end_time": "2018-07-16T06:04:55.359282Z", 188 | "start_time": "2018-07-16T06:04:55.349153Z" 189 | } 190 | }, 191 | "outputs": [ 192 | { 193 | "data": { 194 | "text/plain": [ 195 | "array([[13, 0, 0],\n", 196 | " [ 0, 16, 0],\n", 197 | " [ 0, 0, 9]], dtype=int64)" 198 | ] 199 | }, 200 | "execution_count": 10, 201 | "metadata": {}, 202 | "output_type": "execute_result" 203 | } 204 | ], 205 | "source": [ 206 | "# print the confusion matrix\n", 207 | "con_metrics = metrics.confusion_matrix(y_test, y_pred)\n", 208 | "con_metrics" 209 | ] 210 | }, 211 | { 212 | "cell_type": "markdown", 213 | "metadata": {}, 214 | "source": [ 215 | "## Stochastic Gradient Boosting" 216 | ] 217 | }, 218 | { 219 | "cell_type": "code", 220 | "execution_count": 14, 221 | "metadata": { 222 | "ExecuteTime": { 223 | "end_time": "2018-07-16T06:12:53.391592Z", 224 | "start_time": "2018-07-16T06:12:53.208079Z" 225 | } 226 | }, 227 | "outputs": [ 228 | { 229 | "data": { 230 | "text/plain": [ 231 | "GradientBoostingClassifier(criterion='friedman_mse', init=None,\n", 232 | " learning_rate=0.1, loss='deviance', max_depth=3,\n", 233 | " max_features=None, max_leaf_nodes=None,\n", 234 | " min_impurity_decrease=0.0, min_impurity_split=None,\n", 235 | " min_samples_leaf=1, min_samples_split=2,\n", 236 | " min_weight_fraction_leaf=0.0, n_estimators=100,\n", 237 | " presort='auto', random_state=7, subsample=1.0, verbose=0,\n", 238 | " warm_start=False)" 239 | ] 240 | }, 241 | "execution_count": 14, 242 | "metadata": {}, 243 | "output_type": "execute_result" 244 | } 245 | ], 246 | "source": [ 247 | "from sklearn.ensemble import GradientBoostingClassifier\n", 248 | "\n", 249 | "seed = 7\n", 250 | "num_trees = 100\n", 251 | "gbdt = GradientBoostingClassifier(n_estimators=num_trees, random_state=seed)\n", 252 | "gbdt.fit(X_train, y_train)" 253 | ] 254 | }, 255 | { 256 | "cell_type": "code", 257 | "execution_count": 15, 258 | "metadata": { 259 | "ExecuteTime": { 260 | "end_time": "2018-07-16T06:13:07.208587Z", 261 | "start_time": "2018-07-16T06:13:07.198507Z" 262 | } 263 | }, 264 | "outputs": [], 265 | "source": [ 266 | "y_pred = gbdt.predict(X_test)" 267 | ] 268 | }, 269 | { 270 | "cell_type": "code", 271 | "execution_count": 16, 272 | "metadata": { 273 | "ExecuteTime": { 274 | "end_time": "2018-07-16T06:13:28.285005Z", 275 | "start_time": "2018-07-16T06:13:28.277082Z" 276 | } 277 | }, 278 | "outputs": [ 279 | { 280 | "data": { 281 | "text/plain": [ 282 | "0.9736842105263158" 283 | ] 284 | }, 285 | "execution_count": 16, 286 | "metadata": {}, 287 | "output_type": "execute_result" 288 | } 289 | ], 290 | "source": [ 291 | "from sklearn import metrics\n", 292 | "metrics.accuracy_score(y_test, y_pred)" 293 | ] 294 | }, 295 | { 296 | "cell_type": "code", 297 | "execution_count": 17, 298 | "metadata": { 299 | "ExecuteTime": { 300 | "end_time": "2018-07-16T06:13:31.101837Z", 301 | "start_time": "2018-07-16T06:13:31.092446Z" 302 | } 303 | }, 304 | "outputs": [ 305 | { 306 | "data": { 307 | "text/plain": [ 308 | "array([[13, 0, 0],\n", 309 | " [ 0, 15, 1],\n", 310 | " [ 0, 0, 9]], dtype=int64)" 311 | ] 312 | }, 313 | "execution_count": 17, 314 | "metadata": {}, 315 | "output_type": "execute_result" 316 | } 317 | ], 318 | "source": [ 319 | "# print the confusion matrix\n", 320 | "con_metrics = metrics.confusion_matrix(y_test, y_pred)\n", 321 | "con_metrics" 322 | ] 323 | }, 324 | { 325 | "cell_type": "markdown", 326 | "metadata": {}, 327 | "source": [ 328 | "## Adaboost" 329 | ] 330 | }, 331 | { 332 | "cell_type": "code", 333 | "execution_count": 18, 334 | "metadata": { 335 | "ExecuteTime": { 336 | "end_time": "2018-07-16T06:14:45.628824Z", 337 | "start_time": "2018-07-16T06:14:45.558474Z" 338 | } 339 | }, 340 | "outputs": [ 341 | { 342 | "data": { 343 | "text/plain": [ 344 | "AdaBoostClassifier(algorithm='SAMME.R', base_estimator=None,\n", 345 | " learning_rate=1.0, n_estimators=30, random_state=7)" 346 | ] 347 | }, 348 | "execution_count": 18, 349 | "metadata": {}, 350 | "output_type": "execute_result" 351 | } 352 | ], 353 | "source": [ 354 | "from sklearn.ensemble import AdaBoostClassifier\n", 355 | "\n", 356 | "seed = 7\n", 357 | "num_trees = 30\n", 358 | "ada = AdaBoostClassifier(n_estimators=num_trees, random_state=seed)\n", 359 | "ada.fit(X_train, y_train)" 360 | ] 361 | }, 362 | { 363 | "cell_type": "code", 364 | "execution_count": 22, 365 | "metadata": { 366 | "ExecuteTime": { 367 | "end_time": "2018-07-16T06:15:35.061501Z", 368 | "start_time": "2018-07-16T06:15:35.050525Z" 369 | } 370 | }, 371 | "outputs": [], 372 | "source": [ 373 | "y_pred = ada.predict(X_test)" 374 | ] 375 | }, 376 | { 377 | "cell_type": "code", 378 | "execution_count": 23, 379 | "metadata": { 380 | "ExecuteTime": { 381 | "end_time": "2018-07-16T06:15:35.845279Z", 382 | "start_time": "2018-07-16T06:15:35.837080Z" 383 | } 384 | }, 385 | "outputs": [ 386 | { 387 | "data": { 388 | "text/plain": [ 389 | "0.8947368421052632" 390 | ] 391 | }, 392 | "execution_count": 23, 393 | "metadata": {}, 394 | "output_type": "execute_result" 395 | } 396 | ], 397 | "source": [ 398 | "from sklearn import metrics\n", 399 | "metrics.accuracy_score(y_test, y_pred)" 400 | ] 401 | }, 402 | { 403 | "cell_type": "code", 404 | "execution_count": 24, 405 | "metadata": { 406 | "ExecuteTime": { 407 | "end_time": "2018-07-16T06:15:38.769632Z", 408 | "start_time": "2018-07-16T06:15:38.760685Z" 409 | } 410 | }, 411 | "outputs": [ 412 | { 413 | "data": { 414 | "text/plain": [ 415 | "array([[13, 0, 0],\n", 416 | " [ 0, 15, 1],\n", 417 | " [ 0, 3, 6]], dtype=int64)" 418 | ] 419 | }, 420 | "execution_count": 24, 421 | "metadata": {}, 422 | "output_type": "execute_result" 423 | } 424 | ], 425 | "source": [ 426 | "# print the confusion matrix\n", 427 | "con_metrics = metrics.confusion_matrix(y_test, y_pred)\n", 428 | "con_metrics" 429 | ] 430 | }, 431 | { 432 | "cell_type": "code", 433 | "execution_count": null, 434 | "metadata": {}, 435 | "outputs": [], 436 | "source": [] 437 | } 438 | ], 439 | "metadata": { 440 | "kernelspec": { 441 | "display_name": "Python 3", 442 | "language": "python", 443 | "name": "python3" 444 | }, 445 | "language_info": { 446 | "codemirror_mode": { 447 | "name": "ipython", 448 | "version": 3 449 | }, 450 | "file_extension": ".py", 451 | "mimetype": "text/x-python", 452 | "name": "python", 453 | "nbconvert_exporter": "python", 454 | "pygments_lexer": "ipython3", 455 | "version": "3.6.5" 456 | }, 457 | "toc": { 458 | "nav_menu": {}, 459 | "number_sections": true, 460 | "sideBar": true, 461 | "skip_h1_title": false, 462 | "title_cell": "Table of Contents", 463 | "title_sidebar": "Contents", 464 | "toc_cell": false, 465 | "toc_position": {}, 466 | "toc_section_display": true, 467 | "toc_window_display": false 468 | }, 469 | "varInspector": { 470 | "cols": { 471 | "lenName": 16, 472 | "lenType": 16, 473 | "lenVar": 40 474 | }, 475 | "kernels_config": { 476 | "python": { 477 | "delete_cmd_postfix": "", 478 | "delete_cmd_prefix": "del ", 479 | "library": "var_list.py", 480 | "varRefreshCmd": "print(var_dic_list())" 481 | }, 482 | "r": { 483 | "delete_cmd_postfix": ") ", 484 | "delete_cmd_prefix": "rm(", 485 | "library": "var_list.r", 486 | "varRefreshCmd": "cat(var_dic_list()) " 487 | } 488 | }, 489 | "types_to_exclude": [ 490 | "module", 491 | "function", 492 | "builtin_function_or_method", 493 | "instance", 494 | "_Feature" 495 | ], 496 | "window_display": false 497 | } 498 | }, 499 | "nbformat": 4, 500 | "nbformat_minor": 2 501 | } 502 | -------------------------------------------------------------------------------- /18. Clustering - K Means/K-Means.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "What is Clustering?\n", 8 | "\n", 9 | "\n", 10 | "CLUSTERING TASK Group/ Cluster similar data points.\n", 11 | "\n", 12 | "OBSERVATIONS \n", 13 | " Points in a cluster are close together.\n", 14 | " Points in different cluster are far away from each other.\n", 15 | " \n", 16 | "\n", 17 | "Clustering is UNSUPERVISED LEARNING.\n", 18 | "\n", 19 | "Algorithm(for clustering): K-means, K-means++, Hierarchical Clustering, DBSCAN\n", 20 | " " 21 | ] 22 | }, 23 | { 24 | "cell_type": "markdown", 25 | "metadata": {}, 26 | "source": [ 27 | "Applications of Clustering\n", 28 | " \n", 29 | " E-commerce - Task is to group similar customers based on there purchasing behavior(How much money they spent, kind of credit card, kind of products they buy, geographical area).\n", 30 | " \n", 31 | " Image Segmentation - group similar pixel\n", 32 | " After grouping, we typically apply ML techniques to perform object detection.\n", 33 | " " 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "K-MEANS CLUSTERING\n", 41 | " Group them into 'k' clusters.\n", 42 | " For every clusters, it assigns centroid to each cluster.\n", 43 | " " 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "metadata": {}, 49 | "source": [ 50 | "https://towardsdatascience.com/clustering-using-k-means-algorithm-81da00f156f6" 51 | ] 52 | }, 53 | { 54 | "cell_type": "markdown", 55 | "metadata": {}, 56 | "source": [ 57 | "## Coding Sample" 58 | ] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": 1, 63 | "metadata": { 64 | "ExecuteTime": { 65 | "end_time": "2018-07-17T10:19:38.582848Z", 66 | "start_time": "2018-07-17T10:19:37.351142Z" 67 | } 68 | }, 69 | "outputs": [], 70 | "source": [ 71 | "import pandas as pd\n", 72 | "import numpy as np\n", 73 | "from sklearn import datasets\n", 74 | "\n", 75 | "from sklearn.cluster import KMeans\n", 76 | "import matplotlib.pyplot as plt" 77 | ] 78 | }, 79 | { 80 | "cell_type": "code", 81 | "execution_count": 2, 82 | "metadata": { 83 | "ExecuteTime": { 84 | "end_time": "2018-07-17T10:19:38.602791Z", 85 | "start_time": "2018-07-17T10:19:38.594813Z" 86 | } 87 | }, 88 | "outputs": [], 89 | "source": [ 90 | "iris = datasets.load_iris()" 91 | ] 92 | }, 93 | { 94 | "cell_type": "code", 95 | "execution_count": 3, 96 | "metadata": { 97 | "ExecuteTime": { 98 | "end_time": "2018-07-17T10:19:38.856145Z", 99 | "start_time": "2018-07-17T10:19:38.846141Z" 100 | } 101 | }, 102 | "outputs": [], 103 | "source": [ 104 | "x = pd.DataFrame(iris.data)\n", 105 | "x.columns = ['Sepal_Length','Sepal_Width','Petal_Length','Petal_Width']\n", 106 | " \n", 107 | "y = pd.DataFrame(iris.target)\n", 108 | "y.columns = ['Targets']" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": 4, 114 | "metadata": { 115 | "ExecuteTime": { 116 | "end_time": "2018-07-17T10:19:39.948193Z", 117 | "start_time": "2018-07-17T10:19:39.913307Z" 118 | } 119 | }, 120 | "outputs": [ 121 | { 122 | "data": { 123 | "text/plain": [ 124 | "KMeans(algorithm='auto', copy_x=True, init='k-means++', max_iter=300,\n", 125 | " n_clusters=3, n_init=10, n_jobs=1, precompute_distances='auto',\n", 126 | " random_state=None, tol=0.0001, verbose=0)" 127 | ] 128 | }, 129 | "execution_count": 4, 130 | "metadata": {}, 131 | "output_type": "execute_result" 132 | } 133 | ], 134 | "source": [ 135 | "model = KMeans(n_clusters=3)\n", 136 | "model.fit(x)" 137 | ] 138 | }, 139 | { 140 | "cell_type": "code", 141 | "execution_count": 5, 142 | "metadata": { 143 | "ExecuteTime": { 144 | "end_time": "2018-07-17T10:19:40.179576Z", 145 | "start_time": "2018-07-17T10:19:40.173592Z" 146 | } 147 | }, 148 | "outputs": [ 149 | { 150 | "name": "stdout", 151 | "output_type": "stream", 152 | "text": [ 153 | "[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", 154 | " 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", 155 | " 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 2 2 2 0 2 2 2 2\n", 156 | " 2 2 0 0 2 2 2 2 0 2 0 2 0 2 2 0 0 2 2 2 2 2 0 2 2 2 2 0 2 2 2 0 2 2 2 0 2\n", 157 | " 2 0]\n", 158 | "[[5.9016129 2.7483871 4.39354839 1.43387097]\n", 159 | " [5.006 3.418 1.464 0.244 ]\n", 160 | " [6.85 3.07368421 5.74210526 2.07105263]]\n" 161 | ] 162 | } 163 | ], 164 | "source": [ 165 | "print(model.labels_)\n", 166 | "print(model.cluster_centers_)" 167 | ] 168 | }, 169 | { 170 | "cell_type": "code", 171 | "execution_count": 6, 172 | "metadata": { 173 | "ExecuteTime": { 174 | "end_time": "2018-07-17T10:19:41.279631Z", 175 | "start_time": "2018-07-17T10:19:41.099158Z" 176 | } 177 | }, 178 | "outputs": [ 179 | { 180 | "data": { 181 | "text/plain": [ 182 | "Text(0.5,1,'K Mean Classification')" 183 | ] 184 | }, 185 | "execution_count": 6, 186 | "metadata": {}, 187 | "output_type": "execute_result" 188 | }, 189 | { 190 | "data": { 191 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xl8VOX1+PHPmUkyWyAsCVsChEVEEJFdsQJCtVioWBesC4ob1VapWsW1+qu1tn61LlVb61q1orhQtNQNFVxxAbRuuODCIgooO0kIyZzfH88kZDKTZJJMmGRy3r7mZeaZ5957blrP3Dz33OcRVcUYY0x68aQ6AGOMMclnyd0YY9KQJXdjjElDltyNMSYNWXI3xpg0ZMndGGPSkCV30yqJyDgRWdOE+79DRH5X5f3ZIrJORLaLSMfIv3s3wXE/EpFxyd6vaXksuZu4RORrEflxlfe/EJFNIjI2Tt9xIqIiMrda++BI+6I9EHIMERkpIk+LyGYR2Sgib4vIqXvi2Kp6lqr+IRJHJnAjcJiqZqvqD5F/f9mYY4jIP0XkmmrHHaiqixqzX5MeLLmbOonIKcDtwCRVfbmGbhuA0SLSsUrbKcBnTR1fPCJyIPAS8DLQF+gInA0cnoJwOgN+4KMUHNu0UpbcTa1EZAbwF+AnqvpGLV1LgXnALyLbeYGpwEPV9tdfRBZErqQ/FZGpVT6bJCLvishWEVktIv+vymeFkb8CThGRVSLyvYhcXks81wP3q+p1qvq9OktVdWq8ziJyiYh8ISLbRORjEfl5lc/6isjLIrIlctw5kXYRkZtEZH3ks/dFZN/IZ/8UkWtEpB/waWRXm0XkpcjnKiJ9Iz8HROQvIrIysp/XRCQQ+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TG4hydR1dKWntgjJgBfJCOxQwtM7ukqssDJEOCt1EbScJFhjPeA9cACVW2x5wLcDMwCwqkOJEkUeF5ElorIjFQH00i9gQ3AfZFhs7tFJJTqoJLgF8DDydqZJfdmQESygSeA81R1a6rjaShVLVfV/XGTy40UkRY5bCYik4H1qro01bEk0UGqOhS36M6vI8ObLVUGMBT4u6oOAXYAMSvEtSSRoaUjgMeStU9L7ikWGZ9+AnhIVeemOp5kiPyJvAiYmOJQGuog4IjIOPUjwHgR+VdqQ2ocVV0b+fd64N+4RXhaqjXAmip/GT6OS/Yt2eHAMlVdl6wdWnJPochNyHuA5ap6Y6rjaQwRyRORdpGfA8CPgU9SG1XDqOqlqlqgqoW4P5VfUtWTUhxWg4lIKHLDnsjwxWFAi602U9XvgNUisnekaQLQ4ooQqjmeJA7JQIIThzUnIvIwMA7IFZE1wFWqek9qo2qwg4BpwAeRsWqAyyITtbU0XYH7I3f8PcCjqtriSwjTRGfg35GVLzOA2ar6bGpDarRzgYciwxlfAqemOJ4GE5EgcCjwy6Tut6WVQhpjjKmbDcsYY0wasuRujDFpyJK7McakIUvuxhiThiy5G2NMGrLkbowxaciSuzHGpKH/DxQtJJoQrnPCAAAAAElFTkSuQmCC\n", 192 | "text/plain": [ 193 | "
" 194 | ] 195 | }, 196 | "metadata": {}, 197 | "output_type": "display_data" 198 | } 199 | ], 200 | "source": [ 201 | "# Create a colormap\n", 202 | "colormap = np.array(['red', 'lime', 'black'])\n", 203 | " \n", 204 | "# Plot the Original Classifications\n", 205 | "plt.scatter(x.Petal_Length, x.Petal_Width, c=colormap[model.labels_])\n", 206 | " plt.title('K Mean Classification')" 207 | ] 208 | }, 209 | { 210 | "cell_type": "code", 211 | "execution_count": 7, 212 | "metadata": { 213 | "ExecuteTime": { 214 | "end_time": "2018-07-17T10:19:41.423248Z", 215 | "start_time": "2018-07-17T10:19:41.416765Z" 216 | } 217 | }, 218 | "outputs": [], 219 | "source": [ 220 | "predict = model.predict(x)" 221 | ] 222 | }, 223 | { 224 | "cell_type": "code", 225 | "execution_count": 8, 226 | "metadata": { 227 | "ExecuteTime": { 228 | "end_time": "2018-07-17T10:19:42.382162Z", 229 | "start_time": "2018-07-17T10:19:42.378195Z" 230 | } 231 | }, 232 | "outputs": [], 233 | "source": [ 234 | "Y = iris.target" 235 | ] 236 | }, 237 | { 238 | "cell_type": "code", 239 | "execution_count": 9, 240 | "metadata": { 241 | "ExecuteTime": { 242 | "end_time": "2018-07-17T10:19:43.651757Z", 243 | "start_time": "2018-07-17T10:19:43.645806Z" 244 | } 245 | }, 246 | "outputs": [], 247 | "source": [ 248 | "from scipy.stats import mode\n", 249 | "labels = np.zeros_like(predict)\n", 250 | "for i in range(3):\n", 251 | " mask = (predict==i)\n", 252 | " labels[mask] = mode(Y[mask])[0]" 253 | ] 254 | }, 255 | { 256 | "cell_type": "code", 257 | "execution_count": 10, 258 | "metadata": { 259 | "ExecuteTime": { 260 | "end_time": "2018-07-17T10:19:44.060673Z", 261 | "start_time": "2018-07-17T10:19:44.054680Z" 262 | } 263 | }, 264 | "outputs": [ 265 | { 266 | "data": { 267 | "text/plain": [ 268 | "0.8933333333333333" 269 | ] 270 | }, 271 | "execution_count": 10, 272 | "metadata": {}, 273 | "output_type": "execute_result" 274 | } 275 | ], 276 | "source": [ 277 | "from sklearn.metrics import confusion_matrix, accuracy_score\n", 278 | "accuracy_score(Y, labels)" 279 | ] 280 | }, 281 | { 282 | "cell_type": "code", 283 | "execution_count": 11, 284 | "metadata": { 285 | "ExecuteTime": { 286 | "end_time": "2018-07-17T10:19:45.765142Z", 287 | "start_time": "2018-07-17T10:19:45.757126Z" 288 | } 289 | }, 290 | "outputs": [ 291 | { 292 | "data": { 293 | "text/plain": [ 294 | "array([[50, 0, 0],\n", 295 | " [ 0, 48, 2],\n", 296 | " [ 0, 14, 36]], dtype=int64)" 297 | ] 298 | }, 299 | "execution_count": 11, 300 | "metadata": {}, 301 | "output_type": "execute_result" 302 | } 303 | ], 304 | "source": [ 305 | "confusion_matrix(Y, labels)" 306 | ] 307 | } 308 | ], 309 | "metadata": { 310 | "kernelspec": { 311 | "display_name": "Python 3", 312 | "language": "python", 313 | "name": "python3" 314 | }, 315 | "language_info": { 316 | "codemirror_mode": { 317 | "name": "ipython", 318 | "version": 3 319 | }, 320 | "file_extension": ".py", 321 | "mimetype": "text/x-python", 322 | "name": "python", 323 | "nbconvert_exporter": "python", 324 | "pygments_lexer": "ipython3", 325 | "version": "3.6.5" 326 | }, 327 | "toc": { 328 | "nav_menu": {}, 329 | "number_sections": true, 330 | "sideBar": true, 331 | "skip_h1_title": false, 332 | "title_cell": "Table of Contents", 333 | "title_sidebar": "Contents", 334 | "toc_cell": false, 335 | "toc_position": {}, 336 | "toc_section_display": true, 337 | "toc_window_display": false 338 | }, 339 | "varInspector": { 340 | "cols": { 341 | "lenName": 16, 342 | "lenType": 16, 343 | "lenVar": 40 344 | }, 345 | "kernels_config": { 346 | "python": { 347 | "delete_cmd_postfix": "", 348 | "delete_cmd_prefix": "del ", 349 | "library": "var_list.py", 350 | "varRefreshCmd": "print(var_dic_list())" 351 | }, 352 | "r": { 353 | "delete_cmd_postfix": ") ", 354 | "delete_cmd_prefix": "rm(", 355 | "library": "var_list.r", 356 | "varRefreshCmd": "cat(var_dic_list()) " 357 | } 358 | }, 359 | "types_to_exclude": [ 360 | "module", 361 | "function", 362 | "builtin_function_or_method", 363 | "instance", 364 | "_Feature" 365 | ], 366 | "window_display": false 367 | } 368 | }, 369 | "nbformat": 4, 370 | "nbformat_minor": 2 371 | } 372 | -------------------------------------------------------------------------------- /18. Clustering - K Means/img/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/0.jpg -------------------------------------------------------------------------------- /18. Clustering - K Means/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/1.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/2.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/3.jpg -------------------------------------------------------------------------------- /18. Clustering - K Means/img/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/4.jpg -------------------------------------------------------------------------------- /18. Clustering - K Means/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/5.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/6.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/7.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/8.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/9.png -------------------------------------------------------------------------------- /18. Clustering - K Means/img/Algo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/18. Clustering - K Means/img/Algo.jpg -------------------------------------------------------------------------------- /19. Deep Learning/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/1.png -------------------------------------------------------------------------------- /19. Deep Learning/10.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/10.jpeg -------------------------------------------------------------------------------- /19. Deep Learning/11.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/11.jpeg -------------------------------------------------------------------------------- /19. Deep Learning/12.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/12.PNG -------------------------------------------------------------------------------- /19. Deep Learning/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/2.png -------------------------------------------------------------------------------- /19. Deep Learning/3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/3.jpeg -------------------------------------------------------------------------------- /19. Deep Learning/4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/4.jpeg -------------------------------------------------------------------------------- /19. Deep Learning/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/5.jpg -------------------------------------------------------------------------------- /19. Deep Learning/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/6.jpg -------------------------------------------------------------------------------- /19. Deep Learning/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/7.png -------------------------------------------------------------------------------- /19. Deep Learning/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/8.png -------------------------------------------------------------------------------- /19. Deep Learning/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/19. Deep Learning/9.jpg -------------------------------------------------------------------------------- /20. Extras/Missing_values, Duplicates, Word_cloud/spam.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/20. Extras/Missing_values, Duplicates, Word_cloud/spam.csv -------------------------------------------------------------------------------- /20. Extras/Resources/Contents.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/20. Extras/Resources/Contents.pdf -------------------------------------------------------------------------------- /20. Extras/Resources/Make Your Own Neural Network (Tariq Rashid) - {CHB Books}.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/20. Extras/Resources/Make Your Own Neural Network (Tariq Rashid) - {CHB Books}.pdf -------------------------------------------------------------------------------- /20. Extras/Resources/seven_databases_in_seven_weeks_Database.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/20. Extras/Resources/seven_databases_in_seven_weeks_Database.pdf -------------------------------------------------------------------------------- /20. Extras/Write Equations in IPython Notebook.txt: -------------------------------------------------------------------------------- 1 | Please refer these links, to write the equations in python notebook 2 | https://stackoverflow.com/questions/13208286/how-to-write-latex-in-ipython-notebook 3 | http://nbviewer.jupyter.org/github/ipython/ipython/blob/2.x/examples/Notebook/Display%20System.ipynb#LaTeX -------------------------------------------------------------------------------- /3. Probability/prob.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Probability" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "### Random Experiment, Sample Space, Event" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "### Axioms of Probability" 22 | ] 23 | }, 24 | { 25 | "cell_type": "markdown", 26 | "metadata": {}, 27 | "source": [ 28 | "### Conditional Probability & Independence" 29 | ] 30 | }, 31 | { 32 | "cell_type": "markdown", 33 | "metadata": {}, 34 | "source": [ 35 | "### Random Variable (Discrete and Continuous)" 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": {}, 41 | "source": [ 42 | "## Gaussian/Normal Distribution" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "### PDF & CDF" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "https://en.wikipedia.org/wiki/Normal_distribution\n", 57 | "\n", 58 | "https://en.wikipedia.org/wiki/Standard_deviation" 59 | ] 60 | }, 61 | { 62 | "cell_type": "markdown", 63 | "metadata": {}, 64 | "source": [ 65 | "## Bayes Theorem" 66 | ] 67 | } 68 | ], 69 | "metadata": { 70 | "kernelspec": { 71 | "display_name": "Python 3", 72 | "language": "python", 73 | "name": "python3" 74 | }, 75 | "language_info": { 76 | "codemirror_mode": { 77 | "name": "ipython", 78 | "version": 3 79 | }, 80 | "file_extension": ".py", 81 | "mimetype": "text/x-python", 82 | "name": "python", 83 | "nbconvert_exporter": "python", 84 | "pygments_lexer": "ipython3", 85 | "version": "3.6.5" 86 | }, 87 | "toc": { 88 | "nav_menu": {}, 89 | "number_sections": true, 90 | "sideBar": true, 91 | "skip_h1_title": false, 92 | "title_cell": "Table of Contents", 93 | "title_sidebar": "Contents", 94 | "toc_cell": false, 95 | "toc_position": {}, 96 | "toc_section_display": true, 97 | "toc_window_display": false 98 | }, 99 | "varInspector": { 100 | "cols": { 101 | "lenName": 16, 102 | "lenType": 16, 103 | "lenVar": 40 104 | }, 105 | "kernels_config": { 106 | "python": { 107 | "delete_cmd_postfix": "", 108 | "delete_cmd_prefix": "del ", 109 | "library": "var_list.py", 110 | "varRefreshCmd": "print(var_dic_list())" 111 | }, 112 | "r": { 113 | "delete_cmd_postfix": ") ", 114 | "delete_cmd_prefix": "rm(", 115 | "library": "var_list.r", 116 | "varRefreshCmd": "cat(var_dic_list()) " 117 | } 118 | }, 119 | "types_to_exclude": [ 120 | "module", 121 | "function", 122 | "builtin_function_or_method", 123 | "instance", 124 | "_Feature" 125 | ], 126 | "window_display": false 127 | } 128 | }, 129 | "nbformat": 4, 130 | "nbformat_minor": 2 131 | } 132 | -------------------------------------------------------------------------------- /4. Pandas - 1/data/Iris.csv: -------------------------------------------------------------------------------- 1 | Id,SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm,Species 2 | 1,5.1,3.5,1.4,0.2,Iris-setosa 3 | 2,4.9,3.0,1.4,0.2,Iris-setosa 4 | 3,4.7,3.2,1.3,0.2,Iris-setosa 5 | 4,4.6,3.1,1.5,0.2,Iris-setosa 6 | 5,5.0,3.6,1.4,0.2,Iris-setosa 7 | 6,5.4,3.9,1.7,0.4,Iris-setosa 8 | 7,4.6,3.4,1.4,0.3,Iris-setosa 9 | 8,5.0,3.4,1.5,0.2,Iris-setosa 10 | 9,4.4,2.9,1.4,0.2,Iris-setosa 11 | 10,4.9,3.1,1.5,0.1,Iris-setosa 12 | 11,5.4,3.7,1.5,0.2,Iris-setosa 13 | 12,4.8,3.4,1.6,0.2,Iris-setosa 14 | 13,4.8,3.0,1.4,0.1,Iris-setosa 15 | 14,4.3,3.0,1.1,0.1,Iris-setosa 16 | 15,5.8,4.0,1.2,0.2,Iris-setosa 17 | 16,5.7,4.4,1.5,0.4,Iris-setosa 18 | 17,5.4,3.9,1.3,0.4,Iris-setosa 19 | 18,5.1,3.5,1.4,0.3,Iris-setosa 20 | 19,5.7,3.8,1.7,0.3,Iris-setosa 21 | 20,5.1,3.8,1.5,0.3,Iris-setosa 22 | 21,5.4,3.4,1.7,0.2,Iris-setosa 23 | 22,5.1,3.7,1.5,0.4,Iris-setosa 24 | 23,4.6,3.6,1.0,0.2,Iris-setosa 25 | 24,5.1,3.3,1.7,0.5,Iris-setosa 26 | 25,4.8,3.4,1.9,0.2,Iris-setosa 27 | 26,5.0,3.0,1.6,0.2,Iris-setosa 28 | 27,5.0,3.4,1.6,0.4,Iris-setosa 29 | 28,5.2,3.5,1.5,0.2,Iris-setosa 30 | 29,5.2,3.4,1.4,0.2,Iris-setosa 31 | 30,4.7,3.2,1.6,0.2,Iris-setosa 32 | 31,4.8,3.1,1.6,0.2,Iris-setosa 33 | 32,5.4,3.4,1.5,0.4,Iris-setosa 34 | 33,5.2,4.1,1.5,0.1,Iris-setosa 35 | 34,5.5,4.2,1.4,0.2,Iris-setosa 36 | 35,4.9,3.1,1.5,0.1,Iris-setosa 37 | 36,5.0,3.2,1.2,0.2,Iris-setosa 38 | 37,5.5,3.5,1.3,0.2,Iris-setosa 39 | 38,4.9,3.1,1.5,0.1,Iris-setosa 40 | 39,4.4,3.0,1.3,0.2,Iris-setosa 41 | 40,5.1,3.4,1.5,0.2,Iris-setosa 42 | 41,5.0,3.5,1.3,0.3,Iris-setosa 43 | 42,4.5,2.3,1.3,0.3,Iris-setosa 44 | 43,4.4,3.2,1.3,0.2,Iris-setosa 45 | 44,5.0,3.5,1.6,0.6,Iris-setosa 46 | 45,5.1,3.8,1.9,0.4,Iris-setosa 47 | 46,4.8,3.0,1.4,0.3,Iris-setosa 48 | 47,5.1,3.8,1.6,0.2,Iris-setosa 49 | 48,4.6,3.2,1.4,0.2,Iris-setosa 50 | 49,5.3,3.7,1.5,0.2,Iris-setosa 51 | 50,5.0,3.3,1.4,0.2,Iris-setosa 52 | 51,7.0,3.2,4.7,1.4,Iris-versicolor 53 | 52,6.4,3.2,4.5,1.5,Iris-versicolor 54 | 53,6.9,3.1,4.9,1.5,Iris-versicolor 55 | 54,5.5,2.3,4.0,1.3,Iris-versicolor 56 | 55,6.5,2.8,4.6,1.5,Iris-versicolor 57 | 56,5.7,2.8,4.5,1.3,Iris-versicolor 58 | 57,6.3,3.3,4.7,1.6,Iris-versicolor 59 | 58,4.9,2.4,3.3,1.0,Iris-versicolor 60 | 59,6.6,2.9,4.6,1.3,Iris-versicolor 61 | 60,5.2,2.7,3.9,1.4,Iris-versicolor 62 | 61,5.0,2.0,3.5,1.0,Iris-versicolor 63 | 62,5.9,3.0,4.2,1.5,Iris-versicolor 64 | 63,6.0,2.2,4.0,1.0,Iris-versicolor 65 | 64,6.1,2.9,4.7,1.4,Iris-versicolor 66 | 65,5.6,2.9,3.6,1.3,Iris-versicolor 67 | 66,6.7,3.1,4.4,1.4,Iris-versicolor 68 | 67,5.6,3.0,4.5,1.5,Iris-versicolor 69 | 68,5.8,2.7,4.1,1.0,Iris-versicolor 70 | 69,6.2,2.2,4.5,1.5,Iris-versicolor 71 | 70,5.6,2.5,3.9,1.1,Iris-versicolor 72 | 71,5.9,3.2,4.8,1.8,Iris-versicolor 73 | 72,6.1,2.8,4.0,1.3,Iris-versicolor 74 | 73,6.3,2.5,4.9,1.5,Iris-versicolor 75 | 74,6.1,2.8,4.7,1.2,Iris-versicolor 76 | 75,6.4,2.9,4.3,1.3,Iris-versicolor 77 | 76,6.6,3.0,4.4,1.4,Iris-versicolor 78 | 77,6.8,2.8,4.8,1.4,Iris-versicolor 79 | 78,6.7,3.0,5.0,1.7,Iris-versicolor 80 | 79,6.0,2.9,4.5,1.5,Iris-versicolor 81 | 80,5.7,2.6,3.5,1.0,Iris-versicolor 82 | 81,5.5,2.4,3.8,1.1,Iris-versicolor 83 | 82,5.5,2.4,3.7,1.0,Iris-versicolor 84 | 83,5.8,2.7,3.9,1.2,Iris-versicolor 85 | 84,6.0,2.7,5.1,1.6,Iris-versicolor 86 | 85,5.4,3.0,4.5,1.5,Iris-versicolor 87 | 86,6.0,3.4,4.5,1.6,Iris-versicolor 88 | 87,6.7,3.1,4.7,1.5,Iris-versicolor 89 | 88,6.3,2.3,4.4,1.3,Iris-versicolor 90 | 89,5.6,3.0,4.1,1.3,Iris-versicolor 91 | 90,5.5,2.5,4.0,1.3,Iris-versicolor 92 | 91,5.5,2.6,4.4,1.2,Iris-versicolor 93 | 92,6.1,3.0,4.6,1.4,Iris-versicolor 94 | 93,5.8,2.6,4.0,1.2,Iris-versicolor 95 | 94,5.0,2.3,3.3,1.0,Iris-versicolor 96 | 95,5.6,2.7,4.2,1.3,Iris-versicolor 97 | 96,5.7,3.0,4.2,1.2,Iris-versicolor 98 | 97,5.7,2.9,4.2,1.3,Iris-versicolor 99 | 98,6.2,2.9,4.3,1.3,Iris-versicolor 100 | 99,5.1,2.5,3.0,1.1,Iris-versicolor 101 | 100,5.7,2.8,4.1,1.3,Iris-versicolor 102 | 101,6.3,3.3,6.0,2.5,Iris-virginica 103 | 102,5.8,2.7,5.1,1.9,Iris-virginica 104 | 103,7.1,3.0,5.9,2.1,Iris-virginica 105 | 104,6.3,2.9,5.6,1.8,Iris-virginica 106 | 105,6.5,3.0,5.8,2.2,Iris-virginica 107 | 106,7.6,3.0,6.6,2.1,Iris-virginica 108 | 107,4.9,2.5,4.5,1.7,Iris-virginica 109 | 108,7.3,2.9,6.3,1.8,Iris-virginica 110 | 109,6.7,2.5,5.8,1.8,Iris-virginica 111 | 110,7.2,3.6,6.1,2.5,Iris-virginica 112 | 111,6.5,3.2,5.1,2.0,Iris-virginica 113 | 112,6.4,2.7,5.3,1.9,Iris-virginica 114 | 113,6.8,3.0,5.5,2.1,Iris-virginica 115 | 114,5.7,2.5,5.0,2.0,Iris-virginica 116 | 115,5.8,2.8,5.1,2.4,Iris-virginica 117 | 116,6.4,3.2,5.3,2.3,Iris-virginica 118 | 117,6.5,3.0,5.5,1.8,Iris-virginica 119 | 118,7.7,3.8,6.7,2.2,Iris-virginica 120 | 119,7.7,2.6,6.9,2.3,Iris-virginica 121 | 120,6.0,2.2,5.0,1.5,Iris-virginica 122 | 121,6.9,3.2,5.7,2.3,Iris-virginica 123 | 122,5.6,2.8,4.9,2.0,Iris-virginica 124 | 123,7.7,2.8,6.7,2.0,Iris-virginica 125 | 124,6.3,2.7,4.9,1.8,Iris-virginica 126 | 125,6.7,3.3,5.7,2.1,Iris-virginica 127 | 126,7.2,3.2,6.0,1.8,Iris-virginica 128 | 127,6.2,2.8,4.8,1.8,Iris-virginica 129 | 128,6.1,3.0,4.9,1.8,Iris-virginica 130 | 129,6.4,2.8,5.6,2.1,Iris-virginica 131 | 130,7.2,3.0,5.8,1.6,Iris-virginica 132 | 131,7.4,2.8,6.1,1.9,Iris-virginica 133 | 132,7.9,3.8,6.4,2.0,Iris-virginica 134 | 133,6.4,2.8,5.6,2.2,Iris-virginica 135 | 134,6.3,2.8,5.1,1.5,Iris-virginica 136 | 135,6.1,2.6,5.6,1.4,Iris-virginica 137 | 136,7.7,3.0,6.1,2.3,Iris-virginica 138 | 137,6.3,3.4,5.6,2.4,Iris-virginica 139 | 138,6.4,3.1,5.5,1.8,Iris-virginica 140 | 139,6.0,3.0,4.8,1.8,Iris-virginica 141 | 140,6.9,3.1,5.4,2.1,Iris-virginica 142 | 141,6.7,3.1,5.6,2.4,Iris-virginica 143 | 142,6.9,3.1,5.1,2.3,Iris-virginica 144 | 143,5.8,2.7,5.1,1.9,Iris-virginica 145 | 144,6.8,3.2,5.9,2.3,Iris-virginica 146 | 145,6.7,3.3,5.7,2.5,Iris-virginica 147 | 146,6.7,3.0,5.2,2.3,Iris-virginica 148 | 147,6.3,2.5,5.0,1.9,Iris-virginica 149 | 148,6.5,3.0,5.2,2.0,Iris-virginica 150 | 149,6.2,3.4,5.4,2.3,Iris-virginica 151 | 150,5.9,3.0,5.1,1.8,Iris-virginica 152 | -------------------------------------------------------------------------------- /4. Pandas - 1/data/nyc_weather.csv: -------------------------------------------------------------------------------- 1 | EST,Temperature,DewPoint,Humidity,Sea Level PressureIn,VisibilityMiles,WindSpeedMPH,PrecipitationIn,CloudCover,Events,WindDirDegrees 2 | 1/1/2016,38,23,52,30.03,10,8,0,5,,281 3 | 1/2/2016,36,18,46,30.02,10,7,0,3,,275 4 | 1/3/2016,40,21,47,29.86,10,8,0,1,,277 5 | 1/4/2016,25,9,44,30.05,10,9,0,3,,345 6 | 1/5/2016,20,-3,41,30.57,10,5,0,0,,333 7 | 1/6/2016,33,4,35,30.5,10,4,0,0,,259 8 | 1/7/2016,39,11,33,30.28,10,2,0,3,,293 9 | 1/8/2016,39,29,64,30.2,10,4,0,8,,79 10 | 1/9/2016,44,38,77,30.16,9,8,T,8,Rain,76 11 | 1/10/2016,50,46,71,29.59,4,,1.8,7,Rain,109 12 | 1/11/2016,33,8,37,29.92,10,,0,1,,289 13 | 1/12/2016,35,15,53,29.85,10,6,T,4,,235 14 | 1/13/2016,26,4,42,29.94,10,10,0,0,,284 15 | 1/14/2016,30,12,47,29.95,10,5,T,7,,266 16 | 1/15/2016,43,31,62,29.82,9,5,T,2,,101 17 | 1/16/2016,47,37,70,29.52,8,7,0.24,7,Rain,340 18 | 1/17/2016,36,23,66,29.78,8,6,0.05,6,Fog-Snow,345 19 | 1/18/2016,25,6,53,29.83,9,12,T,2,Snow,293 20 | 1/19/2016,22,3,42,30.03,10,11,0,1,,293 21 | 1/20/2016,32,15,49,30.13,10,6,0,2,,302 22 | 1/21/2016,31,11,45,30.15,10,6,0,1,,312 23 | 1/22/2016,26,6,41,30.21,9,,0.01,3,Snow,34 24 | 1/23/2016,26,21,78,29.77,1,16,2.31,8,Fog-Snow,42 25 | 1/24/2016,28,11,53,29.92,8,6,T,3,Snow,327 26 | 1/25/2016,34,18,54,30.25,10,3,0,2,,286 27 | 1/26/2016,43,29,56,30.03,10,7,0,2,,244 28 | 1/27/2016,41,22,45,30.03,10,7,T,3,Rain,311 29 | 1/28/2016,37,20,51,29.9,10,5,0,1,,234 30 | 1/29/2016,36,21,50,29.58,10,8,0,4,,298 31 | 1/30/2016,34,16,46,30.01,10,7,0,0,,257 32 | 1/31/2016,46,28,52,29.9,10,5,0,0,,241 33 | -------------------------------------------------------------------------------- /4. Pandas - 1/data/temp/new_excel_file.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/4. Pandas - 1/data/temp/new_excel_file.xlsx -------------------------------------------------------------------------------- /4. Pandas - 1/data/temp/new_excel_file_noIndex.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/4. Pandas - 1/data/temp/new_excel_file_noIndex.xlsx -------------------------------------------------------------------------------- /4. Pandas - 1/data/weather_data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/4. Pandas - 1/data/weather_data.xlsx -------------------------------------------------------------------------------- /4. Pandas - 1/image/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/4. Pandas - 1/image/1.jpg -------------------------------------------------------------------------------- /9. Feature Engineering/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/9. Feature Engineering/1.png -------------------------------------------------------------------------------- /9. Feature Engineering/image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/9. Feature Engineering/image/1.png -------------------------------------------------------------------------------- /Case Studies/Car Price Prediction/1.1. CarPrice_Data.csv: -------------------------------------------------------------------------------- 1 | car_ID,symboling,CarName,fueltype,aspiration,doornumber,carbody,drivewheel,enginelocation,wheelbase,carlength,carwidth,carheight,curbweight,enginetype,cylindernumber,enginesize,fuelsystem,boreratio,stroke,compressionratio,horsepower,peakrpm,citympg,highwaympg,price 2 | 1,3,alfa-romero giulia,gas,std,two,convertible,rwd,front,88.6,168.8,64.1,48.8,2548,dohc,four,130,mpfi,3.47,2.68,9,111,5000,21,27,13495 3 | 2,3,alfa-romero stelvio,gas,std,two,convertible,rwd,front,88.6,168.8,64.1,48.8,2548,dohc,four,130,mpfi,3.47,2.68,9,111,5000,21,27,16500 4 | 3,1,alfa-romero Quadrifoglio,gas,std,two,hatchback,rwd,front,94.5,171.2,65.5,52.4,2823,ohcv,six,152,mpfi,2.68,3.47,9,154,5000,19,26,16500 5 | 4,2,audi 100 ls,gas,std,four,sedan,fwd,front,99.8,176.6,66.2,54.3,2337,ohc,four,109,mpfi,3.19,3.4,10,102,5500,24,30,13950 6 | 5,2,audi 100ls,gas,std,four,sedan,4wd,front,99.4,176.6,66.4,54.3,2824,ohc,five,136,mpfi,3.19,3.4,8,115,5500,18,22,17450 7 | 6,2,audi fox,gas,std,two,sedan,fwd,front,99.8,177.3,66.3,53.1,2507,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,25,15250 8 | 7,1,audi 100ls,gas,std,four,sedan,fwd,front,105.8,192.7,71.4,55.7,2844,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,25,17710 9 | 8,1,audi 5000,gas,std,four,wagon,fwd,front,105.8,192.7,71.4,55.7,2954,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,25,18920 10 | 9,1,audi 4000,gas,turbo,four,sedan,fwd,front,105.8,192.7,71.4,55.9,3086,ohc,five,131,mpfi,3.13,3.4,8.3,140,5500,17,20,23875 11 | 10,0,audi 5000s (diesel),gas,turbo,two,hatchback,4wd,front,99.5,178.2,67.9,52,3053,ohc,five,131,mpfi,3.13,3.4,7,160,5500,16,22,17859.167 12 | 11,2,bmw 320i,gas,std,two,sedan,rwd,front,101.2,176.8,64.8,54.3,2395,ohc,four,108,mpfi,3.5,2.8,8.8,101,5800,23,29,16430 13 | 12,0,bmw 320i,gas,std,four,sedan,rwd,front,101.2,176.8,64.8,54.3,2395,ohc,four,108,mpfi,3.5,2.8,8.8,101,5800,23,29,16925 14 | 13,0,bmw x1,gas,std,two,sedan,rwd,front,101.2,176.8,64.8,54.3,2710,ohc,six,164,mpfi,3.31,3.19,9,121,4250,21,28,20970 15 | 14,0,bmw x3,gas,std,four,sedan,rwd,front,101.2,176.8,64.8,54.3,2765,ohc,six,164,mpfi,3.31,3.19,9,121,4250,21,28,21105 16 | 15,1,bmw z4,gas,std,four,sedan,rwd,front,103.5,189,66.9,55.7,3055,ohc,six,164,mpfi,3.31,3.19,9,121,4250,20,25,24565 17 | 16,0,bmw x4,gas,std,four,sedan,rwd,front,103.5,189,66.9,55.7,3230,ohc,six,209,mpfi,3.62,3.39,8,182,5400,16,22,30760 18 | 17,0,bmw x5,gas,std,two,sedan,rwd,front,103.5,193.8,67.9,53.7,3380,ohc,six,209,mpfi,3.62,3.39,8,182,5400,16,22,41315 19 | 18,0,bmw x3,gas,std,four,sedan,rwd,front,110,197,70.9,56.3,3505,ohc,six,209,mpfi,3.62,3.39,8,182,5400,15,20,36880 20 | 19,2,chevrolet impala,gas,std,two,hatchback,fwd,front,88.4,141.1,60.3,53.2,1488,l,three,61,2bbl,2.91,3.03,9.5,48,5100,47,53,5151 21 | 20,1,chevrolet monte carlo,gas,std,two,hatchback,fwd,front,94.5,155.9,63.6,52,1874,ohc,four,90,2bbl,3.03,3.11,9.6,70,5400,38,43,6295 22 | 21,0,chevrolet vega 2300,gas,std,four,sedan,fwd,front,94.5,158.8,63.6,52,1909,ohc,four,90,2bbl,3.03,3.11,9.6,70,5400,38,43,6575 23 | 22,1,dodge rampage,gas,std,two,hatchback,fwd,front,93.7,157.3,63.8,50.8,1876,ohc,four,90,2bbl,2.97,3.23,9.41,68,5500,37,41,5572 24 | 23,1,dodge challenger se,gas,std,two,hatchback,fwd,front,93.7,157.3,63.8,50.8,1876,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,31,38,6377 25 | 24,1,dodge d200,gas,turbo,two,hatchback,fwd,front,93.7,157.3,63.8,50.8,2128,ohc,four,98,mpfi,3.03,3.39,7.6,102,5500,24,30,7957 26 | 25,1,dodge monaco (sw),gas,std,four,hatchback,fwd,front,93.7,157.3,63.8,50.6,1967,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,31,38,6229 27 | 26,1,dodge colt hardtop,gas,std,four,sedan,fwd,front,93.7,157.3,63.8,50.6,1989,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,31,38,6692 28 | 27,1,dodge colt (sw),gas,std,four,sedan,fwd,front,93.7,157.3,63.8,50.6,1989,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,31,38,7609 29 | 28,1,dodge coronet custom,gas,turbo,two,sedan,fwd,front,93.7,157.3,63.8,50.6,2191,ohc,four,98,mpfi,3.03,3.39,7.6,102,5500,24,30,8558 30 | 29,-1,dodge dart custom,gas,std,four,wagon,fwd,front,103.3,174.6,64.6,59.8,2535,ohc,four,122,2bbl,3.34,3.46,8.5,88,5000,24,30,8921 31 | 30,3,dodge coronet custom (sw),gas,turbo,two,hatchback,fwd,front,95.9,173.2,66.3,50.2,2811,ohc,four,156,mfi,3.6,3.9,7,145,5000,19,24,12964 32 | 31,2,honda civic,gas,std,two,hatchback,fwd,front,86.6,144.6,63.9,50.8,1713,ohc,four,92,1bbl,2.91,3.41,9.6,58,4800,49,54,6479 33 | 32,2,honda civic cvcc,gas,std,two,hatchback,fwd,front,86.6,144.6,63.9,50.8,1819,ohc,four,92,1bbl,2.91,3.41,9.2,76,6000,31,38,6855 34 | 33,1,honda civic,gas,std,two,hatchback,fwd,front,93.7,150,64,52.6,1837,ohc,four,79,1bbl,2.91,3.07,10.1,60,5500,38,42,5399 35 | 34,1,honda accord cvcc,gas,std,two,hatchback,fwd,front,93.7,150,64,52.6,1940,ohc,four,92,1bbl,2.91,3.41,9.2,76,6000,30,34,6529 36 | 35,1,honda civic cvcc,gas,std,two,hatchback,fwd,front,93.7,150,64,52.6,1956,ohc,four,92,1bbl,2.91,3.41,9.2,76,6000,30,34,7129 37 | 36,0,honda accord lx,gas,std,four,sedan,fwd,front,96.5,163.4,64,54.5,2010,ohc,four,92,1bbl,2.91,3.41,9.2,76,6000,30,34,7295 38 | 37,0,honda civic 1500 gl,gas,std,four,wagon,fwd,front,96.5,157.1,63.9,58.3,2024,ohc,four,92,1bbl,2.92,3.41,9.2,76,6000,30,34,7295 39 | 38,0,honda accord,gas,std,two,hatchback,fwd,front,96.5,167.5,65.2,53.3,2236,ohc,four,110,1bbl,3.15,3.58,9,86,5800,27,33,7895 40 | 39,0,honda civic 1300,gas,std,two,hatchback,fwd,front,96.5,167.5,65.2,53.3,2289,ohc,four,110,1bbl,3.15,3.58,9,86,5800,27,33,9095 41 | 40,0,honda prelude,gas,std,four,sedan,fwd,front,96.5,175.4,65.2,54.1,2304,ohc,four,110,1bbl,3.15,3.58,9,86,5800,27,33,8845 42 | 41,0,honda accord,gas,std,four,sedan,fwd,front,96.5,175.4,62.5,54.1,2372,ohc,four,110,1bbl,3.15,3.58,9,86,5800,27,33,10295 43 | 42,0,honda civic,gas,std,four,sedan,fwd,front,96.5,175.4,65.2,54.1,2465,ohc,four,110,mpfi,3.15,3.58,9,101,5800,24,28,12945 44 | 43,1,honda civic (auto),gas,std,two,sedan,fwd,front,96.5,169.1,66,51,2293,ohc,four,110,2bbl,3.15,3.58,9.1,100,5500,25,31,10345 45 | 44,0,isuzu MU-X,gas,std,four,sedan,rwd,front,94.3,170.7,61.8,53.5,2337,ohc,four,111,2bbl,3.31,3.23,8.5,78,4800,24,29,6785 46 | 45,1,isuzu D-Max ,gas,std,two,sedan,fwd,front,94.5,155.9,63.6,52,1874,ohc,four,90,2bbl,3.03,3.11,9.6,70,5400,38,43,8916.5 47 | 46,0,isuzu D-Max V-Cross,gas,std,four,sedan,fwd,front,94.5,155.9,63.6,52,1909,ohc,four,90,2bbl,3.03,3.11,9.6,70,5400,38,43,8916.5 48 | 47,2,isuzu D-Max ,gas,std,two,hatchback,rwd,front,96,172.6,65.2,51.4,2734,ohc,four,119,spfi,3.43,3.23,9.2,90,5000,24,29,11048 49 | 48,0,jaguar xj,gas,std,four,sedan,rwd,front,113,199.6,69.6,52.8,4066,dohc,six,258,mpfi,3.63,4.17,8.1,176,4750,15,19,32250 50 | 49,0,jaguar xf,gas,std,four,sedan,rwd,front,113,199.6,69.6,52.8,4066,dohc,six,258,mpfi,3.63,4.17,8.1,176,4750,15,19,35550 51 | 50,0,jaguar xk,gas,std,two,sedan,rwd,front,102,191.7,70.6,47.8,3950,ohcv,twelve,326,mpfi,3.54,2.76,11.5,262,5000,13,17,36000 52 | 51,1,maxda rx3,gas,std,two,hatchback,fwd,front,93.1,159.1,64.2,54.1,1890,ohc,four,91,2bbl,3.03,3.15,9,68,5000,30,31,5195 53 | 52,1,maxda glc deluxe,gas,std,two,hatchback,fwd,front,93.1,159.1,64.2,54.1,1900,ohc,four,91,2bbl,3.03,3.15,9,68,5000,31,38,6095 54 | 53,1,mazda rx2 coupe,gas,std,two,hatchback,fwd,front,93.1,159.1,64.2,54.1,1905,ohc,four,91,2bbl,3.03,3.15,9,68,5000,31,38,6795 55 | 54,1,mazda rx-4,gas,std,four,sedan,fwd,front,93.1,166.8,64.2,54.1,1945,ohc,four,91,2bbl,3.03,3.15,9,68,5000,31,38,6695 56 | 55,1,mazda glc deluxe,gas,std,four,sedan,fwd,front,93.1,166.8,64.2,54.1,1950,ohc,four,91,2bbl,3.08,3.15,9,68,5000,31,38,7395 57 | 56,3,mazda 626,gas,std,two,hatchback,rwd,front,95.3,169,65.7,49.6,2380,rotor,two,70,4bbl,3.33,3.255,9.4,101,6000,17,23,10945 58 | 57,3,mazda glc,gas,std,two,hatchback,rwd,front,95.3,169,65.7,49.6,2380,rotor,two,70,4bbl,3.33,3.255,9.4,101,6000,17,23,11845 59 | 58,3,mazda rx-7 gs,gas,std,two,hatchback,rwd,front,95.3,169,65.7,49.6,2385,rotor,two,70,4bbl,3.33,3.255,9.4,101,6000,17,23,13645 60 | 59,3,mazda glc 4,gas,std,two,hatchback,rwd,front,95.3,169,65.7,49.6,2500,rotor,two,80,mpfi,3.33,3.255,9.4,135,6000,16,23,15645 61 | 60,1,mazda 626,gas,std,two,hatchback,fwd,front,98.8,177.8,66.5,53.7,2385,ohc,four,122,2bbl,3.39,3.39,8.6,84,4800,26,32,8845 62 | 61,0,mazda glc custom l,gas,std,four,sedan,fwd,front,98.8,177.8,66.5,55.5,2410,ohc,four,122,2bbl,3.39,3.39,8.6,84,4800,26,32,8495 63 | 62,1,mazda glc custom,gas,std,two,hatchback,fwd,front,98.8,177.8,66.5,53.7,2385,ohc,four,122,2bbl,3.39,3.39,8.6,84,4800,26,32,10595 64 | 63,0,mazda rx-4,gas,std,four,sedan,fwd,front,98.8,177.8,66.5,55.5,2410,ohc,four,122,2bbl,3.39,3.39,8.6,84,4800,26,32,10245 65 | 64,0,mazda glc deluxe,diesel,std,four,sedan,fwd,front,98.8,177.8,66.5,55.5,2443,ohc,four,122,idi,3.39,3.39,22.7,64,4650,36,42,10795 66 | 65,0,mazda 626,gas,std,four,hatchback,fwd,front,98.8,177.8,66.5,55.5,2425,ohc,four,122,2bbl,3.39,3.39,8.6,84,4800,26,32,11245 67 | 66,0,mazda glc,gas,std,four,sedan,rwd,front,104.9,175,66.1,54.4,2670,ohc,four,140,mpfi,3.76,3.16,8,120,5000,19,27,18280 68 | 67,0,mazda rx-7 gs,diesel,std,four,sedan,rwd,front,104.9,175,66.1,54.4,2700,ohc,four,134,idi,3.43,3.64,22,72,4200,31,39,18344 69 | 68,-1,buick electra 225 custom,diesel,turbo,four,sedan,rwd,front,110,190.9,70.3,56.5,3515,ohc,five,183,idi,3.58,3.64,21.5,123,4350,22,25,25552 70 | 69,-1,buick century luxus (sw),diesel,turbo,four,wagon,rwd,front,110,190.9,70.3,58.7,3750,ohc,five,183,idi,3.58,3.64,21.5,123,4350,22,25,28248 71 | 70,0,buick century,diesel,turbo,two,hardtop,rwd,front,106.7,187.5,70.3,54.9,3495,ohc,five,183,idi,3.58,3.64,21.5,123,4350,22,25,28176 72 | 71,-1,buick skyhawk,diesel,turbo,four,sedan,rwd,front,115.6,202.6,71.7,56.3,3770,ohc,five,183,idi,3.58,3.64,21.5,123,4350,22,25,31600 73 | 72,-1,buick opel isuzu deluxe,gas,std,four,sedan,rwd,front,115.6,202.6,71.7,56.5,3740,ohcv,eight,234,mpfi,3.46,3.1,8.3,155,4750,16,18,34184 74 | 73,3,buick skylark,gas,std,two,convertible,rwd,front,96.6,180.3,70.5,50.8,3685,ohcv,eight,234,mpfi,3.46,3.1,8.3,155,4750,16,18,35056 75 | 74,0,buick century special,gas,std,four,sedan,rwd,front,120.9,208.1,71.7,56.7,3900,ohcv,eight,308,mpfi,3.8,3.35,8,184,4500,14,16,40960 76 | 75,1,buick regal sport coupe (turbo),gas,std,two,hardtop,rwd,front,112,199.2,72,55.4,3715,ohcv,eight,304,mpfi,3.8,3.35,8,184,4500,14,16,45400 77 | 76,1,mercury cougar,gas,turbo,two,hatchback,rwd,front,102.7,178.4,68,54.8,2910,ohc,four,140,mpfi,3.78,3.12,8,175,5000,19,24,16503 78 | 77,2,mitsubishi mirage,gas,std,two,hatchback,fwd,front,93.7,157.3,64.4,50.8,1918,ohc,four,92,2bbl,2.97,3.23,9.4,68,5500,37,41,5389 79 | 78,2,mitsubishi lancer,gas,std,two,hatchback,fwd,front,93.7,157.3,64.4,50.8,1944,ohc,four,92,2bbl,2.97,3.23,9.4,68,5500,31,38,6189 80 | 79,2,mitsubishi outlander,gas,std,two,hatchback,fwd,front,93.7,157.3,64.4,50.8,2004,ohc,four,92,2bbl,2.97,3.23,9.4,68,5500,31,38,6669 81 | 80,1,mitsubishi g4,gas,turbo,two,hatchback,fwd,front,93,157.3,63.8,50.8,2145,ohc,four,98,spdi,3.03,3.39,7.6,102,5500,24,30,7689 82 | 81,3,mitsubishi mirage g4,gas,turbo,two,hatchback,fwd,front,96.3,173,65.4,49.4,2370,ohc,four,110,spdi,3.17,3.46,7.5,116,5500,23,30,9959 83 | 82,3,mitsubishi g4,gas,std,two,hatchback,fwd,front,96.3,173,65.4,49.4,2328,ohc,four,122,2bbl,3.35,3.46,8.5,88,5000,25,32,8499 84 | 83,3,mitsubishi outlander,gas,turbo,two,hatchback,fwd,front,95.9,173.2,66.3,50.2,2833,ohc,four,156,spdi,3.58,3.86,7,145,5000,19,24,12629 85 | 84,3,mitsubishi g4,gas,turbo,two,hatchback,fwd,front,95.9,173.2,66.3,50.2,2921,ohc,four,156,spdi,3.59,3.86,7,145,5000,19,24,14869 86 | 85,3,mitsubishi mirage g4,gas,turbo,two,hatchback,fwd,front,95.9,173.2,66.3,50.2,2926,ohc,four,156,spdi,3.59,3.86,7,145,5000,19,24,14489 87 | 86,1,mitsubishi montero,gas,std,four,sedan,fwd,front,96.3,172.4,65.4,51.6,2365,ohc,four,122,2bbl,3.35,3.46,8.5,88,5000,25,32,6989 88 | 87,1,mitsubishi pajero,gas,std,four,sedan,fwd,front,96.3,172.4,65.4,51.6,2405,ohc,four,122,2bbl,3.35,3.46,8.5,88,5000,25,32,8189 89 | 88,1,mitsubishi outlander,gas,turbo,four,sedan,fwd,front,96.3,172.4,65.4,51.6,2403,ohc,four,110,spdi,3.17,3.46,7.5,116,5500,23,30,9279 90 | 89,-1,mitsubishi mirage g4,gas,std,four,sedan,fwd,front,96.3,172.4,65.4,51.6,2403,ohc,four,110,spdi,3.17,3.46,7.5,116,5500,23,30,9279 91 | 90,1,Nissan versa,gas,std,two,sedan,fwd,front,94.5,165.3,63.8,54.5,1889,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,5499 92 | 91,1,nissan gt-r,diesel,std,two,sedan,fwd,front,94.5,165.3,63.8,54.5,2017,ohc,four,103,idi,2.99,3.47,21.9,55,4800,45,50,7099 93 | 92,1,nissan rogue,gas,std,two,sedan,fwd,front,94.5,165.3,63.8,54.5,1918,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,6649 94 | 93,1,nissan latio,gas,std,four,sedan,fwd,front,94.5,165.3,63.8,54.5,1938,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,6849 95 | 94,1,nissan titan,gas,std,four,wagon,fwd,front,94.5,170.2,63.8,53.5,2024,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,7349 96 | 95,1,nissan leaf,gas,std,two,sedan,fwd,front,94.5,165.3,63.8,54.5,1951,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,7299 97 | 96,1,nissan juke,gas,std,two,hatchback,fwd,front,94.5,165.6,63.8,53.3,2028,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,7799 98 | 97,1,nissan latio,gas,std,four,sedan,fwd,front,94.5,165.3,63.8,54.5,1971,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,7499 99 | 98,1,nissan note,gas,std,four,wagon,fwd,front,94.5,170.2,63.8,53.5,2037,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,7999 100 | 99,2,nissan clipper,gas,std,two,hardtop,fwd,front,95.1,162.4,63.8,53.3,2008,ohc,four,97,2bbl,3.15,3.29,9.4,69,5200,31,37,8249 101 | 100,0,nissan rogue,gas,std,four,hatchback,fwd,front,97.2,173.4,65.2,54.7,2324,ohc,four,120,2bbl,3.33,3.47,8.5,97,5200,27,34,8949 102 | 101,0,nissan nv200,gas,std,four,sedan,fwd,front,97.2,173.4,65.2,54.7,2302,ohc,four,120,2bbl,3.33,3.47,8.5,97,5200,27,34,9549 103 | 102,0,nissan dayz,gas,std,four,sedan,fwd,front,100.4,181.7,66.5,55.1,3095,ohcv,six,181,mpfi,3.43,3.27,9,152,5200,17,22,13499 104 | 103,0,nissan fuga,gas,std,four,wagon,fwd,front,100.4,184.6,66.5,56.1,3296,ohcv,six,181,mpfi,3.43,3.27,9,152,5200,17,22,14399 105 | 104,0,nissan otti,gas,std,four,sedan,fwd,front,100.4,184.6,66.5,55.1,3060,ohcv,six,181,mpfi,3.43,3.27,9,152,5200,19,25,13499 106 | 105,3,nissan teana,gas,std,two,hatchback,rwd,front,91.3,170.7,67.9,49.7,3071,ohcv,six,181,mpfi,3.43,3.27,9,160,5200,19,25,17199 107 | 106,3,nissan kicks,gas,turbo,two,hatchback,rwd,front,91.3,170.7,67.9,49.7,3139,ohcv,six,181,mpfi,3.43,3.27,7.8,200,5200,17,23,19699 108 | 107,1,nissan clipper,gas,std,two,hatchback,rwd,front,99.2,178.5,67.9,49.7,3139,ohcv,six,181,mpfi,3.43,3.27,9,160,5200,19,25,18399 109 | 108,0,peugeot 504,gas,std,four,sedan,rwd,front,107.9,186.7,68.4,56.7,3020,l,four,120,mpfi,3.46,3.19,8.4,97,5000,19,24,11900 110 | 109,0,peugeot 304,diesel,turbo,four,sedan,rwd,front,107.9,186.7,68.4,56.7,3197,l,four,152,idi,3.7,3.52,21,95,4150,28,33,13200 111 | 110,0,peugeot 504 (sw),gas,std,four,wagon,rwd,front,114.2,198.9,68.4,58.7,3230,l,four,120,mpfi,3.46,3.19,8.4,97,5000,19,24,12440 112 | 111,0,peugeot 504,diesel,turbo,four,wagon,rwd,front,114.2,198.9,68.4,58.7,3430,l,four,152,idi,3.7,3.52,21,95,4150,25,25,13860 113 | 112,0,peugeot 504,gas,std,four,sedan,rwd,front,107.9,186.7,68.4,56.7,3075,l,four,120,mpfi,3.46,2.19,8.4,95,5000,19,24,15580 114 | 113,0,peugeot 604sl,diesel,turbo,four,sedan,rwd,front,107.9,186.7,68.4,56.7,3252,l,four,152,idi,3.7,3.52,21,95,4150,28,33,16900 115 | 114,0,peugeot 504,gas,std,four,wagon,rwd,front,114.2,198.9,68.4,56.7,3285,l,four,120,mpfi,3.46,2.19,8.4,95,5000,19,24,16695 116 | 115,0,peugeot 505s turbo diesel,diesel,turbo,four,wagon,rwd,front,114.2,198.9,68.4,58.7,3485,l,four,152,idi,3.7,3.52,21,95,4150,25,25,17075 117 | 116,0,peugeot 504,gas,std,four,sedan,rwd,front,107.9,186.7,68.4,56.7,3075,l,four,120,mpfi,3.46,3.19,8.4,97,5000,19,24,16630 118 | 117,0,peugeot 504,diesel,turbo,four,sedan,rwd,front,107.9,186.7,68.4,56.7,3252,l,four,152,idi,3.7,3.52,21,95,4150,28,33,17950 119 | 118,0,peugeot 604sl,gas,turbo,four,sedan,rwd,front,108,186.7,68.3,56,3130,l,four,134,mpfi,3.61,3.21,7,142,5600,18,24,18150 120 | 119,1,plymouth fury iii,gas,std,two,hatchback,fwd,front,93.7,157.3,63.8,50.8,1918,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,37,41,5572 121 | 120,1,plymouth cricket,gas,turbo,two,hatchback,fwd,front,93.7,157.3,63.8,50.8,2128,ohc,four,98,spdi,3.03,3.39,7.6,102,5500,24,30,7957 122 | 121,1,plymouth fury iii,gas,std,four,hatchback,fwd,front,93.7,157.3,63.8,50.6,1967,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,31,38,6229 123 | 122,1,plymouth satellite custom (sw),gas,std,four,sedan,fwd,front,93.7,167.3,63.8,50.8,1989,ohc,four,90,2bbl,2.97,3.23,9.4,68,5500,31,38,6692 124 | 123,1,plymouth fury gran sedan,gas,std,four,sedan,fwd,front,93.7,167.3,63.8,50.8,2191,ohc,four,98,2bbl,2.97,3.23,9.4,68,5500,31,38,7609 125 | 124,-1,plymouth valiant,gas,std,four,wagon,fwd,front,103.3,174.6,64.6,59.8,2535,ohc,four,122,2bbl,3.35,3.46,8.5,88,5000,24,30,8921 126 | 125,3,plymouth duster,gas,turbo,two,hatchback,rwd,front,95.9,173.2,66.3,50.2,2818,ohc,four,156,spdi,3.59,3.86,7,145,5000,19,24,12764 127 | 126,3,porsche macan,gas,std,two,hatchback,rwd,front,94.5,168.9,68.3,50.2,2778,ohc,four,151,mpfi,3.94,3.11,9.5,143,5500,19,27,22018 128 | 127,3,porcshce panamera,gas,std,two,hardtop,rwd,rear,89.5,168.9,65,51.6,2756,ohcf,six,194,mpfi,3.74,2.9,9.5,207,5900,17,25,32528 129 | 128,3,porsche cayenne,gas,std,two,hardtop,rwd,rear,89.5,168.9,65,51.6,2756,ohcf,six,194,mpfi,3.74,2.9,9.5,207,5900,17,25,34028 130 | 129,3,porsche boxter,gas,std,two,convertible,rwd,rear,89.5,168.9,65,51.6,2800,ohcf,six,194,mpfi,3.74,2.9,9.5,207,5900,17,25,37028 131 | 130,1,porsche cayenne,gas,std,two,hatchback,rwd,front,98.4,175.7,72.3,50.5,3366,dohcv,eight,203,mpfi,3.94,3.11,10,288,5750,17,28,31400.5 132 | 131,0,renault 12tl,gas,std,four,wagon,fwd,front,96.1,181.5,66.5,55.2,2579,ohc,four,132,mpfi,3.46,3.9,8.7,90,5100,23,31,9295 133 | 132,2,renault 5 gtl,gas,std,two,hatchback,fwd,front,96.1,176.8,66.6,50.5,2460,ohc,four,132,mpfi,3.46,3.9,8.7,90,5100,23,31,9895 134 | 133,3,saab 99e,gas,std,two,hatchback,fwd,front,99.1,186.6,66.5,56.1,2658,ohc,four,121,mpfi,3.54,3.07,9.31,110,5250,21,28,11850 135 | 134,2,saab 99le,gas,std,four,sedan,fwd,front,99.1,186.6,66.5,56.1,2695,ohc,four,121,mpfi,3.54,3.07,9.3,110,5250,21,28,12170 136 | 135,3,saab 99le,gas,std,two,hatchback,fwd,front,99.1,186.6,66.5,56.1,2707,ohc,four,121,mpfi,2.54,2.07,9.3,110,5250,21,28,15040 137 | 136,2,saab 99gle,gas,std,four,sedan,fwd,front,99.1,186.6,66.5,56.1,2758,ohc,four,121,mpfi,3.54,3.07,9.3,110,5250,21,28,15510 138 | 137,3,saab 99gle,gas,turbo,two,hatchback,fwd,front,99.1,186.6,66.5,56.1,2808,dohc,four,121,mpfi,3.54,3.07,9,160,5500,19,26,18150 139 | 138,2,saab 99e,gas,turbo,four,sedan,fwd,front,99.1,186.6,66.5,56.1,2847,dohc,four,121,mpfi,3.54,3.07,9,160,5500,19,26,18620 140 | 139,2,subaru,gas,std,two,hatchback,fwd,front,93.7,156.9,63.4,53.7,2050,ohcf,four,97,2bbl,3.62,2.36,9,69,4900,31,36,5118 141 | 140,2,subaru dl,gas,std,two,hatchback,fwd,front,93.7,157.9,63.6,53.7,2120,ohcf,four,108,2bbl,3.62,2.64,8.7,73,4400,26,31,7053 142 | 141,2,subaru dl,gas,std,two,hatchback,4wd,front,93.3,157.3,63.8,55.7,2240,ohcf,four,108,2bbl,3.62,2.64,8.7,73,4400,26,31,7603 143 | 142,0,subaru,gas,std,four,sedan,fwd,front,97.2,172,65.4,52.5,2145,ohcf,four,108,2bbl,3.62,2.64,9.5,82,4800,32,37,7126 144 | 143,0,subaru brz,gas,std,four,sedan,fwd,front,97.2,172,65.4,52.5,2190,ohcf,four,108,2bbl,3.62,2.64,9.5,82,4400,28,33,7775 145 | 144,0,subaru baja,gas,std,four,sedan,fwd,front,97.2,172,65.4,52.5,2340,ohcf,four,108,mpfi,3.62,2.64,9,94,5200,26,32,9960 146 | 145,0,subaru r1,gas,std,four,sedan,4wd,front,97,172,65.4,54.3,2385,ohcf,four,108,2bbl,3.62,2.64,9,82,4800,24,25,9233 147 | 146,0,subaru r2,gas,turbo,four,sedan,4wd,front,97,172,65.4,54.3,2510,ohcf,four,108,mpfi,3.62,2.64,7.7,111,4800,24,29,11259 148 | 147,0,subaru trezia,gas,std,four,wagon,fwd,front,97,173.5,65.4,53,2290,ohcf,four,108,2bbl,3.62,2.64,9,82,4800,28,32,7463 149 | 148,0,subaru tribeca,gas,std,four,wagon,fwd,front,97,173.5,65.4,53,2455,ohcf,four,108,mpfi,3.62,2.64,9,94,5200,25,31,10198 150 | 149,0,subaru dl,gas,std,four,wagon,4wd,front,96.9,173.6,65.4,54.9,2420,ohcf,four,108,2bbl,3.62,2.64,9,82,4800,23,29,8013 151 | 150,0,subaru dl,gas,turbo,four,wagon,4wd,front,96.9,173.6,65.4,54.9,2650,ohcf,four,108,mpfi,3.62,2.64,7.7,111,4800,23,23,11694 152 | 151,1,toyota corona mark ii,gas,std,two,hatchback,fwd,front,95.7,158.7,63.6,54.5,1985,ohc,four,92,2bbl,3.05,3.03,9,62,4800,35,39,5348 153 | 152,1,toyota corona,gas,std,two,hatchback,fwd,front,95.7,158.7,63.6,54.5,2040,ohc,four,92,2bbl,3.05,3.03,9,62,4800,31,38,6338 154 | 153,1,toyota corolla 1200,gas,std,four,hatchback,fwd,front,95.7,158.7,63.6,54.5,2015,ohc,four,92,2bbl,3.05,3.03,9,62,4800,31,38,6488 155 | 154,0,toyota corona hardtop,gas,std,four,wagon,fwd,front,95.7,169.7,63.6,59.1,2280,ohc,four,92,2bbl,3.05,3.03,9,62,4800,31,37,6918 156 | 155,0,toyota corolla 1600 (sw),gas,std,four,wagon,4wd,front,95.7,169.7,63.6,59.1,2290,ohc,four,92,2bbl,3.05,3.03,9,62,4800,27,32,7898 157 | 156,0,toyota carina,gas,std,four,wagon,4wd,front,95.7,169.7,63.6,59.1,3110,ohc,four,92,2bbl,3.05,3.03,9,62,4800,27,32,8778 158 | 157,0,toyota mark ii,gas,std,four,sedan,fwd,front,95.7,166.3,64.4,53,2081,ohc,four,98,2bbl,3.19,3.03,9,70,4800,30,37,6938 159 | 158,0,toyota corolla 1200,gas,std,four,hatchback,fwd,front,95.7,166.3,64.4,52.8,2109,ohc,four,98,2bbl,3.19,3.03,9,70,4800,30,37,7198 160 | 159,0,toyota corona,diesel,std,four,sedan,fwd,front,95.7,166.3,64.4,53,2275,ohc,four,110,idi,3.27,3.35,22.5,56,4500,34,36,7898 161 | 160,0,toyota corolla,diesel,std,four,hatchback,fwd,front,95.7,166.3,64.4,52.8,2275,ohc,four,110,idi,3.27,3.35,22.5,56,4500,38,47,7788 162 | 161,0,toyota corona,gas,std,four,sedan,fwd,front,95.7,166.3,64.4,53,2094,ohc,four,98,2bbl,3.19,3.03,9,70,4800,38,47,7738 163 | 162,0,toyota corolla,gas,std,four,hatchback,fwd,front,95.7,166.3,64.4,52.8,2122,ohc,four,98,2bbl,3.19,3.03,9,70,4800,28,34,8358 164 | 163,0,toyota mark ii,gas,std,four,sedan,fwd,front,95.7,166.3,64.4,52.8,2140,ohc,four,98,2bbl,3.19,3.03,9,70,4800,28,34,9258 165 | 164,1,toyota corolla liftback,gas,std,two,sedan,rwd,front,94.5,168.7,64,52.6,2169,ohc,four,98,2bbl,3.19,3.03,9,70,4800,29,34,8058 166 | 165,1,toyota corona,gas,std,two,hatchback,rwd,front,94.5,168.7,64,52.6,2204,ohc,four,98,2bbl,3.19,3.03,9,70,4800,29,34,8238 167 | 166,1,toyota celica gt liftback,gas,std,two,sedan,rwd,front,94.5,168.7,64,52.6,2265,dohc,four,98,mpfi,3.24,3.08,9.4,112,6600,26,29,9298 168 | 167,1,toyota corolla tercel,gas,std,two,hatchback,rwd,front,94.5,168.7,64,52.6,2300,dohc,four,98,mpfi,3.24,3.08,9.4,112,6600,26,29,9538 169 | 168,2,toyota corona liftback,gas,std,two,hardtop,rwd,front,98.4,176.2,65.6,52,2540,ohc,four,146,mpfi,3.62,3.5,9.3,116,4800,24,30,8449 170 | 169,2,toyota corolla,gas,std,two,hardtop,rwd,front,98.4,176.2,65.6,52,2536,ohc,four,146,mpfi,3.62,3.5,9.3,116,4800,24,30,9639 171 | 170,2,toyota starlet,gas,std,two,hatchback,rwd,front,98.4,176.2,65.6,52,2551,ohc,four,146,mpfi,3.62,3.5,9.3,116,4800,24,30,9989 172 | 171,2,toyota tercel,gas,std,two,hardtop,rwd,front,98.4,176.2,65.6,52,2679,ohc,four,146,mpfi,3.62,3.5,9.3,116,4800,24,30,11199 173 | 172,2,toyota corolla,gas,std,two,hatchback,rwd,front,98.4,176.2,65.6,52,2714,ohc,four,146,mpfi,3.62,3.5,9.3,116,4800,24,30,11549 174 | 173,2,toyota cressida,gas,std,two,convertible,rwd,front,98.4,176.2,65.6,53,2975,ohc,four,146,mpfi,3.62,3.5,9.3,116,4800,24,30,17669 175 | 174,-1,toyota corolla,gas,std,four,sedan,fwd,front,102.4,175.6,66.5,54.9,2326,ohc,four,122,mpfi,3.31,3.54,8.7,92,4200,29,34,8948 176 | 175,-1,toyota celica gt,diesel,turbo,four,sedan,fwd,front,102.4,175.6,66.5,54.9,2480,ohc,four,110,idi,3.27,3.35,22.5,73,4500,30,33,10698 177 | 176,-1,toyota corona,gas,std,four,hatchback,fwd,front,102.4,175.6,66.5,53.9,2414,ohc,four,122,mpfi,3.31,3.54,8.7,92,4200,27,32,9988 178 | 177,-1,toyota corolla,gas,std,four,sedan,fwd,front,102.4,175.6,66.5,54.9,2414,ohc,four,122,mpfi,3.31,3.54,8.7,92,4200,27,32,10898 179 | 178,-1,toyota mark ii,gas,std,four,hatchback,fwd,front,102.4,175.6,66.5,53.9,2458,ohc,four,122,mpfi,3.31,3.54,8.7,92,4200,27,32,11248 180 | 179,3,toyota corolla liftback,gas,std,two,hatchback,rwd,front,102.9,183.5,67.7,52,2976,dohc,six,171,mpfi,3.27,3.35,9.3,161,5200,20,24,16558 181 | 180,3,toyota corona,gas,std,two,hatchback,rwd,front,102.9,183.5,67.7,52,3016,dohc,six,171,mpfi,3.27,3.35,9.3,161,5200,19,24,15998 182 | 181,-1,toyota starlet,gas,std,four,sedan,rwd,front,104.5,187.8,66.5,54.1,3131,dohc,six,171,mpfi,3.27,3.35,9.2,156,5200,20,24,15690 183 | 182,-1,toyouta tercel,gas,std,four,wagon,rwd,front,104.5,187.8,66.5,54.1,3151,dohc,six,161,mpfi,3.27,3.35,9.2,156,5200,19,24,15750 184 | 183,2,vokswagen rabbit,diesel,std,two,sedan,fwd,front,97.3,171.7,65.5,55.7,2261,ohc,four,97,idi,3.01,3.4,23,52,4800,37,46,7775 185 | 184,2,volkswagen 1131 deluxe sedan,gas,std,two,sedan,fwd,front,97.3,171.7,65.5,55.7,2209,ohc,four,109,mpfi,3.19,3.4,9,85,5250,27,34,7975 186 | 185,2,volkswagen model 111,diesel,std,four,sedan,fwd,front,97.3,171.7,65.5,55.7,2264,ohc,four,97,idi,3.01,3.4,23,52,4800,37,46,7995 187 | 186,2,volkswagen type 3,gas,std,four,sedan,fwd,front,97.3,171.7,65.5,55.7,2212,ohc,four,109,mpfi,3.19,3.4,9,85,5250,27,34,8195 188 | 187,2,volkswagen 411 (sw),gas,std,four,sedan,fwd,front,97.3,171.7,65.5,55.7,2275,ohc,four,109,mpfi,3.19,3.4,9,85,5250,27,34,8495 189 | 188,2,volkswagen super beetle,diesel,turbo,four,sedan,fwd,front,97.3,171.7,65.5,55.7,2319,ohc,four,97,idi,3.01,3.4,23,68,4500,37,42,9495 190 | 189,2,volkswagen dasher,gas,std,four,sedan,fwd,front,97.3,171.7,65.5,55.7,2300,ohc,four,109,mpfi,3.19,3.4,10,100,5500,26,32,9995 191 | 190,3,vw dasher,gas,std,two,convertible,fwd,front,94.5,159.3,64.2,55.6,2254,ohc,four,109,mpfi,3.19,3.4,8.5,90,5500,24,29,11595 192 | 191,3,vw rabbit,gas,std,two,hatchback,fwd,front,94.5,165.7,64,51.4,2221,ohc,four,109,mpfi,3.19,3.4,8.5,90,5500,24,29,9980 193 | 192,0,volkswagen rabbit,gas,std,four,sedan,fwd,front,100.4,180.2,66.9,55.1,2661,ohc,five,136,mpfi,3.19,3.4,8.5,110,5500,19,24,13295 194 | 193,0,volkswagen rabbit custom,diesel,turbo,four,sedan,fwd,front,100.4,180.2,66.9,55.1,2579,ohc,four,97,idi,3.01,3.4,23,68,4500,33,38,13845 195 | 194,0,volkswagen dasher,gas,std,four,wagon,fwd,front,100.4,183.1,66.9,55.1,2563,ohc,four,109,mpfi,3.19,3.4,9,88,5500,25,31,12290 196 | 195,-2,volvo 145e (sw),gas,std,four,sedan,rwd,front,104.3,188.8,67.2,56.2,2912,ohc,four,141,mpfi,3.78,3.15,9.5,114,5400,23,28,12940 197 | 196,-1,volvo 144ea,gas,std,four,wagon,rwd,front,104.3,188.8,67.2,57.5,3034,ohc,four,141,mpfi,3.78,3.15,9.5,114,5400,23,28,13415 198 | 197,-2,volvo 244dl,gas,std,four,sedan,rwd,front,104.3,188.8,67.2,56.2,2935,ohc,four,141,mpfi,3.78,3.15,9.5,114,5400,24,28,15985 199 | 198,-1,volvo 245,gas,std,four,wagon,rwd,front,104.3,188.8,67.2,57.5,3042,ohc,four,141,mpfi,3.78,3.15,9.5,114,5400,24,28,16515 200 | 199,-2,volvo 264gl,gas,turbo,four,sedan,rwd,front,104.3,188.8,67.2,56.2,3045,ohc,four,130,mpfi,3.62,3.15,7.5,162,5100,17,22,18420 201 | 200,-1,volvo diesel,gas,turbo,four,wagon,rwd,front,104.3,188.8,67.2,57.5,3157,ohc,four,130,mpfi,3.62,3.15,7.5,162,5100,17,22,18950 202 | 201,-1,volvo 145e (sw),gas,std,four,sedan,rwd,front,109.1,188.8,68.9,55.5,2952,ohc,four,141,mpfi,3.78,3.15,9.5,114,5400,23,28,16845 203 | 202,-1,volvo 144ea,gas,turbo,four,sedan,rwd,front,109.1,188.8,68.8,55.5,3049,ohc,four,141,mpfi,3.78,3.15,8.7,160,5300,19,25,19045 204 | 203,-1,volvo 244dl,gas,std,four,sedan,rwd,front,109.1,188.8,68.9,55.5,3012,ohcv,six,173,mpfi,3.58,2.87,8.8,134,5500,18,23,21485 205 | 204,-1,volvo 246,diesel,turbo,four,sedan,rwd,front,109.1,188.8,68.9,55.5,3217,ohc,six,145,idi,3.01,3.4,23,106,4800,26,27,22470 206 | 205,-1,volvo 264gl,gas,turbo,four,sedan,rwd,front,109.1,188.8,68.9,55.5,3062,ohc,four,141,mpfi,3.78,3.15,9.5,114,5400,19,25,22625 207 | -------------------------------------------------------------------------------- /Case Studies/Car Price Prediction/1.2. Data Dictionary - carprices.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/Case Studies/Car Price Prediction/1.2. Data Dictionary - carprices.xlsx -------------------------------------------------------------------------------- /Case Studies/Credit Card Fraud/dataset.txt: -------------------------------------------------------------------------------- 1 | Kindly download the dataset from the link mentioned in the jupyter notebook. 2 | 3 | THIS IS NOT THE DATA FILE! 4 | 5 | APRIL FOOL -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ML_notes -------------------------------------------------------------------------------- /cheat_sheets/Graphs.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/Graphs.jpeg -------------------------------------------------------------------------------- /cheat_sheets/LaTeX_sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/LaTeX_sheet.pdf -------------------------------------------------------------------------------- /cheat_sheets/ML_cheatsheet-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/ML_cheatsheet-01.png -------------------------------------------------------------------------------- /cheat_sheets/Matplotlib.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/Matplotlib.pdf -------------------------------------------------------------------------------- /cheat_sheets/Pandas.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/Pandas.pdf -------------------------------------------------------------------------------- /cheat_sheets/Python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/Python.pdf -------------------------------------------------------------------------------- /cheat_sheets/Scikit_Learn_Cheat_Sheet_Python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/Scikit_Learn_Cheat_Sheet_Python.pdf -------------------------------------------------------------------------------- /cheat_sheets/numpy-cheat-sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bansalkanav/ML_notes/5051f2bdaaf7660b247c9707bd08b3f19c811a44/cheat_sheets/numpy-cheat-sheet.pdf --------------------------------------------------------------------------------