├── README.md
├── classification
├── decision_tree.ipynb
├── gradient_boosted_decision_tree.ipynb
├── logistic_regression.ipynb
├── naive_bayes.ipynb
├── neural_networks_classifier.ipynb
├── random_forest.ipynb
└── svm.ipynb
├── regression
├── lasso_regression.ipynb
├── linear_regression.ipynb
├── neural_networks_regressor.ipynb
└── ridge_regression.ipynb
└── supplements
└── data
├── cars.csv
└── heart.csv
/README.md:
--------------------------------------------------------------------------------
1 | This repository contains templates for supervised learning algorithms - for both regression and classification problems.
2 |
3 | # List of Algorithms
4 | ### Classification
5 |
6 | 1. [Decision Trees](classification/decision_tree.ipynb)
7 | 2. [Random Forests](classification/random_forest.ipynb)
8 | 3. [Logistic Regression](classification/logistic_regression.ipynb)
9 | 4. [Naive Bayes Classifiers](classification/naive_bayes.ipynb)
10 | 5. [Neural Network Classifier](classification/neural_networks_classifier.ipynb)
11 | 6. [Support Vector Machines](classification/svm.ipynb)
12 |
13 | ### Regression
14 | 1. [Linear Regression](regression/linear_regression.ipynb)
15 | 2. [Ridge Regression](regression/ridge_regression.ipynb)
16 | 3. [Lasso Regression ](regression/lasso_regression.ipynb)
17 | 4. [Polynomial Regression](regression/linear_vs_%20polynomial_regressions.ipynb)
18 | 5. [Neural Network Regressor](regression/neural_networks_regressor.ipynb)
19 |
--------------------------------------------------------------------------------
/classification/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 | "- This is a supplement material for my lectures on ML. It sheds light on Python implementations of the supervised machine learning algorithms. \n",
15 | "- I assume you know Python syntax and how it works. If you don't, I highly recommend you to take a break and get introduced to the language before going forward with my code. \n",
16 | "- This material is represented as a Jupyter notebook, which you can easily download to reproduce the code and play around with it. "
17 | ]
18 | },
19 | {
20 | "cell_type": "markdown",
21 | "metadata": {},
22 | "source": [
23 | "## 1. Libraries"
24 | ]
25 | },
26 | {
27 | "cell_type": "markdown",
28 | "metadata": {},
29 | "source": [
30 | "To build a model, we need \n",
31 | "- `pandas` library to work with panel dataframes\n",
32 | "- `sklearn.model_selection.train_test_split` to split the dataset into train and test\n",
33 | "- `sklearn.naive_bayes.GaussianNB` to build a model"
34 | ]
35 | },
36 | {
37 | "cell_type": "code",
38 | "execution_count": 1,
39 | "metadata": {},
40 | "outputs": [],
41 | "source": [
42 | "import pandas as pd\n",
43 | "from sklearn.naive_bayes import GaussianNB\n",
44 | "from sklearn.model_selection import train_test_split"
45 | ]
46 | },
47 | {
48 | "cell_type": "markdown",
49 | "metadata": {},
50 | "source": [
51 | "## 2. Data Load & Overview"
52 | ]
53 | },
54 | {
55 | "cell_type": "markdown",
56 | "metadata": {},
57 | "source": [
58 | "Let's load the dataset and understand it."
59 | ]
60 | },
61 | {
62 | "cell_type": "code",
63 | "execution_count": 2,
64 | "metadata": {},
65 | "outputs": [],
66 | "source": [
67 | "# Load the dataset\n",
68 | "df = pd.read_csv('https://raw.githubusercontent.com/5x12/ml-cookbook/master/supplements/data/heart.csv')"
69 | ]
70 | },
71 | {
72 | "cell_type": "code",
73 | "execution_count": 25,
74 | "metadata": {},
75 | "outputs": [
76 | {
77 | "data": {
78 | "text/html": [
79 | "
\n",
80 | "\n",
93 | "
\n",
94 | " \n",
95 | " \n",
96 | " | \n",
97 | " age | \n",
98 | " sex | \n",
99 | " cp | \n",
100 | " trestbps | \n",
101 | " chol | \n",
102 | " fbs | \n",
103 | " restecg | \n",
104 | " thalach | \n",
105 | " exang | \n",
106 | " oldpeak | \n",
107 | " slope | \n",
108 | " ca | \n",
109 | " thal | \n",
110 | " target | \n",
111 | "
\n",
112 | " \n",
113 | " \n",
114 | " \n",
115 | " 0 | \n",
116 | " 52 | \n",
117 | " 1 | \n",
118 | " 0 | \n",
119 | " 125 | \n",
120 | " 212 | \n",
121 | " 0 | \n",
122 | " 1 | \n",
123 | " 168 | \n",
124 | " 0 | \n",
125 | " 1.0 | \n",
126 | " 2 | \n",
127 | " 2 | \n",
128 | " 3 | \n",
129 | " 0 | \n",
130 | "
\n",
131 | " \n",
132 | " 1 | \n",
133 | " 53 | \n",
134 | " 1 | \n",
135 | " 0 | \n",
136 | " 140 | \n",
137 | " 203 | \n",
138 | " 1 | \n",
139 | " 0 | \n",
140 | " 155 | \n",
141 | " 1 | \n",
142 | " 3.1 | \n",
143 | " 0 | \n",
144 | " 0 | \n",
145 | " 3 | \n",
146 | " 0 | \n",
147 | "
\n",
148 | " \n",
149 | " 2 | \n",
150 | " 70 | \n",
151 | " 1 | \n",
152 | " 0 | \n",
153 | " 145 | \n",
154 | " 174 | \n",
155 | " 0 | \n",
156 | " 1 | \n",
157 | " 125 | \n",
158 | " 1 | \n",
159 | " 2.6 | \n",
160 | " 0 | \n",
161 | " 0 | \n",
162 | " 3 | \n",
163 | " 0 | \n",
164 | "
\n",
165 | " \n",
166 | " 3 | \n",
167 | " 61 | \n",
168 | " 1 | \n",
169 | " 0 | \n",
170 | " 148 | \n",
171 | " 203 | \n",
172 | " 0 | \n",
173 | " 1 | \n",
174 | " 161 | \n",
175 | " 0 | \n",
176 | " 0.0 | \n",
177 | " 2 | \n",
178 | " 1 | \n",
179 | " 3 | \n",
180 | " 0 | \n",
181 | "
\n",
182 | " \n",
183 | " 4 | \n",
184 | " 62 | \n",
185 | " 0 | \n",
186 | " 0 | \n",
187 | " 138 | \n",
188 | " 294 | \n",
189 | " 1 | \n",
190 | " 1 | \n",
191 | " 106 | \n",
192 | " 0 | \n",
193 | " 1.9 | \n",
194 | " 1 | \n",
195 | " 3 | \n",
196 | " 2 | \n",
197 | " 0 | \n",
198 | "
\n",
199 | " \n",
200 | " 5 | \n",
201 | " 58 | \n",
202 | " 0 | \n",
203 | " 0 | \n",
204 | " 100 | \n",
205 | " 248 | \n",
206 | " 0 | \n",
207 | " 0 | \n",
208 | " 122 | \n",
209 | " 0 | \n",
210 | " 1.0 | \n",
211 | " 1 | \n",
212 | " 0 | \n",
213 | " 2 | \n",
214 | " 1 | \n",
215 | "
\n",
216 | " \n",
217 | " 6 | \n",
218 | " 58 | \n",
219 | " 1 | \n",
220 | " 0 | \n",
221 | " 114 | \n",
222 | " 318 | \n",
223 | " 0 | \n",
224 | " 2 | \n",
225 | " 140 | \n",
226 | " 0 | \n",
227 | " 4.4 | \n",
228 | " 0 | \n",
229 | " 3 | \n",
230 | " 1 | \n",
231 | " 0 | \n",
232 | "
\n",
233 | " \n",
234 | "
\n",
235 | "
"
236 | ],
237 | "text/plain": [
238 | " age sex cp trestbps chol fbs restecg thalach exang oldpeak slope \\\n",
239 | "0 52 1 0 125 212 0 1 168 0 1.0 2 \n",
240 | "1 53 1 0 140 203 1 0 155 1 3.1 0 \n",
241 | "2 70 1 0 145 174 0 1 125 1 2.6 0 \n",
242 | "3 61 1 0 148 203 0 1 161 0 0.0 2 \n",
243 | "4 62 0 0 138 294 1 1 106 0 1.9 1 \n",
244 | "5 58 0 0 100 248 0 0 122 0 1.0 1 \n",
245 | "6 58 1 0 114 318 0 2 140 0 4.4 0 \n",
246 | "\n",
247 | " ca thal target \n",
248 | "0 2 3 0 \n",
249 | "1 0 3 0 \n",
250 | "2 0 3 0 \n",
251 | "3 1 3 0 \n",
252 | "4 3 2 0 \n",
253 | "5 0 2 1 \n",
254 | "6 3 1 0 "
255 | ]
256 | },
257 | "execution_count": 25,
258 | "metadata": {},
259 | "output_type": "execute_result"
260 | }
261 | ],
262 | "source": [
263 | "# Print the first 10 rows of the dataset\n",
264 | "df.head(10)"
265 | ]
266 | },
267 | {
268 | "cell_type": "markdown",
269 | "metadata": {},
270 | "source": [
271 | "This Public Health Dataset represents people's medical records.\n",
272 | "\n",
273 | "- age: age in years\n",
274 | "- sex: (1 = male; 0 = female)\n",
275 | "- cp: chest pain type\n",
276 | "- trestbps: resting blood pressure (in mm Hg on admission to the hospital)\n",
277 | "- chol: serum cholestoral in mg/dl\n",
278 | "- fbs: (fasting blood sugar > 120 mg/dl) (1 = true; 0 = false)\n",
279 | "- restecg: resting electrocardiographic results\n",
280 | "- thalach: maximum heart rate achieved\n",
281 | "- exang: exercise induced angina (1 = yes; 0 = no)\n",
282 | "- oldpeak: ST depression induced by exercise relative to rest\n",
283 | "- slope: the slope of the peak exercise ST segment\n",
284 | "- ca: number of major vessels (0-3) colored by flourosopy\n",
285 | "- thal: 3 = normal; 6 = fixed defect; 7 = reversable defect\n",
286 | "- target: 1 or 0. It refers to the presence of heart disease in the patient. It is integer valued 0 = no disease and 1 = disease.\n",
287 | "\n",
288 | "The main aim is to build **a model that predicts a heart disease of a patient** (target column) based on independent variables."
289 | ]
290 | },
291 | {
292 | "cell_type": "markdown",
293 | "metadata": {},
294 | "source": [
295 | "## 3. Variables"
296 | ]
297 | },
298 | {
299 | "cell_type": "markdown",
300 | "metadata": {},
301 | "source": [
302 | "Let's split the dataset into X and y, where \n",
303 | "- $X$ is a set of independent variables (all columns but the last one)\n",
304 | "- $y$ is a dependent, or target variable (the last column)"
305 | ]
306 | },
307 | {
308 | "cell_type": "code",
309 | "execution_count": 4,
310 | "metadata": {},
311 | "outputs": [
312 | {
313 | "data": {
314 | "text/html": [
315 | "\n",
316 | "\n",
329 | "
\n",
330 | " \n",
331 | " \n",
332 | " | \n",
333 | " age | \n",
334 | " sex | \n",
335 | " cp | \n",
336 | " trestbps | \n",
337 | " chol | \n",
338 | " fbs | \n",
339 | " restecg | \n",
340 | " thalach | \n",
341 | " exang | \n",
342 | " oldpeak | \n",
343 | " slope | \n",
344 | " ca | \n",
345 | " thal | \n",
346 | "
\n",
347 | " \n",
348 | " \n",
349 | " \n",
350 | " 0 | \n",
351 | " 52 | \n",
352 | " 1 | \n",
353 | " 0 | \n",
354 | " 125 | \n",
355 | " 212 | \n",
356 | " 0 | \n",
357 | " 1 | \n",
358 | " 168 | \n",
359 | " 0 | \n",
360 | " 1.0 | \n",
361 | " 2 | \n",
362 | " 2 | \n",
363 | " 3 | \n",
364 | "
\n",
365 | " \n",
366 | " 1 | \n",
367 | " 53 | \n",
368 | " 1 | \n",
369 | " 0 | \n",
370 | " 140 | \n",
371 | " 203 | \n",
372 | " 1 | \n",
373 | " 0 | \n",
374 | " 155 | \n",
375 | " 1 | \n",
376 | " 3.1 | \n",
377 | " 0 | \n",
378 | " 0 | \n",
379 | " 3 | \n",
380 | "
\n",
381 | " \n",
382 | " 2 | \n",
383 | " 70 | \n",
384 | " 1 | \n",
385 | " 0 | \n",
386 | " 145 | \n",
387 | " 174 | \n",
388 | " 0 | \n",
389 | " 1 | \n",
390 | " 125 | \n",
391 | " 1 | \n",
392 | " 2.6 | \n",
393 | " 0 | \n",
394 | " 0 | \n",
395 | " 3 | \n",
396 | "
\n",
397 | " \n",
398 | " 3 | \n",
399 | " 61 | \n",
400 | " 1 | \n",
401 | " 0 | \n",
402 | " 148 | \n",
403 | " 203 | \n",
404 | " 0 | \n",
405 | " 1 | \n",
406 | " 161 | \n",
407 | " 0 | \n",
408 | " 0.0 | \n",
409 | " 2 | \n",
410 | " 1 | \n",
411 | " 3 | \n",
412 | "
\n",
413 | " \n",
414 | " 4 | \n",
415 | " 62 | \n",
416 | " 0 | \n",
417 | " 0 | \n",
418 | " 138 | \n",
419 | " 294 | \n",
420 | " 1 | \n",
421 | " 1 | \n",
422 | " 106 | \n",
423 | " 0 | \n",
424 | " 1.9 | \n",
425 | " 1 | \n",
426 | " 3 | \n",
427 | " 2 | \n",
428 | "
\n",
429 | " \n",
430 | " ... | \n",
431 | " ... | \n",
432 | " ... | \n",
433 | " ... | \n",
434 | " ... | \n",
435 | " ... | \n",
436 | " ... | \n",
437 | " ... | \n",
438 | " ... | \n",
439 | " ... | \n",
440 | " ... | \n",
441 | " ... | \n",
442 | " ... | \n",
443 | " ... | \n",
444 | "
\n",
445 | " \n",
446 | " 1020 | \n",
447 | " 59 | \n",
448 | " 1 | \n",
449 | " 1 | \n",
450 | " 140 | \n",
451 | " 221 | \n",
452 | " 0 | \n",
453 | " 1 | \n",
454 | " 164 | \n",
455 | " 1 | \n",
456 | " 0.0 | \n",
457 | " 2 | \n",
458 | " 0 | \n",
459 | " 2 | \n",
460 | "
\n",
461 | " \n",
462 | " 1021 | \n",
463 | " 60 | \n",
464 | " 1 | \n",
465 | " 0 | \n",
466 | " 125 | \n",
467 | " 258 | \n",
468 | " 0 | \n",
469 | " 0 | \n",
470 | " 141 | \n",
471 | " 1 | \n",
472 | " 2.8 | \n",
473 | " 1 | \n",
474 | " 1 | \n",
475 | " 3 | \n",
476 | "
\n",
477 | " \n",
478 | " 1022 | \n",
479 | " 47 | \n",
480 | " 1 | \n",
481 | " 0 | \n",
482 | " 110 | \n",
483 | " 275 | \n",
484 | " 0 | \n",
485 | " 0 | \n",
486 | " 118 | \n",
487 | " 1 | \n",
488 | " 1.0 | \n",
489 | " 1 | \n",
490 | " 1 | \n",
491 | " 2 | \n",
492 | "
\n",
493 | " \n",
494 | " 1023 | \n",
495 | " 50 | \n",
496 | " 0 | \n",
497 | " 0 | \n",
498 | " 110 | \n",
499 | " 254 | \n",
500 | " 0 | \n",
501 | " 0 | \n",
502 | " 159 | \n",
503 | " 0 | \n",
504 | " 0.0 | \n",
505 | " 2 | \n",
506 | " 0 | \n",
507 | " 2 | \n",
508 | "
\n",
509 | " \n",
510 | " 1024 | \n",
511 | " 54 | \n",
512 | " 1 | \n",
513 | " 0 | \n",
514 | " 120 | \n",
515 | " 188 | \n",
516 | " 0 | \n",
517 | " 1 | \n",
518 | " 113 | \n",
519 | " 0 | \n",
520 | " 1.4 | \n",
521 | " 1 | \n",
522 | " 1 | \n",
523 | " 3 | \n",
524 | "
\n",
525 | " \n",
526 | "
\n",
527 | "
1025 rows × 13 columns
\n",
528 | "
"
529 | ],
530 | "text/plain": [
531 | " age sex cp trestbps chol fbs restecg thalach exang oldpeak \\\n",
532 | "0 52 1 0 125 212 0 1 168 0 1.0 \n",
533 | "1 53 1 0 140 203 1 0 155 1 3.1 \n",
534 | "2 70 1 0 145 174 0 1 125 1 2.6 \n",
535 | "3 61 1 0 148 203 0 1 161 0 0.0 \n",
536 | "4 62 0 0 138 294 1 1 106 0 1.9 \n",
537 | "... ... ... .. ... ... ... ... ... ... ... \n",
538 | "1020 59 1 1 140 221 0 1 164 1 0.0 \n",
539 | "1021 60 1 0 125 258 0 0 141 1 2.8 \n",
540 | "1022 47 1 0 110 275 0 0 118 1 1.0 \n",
541 | "1023 50 0 0 110 254 0 0 159 0 0.0 \n",
542 | "1024 54 1 0 120 188 0 1 113 0 1.4 \n",
543 | "\n",
544 | " slope ca thal \n",
545 | "0 2 2 3 \n",
546 | "1 0 0 3 \n",
547 | "2 0 0 3 \n",
548 | "3 2 1 3 \n",
549 | "4 1 3 2 \n",
550 | "... ... .. ... \n",
551 | "1020 2 0 2 \n",
552 | "1021 1 1 3 \n",
553 | "1022 1 1 2 \n",
554 | "1023 2 0 2 \n",
555 | "1024 1 1 3 \n",
556 | "\n",
557 | "[1025 rows x 13 columns]"
558 | ]
559 | },
560 | "execution_count": 4,
561 | "metadata": {},
562 | "output_type": "execute_result"
563 | }
564 | ],
565 | "source": [
566 | "# Filter out target column\n",
567 | "X = df.iloc[:, :-1]\n",
568 | "\n",
569 | "# Print X\n",
570 | "X"
571 | ]
572 | },
573 | {
574 | "cell_type": "code",
575 | "execution_count": 5,
576 | "metadata": {},
577 | "outputs": [
578 | {
579 | "data": {
580 | "text/plain": [
581 | "0 0\n",
582 | "1 0\n",
583 | "2 0\n",
584 | "3 0\n",
585 | "4 0\n",
586 | " ..\n",
587 | "1020 1\n",
588 | "1021 0\n",
589 | "1022 0\n",
590 | "1023 1\n",
591 | "1024 0\n",
592 | "Name: target, Length: 1025, dtype: int64"
593 | ]
594 | },
595 | "execution_count": 5,
596 | "metadata": {},
597 | "output_type": "execute_result"
598 | }
599 | ],
600 | "source": [
601 | "# Select target column\n",
602 | "y = df['target']\n",
603 | "\n",
604 | "# Print y\n",
605 | "y"
606 | ]
607 | },
608 | {
609 | "cell_type": "markdown",
610 | "metadata": {},
611 | "source": [
612 | "## 4. Model"
613 | ]
614 | },
615 | {
616 | "cell_type": "markdown",
617 | "metadata": {},
618 | "source": [
619 | "In this section we are going to \n",
620 | "- build a Naive Bayes model, \n",
621 | "- evaluate its accuracy, and \n",
622 | "- make a prediction"
623 | ]
624 | },
625 | {
626 | "cell_type": "markdown",
627 | "metadata": {},
628 | "source": [
629 | "### 4.1. Building the model"
630 | ]
631 | },
632 | {
633 | "cell_type": "markdown",
634 | "metadata": {},
635 | "source": [
636 | "Let's recall three simple steps:\n",
637 | "\n",
638 | "- Split the $X$ & $y$ variables into train and test sets\n",
639 | "- Initialize the model\n",
640 | "- Train the model with the varialbes"
641 | ]
642 | },
643 | {
644 | "cell_type": "code",
645 | "execution_count": 16,
646 | "metadata": {},
647 | "outputs": [],
648 | "source": [
649 | "# Split variables into train and test\n",
650 | "X_train, X_test, y_train, y_test = train_test_split(X, #independent variables\n",
651 | " y, #dependent variable\n",
652 | " random_state = 3\n",
653 | " )"
654 | ]
655 | },
656 | {
657 | "cell_type": "code",
658 | "execution_count": 17,
659 | "metadata": {},
660 | "outputs": [],
661 | "source": [
662 | "# Initialize the model\n",
663 | "clf = GaussianNB()"
664 | ]
665 | },
666 | {
667 | "cell_type": "code",
668 | "execution_count": 18,
669 | "metadata": {},
670 | "outputs": [
671 | {
672 | "data": {
673 | "text/html": [
674 | "GaussianNB()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org. "
675 | ],
676 | "text/plain": [
677 | "GaussianNB()"
678 | ]
679 | },
680 | "execution_count": 18,
681 | "metadata": {},
682 | "output_type": "execute_result"
683 | }
684 | ],
685 | "source": [
686 | "# Train the model\n",
687 | "clf.fit(X_train, y_train)"
688 | ]
689 | },
690 | {
691 | "cell_type": "markdown",
692 | "metadata": {},
693 | "source": [
694 | "### 4.2. Checking models accuracy"
695 | ]
696 | },
697 | {
698 | "cell_type": "markdown",
699 | "metadata": {},
700 | "source": [
701 | "After the model has trained with the data, it's essential to understand how precisely it predicts heart disease. For that, we need to check model's accuracy. "
702 | ]
703 | },
704 | {
705 | "cell_type": "code",
706 | "execution_count": 19,
707 | "metadata": {},
708 | "outputs": [
709 | {
710 | "name": "stdout",
711 | "output_type": "stream",
712 | "text": [
713 | "Accuracy of Naive Bayes classifier on training set: 0.85\n",
714 | "Accuracy of Naive Bayes classifier on test set: 0.83\n"
715 | ]
716 | }
717 | ],
718 | "source": [
719 | "print(f'Accuracy of Naive Bayes classifier on training set: {clf.score(X_train, y_train):.2f}')\n",
720 | "print(f'Accuracy of Naive Bayes classifier on test set: {clf.score(X_test, y_test):.2f}')"
721 | ]
722 | },
723 | {
724 | "cell_type": "markdown",
725 | "metadata": {},
726 | "source": [
727 | "### 4.3. Making a prediction"
728 | ]
729 | },
730 | {
731 | "cell_type": "markdown",
732 | "metadata": {},
733 | "source": [
734 | "Now that we know the model is accurate enough, we can predict whether or not a patient is having a heart disease by passing independent varialbes to the model. The method `predict` returns such a prediction - 0 for NO, 1 for YES."
735 | ]
736 | },
737 | {
738 | "cell_type": "code",
739 | "execution_count": 21,
740 | "metadata": {},
741 | "outputs": [
742 | {
743 | "name": "stderr",
744 | "output_type": "stream",
745 | "text": [
746 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/base.py:409: UserWarning: X does not have valid feature names, but GaussianNB was fitted with feature names\n",
747 | " warnings.warn(\n"
748 | ]
749 | },
750 | {
751 | "data": {
752 | "text/plain": [
753 | "array([0])"
754 | ]
755 | },
756 | "execution_count": 21,
757 | "metadata": {},
758 | "output_type": "execute_result"
759 | }
760 | ],
761 | "source": [
762 | "clf.predict([[59, 1, 0, 101, 234, 0, 1, 143, 0, 3.4, 0, 0, 0]])"
763 | ]
764 | },
765 | {
766 | "cell_type": "markdown",
767 | "metadata": {},
768 | "source": [
769 | "In the array:\n",
770 | "- value 0 means a patient does not have a heart disease, \n",
771 | "- value 1 means a patient does not have a heart disease.\n",
772 | "\n",
773 | "We can also check the probability of a patient having a heart disease. The method `predict_proba` can be used to infer the class probabilities (i.e. the probability that a particular data point falls into the underlying classes)."
774 | ]
775 | },
776 | {
777 | "cell_type": "code",
778 | "execution_count": 23,
779 | "metadata": {},
780 | "outputs": [
781 | {
782 | "name": "stderr",
783 | "output_type": "stream",
784 | "text": [
785 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/base.py:409: UserWarning: X does not have valid feature names, but GaussianNB was fitted with feature names\n",
786 | " warnings.warn(\n"
787 | ]
788 | },
789 | {
790 | "data": {
791 | "text/plain": [
792 | "array([[9.99964049e-01, 3.59509641e-05]])"
793 | ]
794 | },
795 | "execution_count": 23,
796 | "metadata": {},
797 | "output_type": "execute_result"
798 | }
799 | ],
800 | "source": [
801 | "clf.predict_proba([[59, 1, 0, 101, 234, 0, 1, 143, 0, 3.4, 0, 0, 0]])"
802 | ]
803 | },
804 | {
805 | "cell_type": "markdown",
806 | "metadata": {},
807 | "source": [
808 | "More on Naive Bayes at https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB"
809 | ]
810 | }
811 | ],
812 | "metadata": {
813 | "kernelspec": {
814 | "display_name": "Python 3 (ipykernel)",
815 | "language": "python",
816 | "name": "python3"
817 | },
818 | "language_info": {
819 | "codemirror_mode": {
820 | "name": "ipython",
821 | "version": 3
822 | },
823 | "file_extension": ".py",
824 | "mimetype": "text/x-python",
825 | "name": "python",
826 | "nbconvert_exporter": "python",
827 | "pygments_lexer": "ipython3",
828 | "version": "3.10.7"
829 | }
830 | },
831 | "nbformat": 4,
832 | "nbformat_minor": 2
833 | }
834 |
--------------------------------------------------------------------------------
/regression/lasso_regression.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Lasso Regression"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "- This is a supplement material for my lectures on ML. It sheds light on Python implementations of the supervised machine learning algorithms. \n",
15 | "- I assume you know Python syntax and how it works. If you don't, I highly recommend you to take a break and get introduced to the language before going forward with my code. \n",
16 | "- This material is represented as a Jupyter notebook, which you can easily download to reproduce the code and play around with it. "
17 | ]
18 | },
19 | {
20 | "cell_type": "markdown",
21 | "metadata": {},
22 | "source": [
23 | "## 1. Libraries"
24 | ]
25 | },
26 | {
27 | "cell_type": "markdown",
28 | "metadata": {},
29 | "source": [
30 | "To build a model, we need \n",
31 | "- `pandas` library to work with panel dataframes\n",
32 | "- `sklearn.model_selection.train_test_split` to split the dataset into train and test\n",
33 | "- `sklearn.linear_model.Lasso` to build a model\n",
34 | "\n",
35 | ""
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "execution_count": 30,
41 | "metadata": {},
42 | "outputs": [],
43 | "source": [
44 | "import pandas as pd\n",
45 | "import matplotlib.pyplot as plt\n",
46 | "from sklearn.linear_model import Lasso\n",
47 | "from sklearn.model_selection import train_test_split"
48 | ]
49 | },
50 | {
51 | "cell_type": "markdown",
52 | "metadata": {},
53 | "source": [
54 | "## 2. Data Load & Overview"
55 | ]
56 | },
57 | {
58 | "cell_type": "markdown",
59 | "metadata": {},
60 | "source": [
61 | "Let's load the dataset and understand it."
62 | ]
63 | },
64 | {
65 | "cell_type": "code",
66 | "execution_count": 2,
67 | "metadata": {},
68 | "outputs": [],
69 | "source": [
70 | "# Load the dataset\n",
71 | "df = pd.read_csv('https://raw.githubusercontent.com/5x12/ml-cookbook/master/supplements/data/cars.csv')"
72 | ]
73 | },
74 | {
75 | "cell_type": "code",
76 | "execution_count": 3,
77 | "metadata": {},
78 | "outputs": [
79 | {
80 | "data": {
81 | "text/html": [
82 | "\n",
83 | "\n",
96 | "
\n",
97 | " \n",
98 | " \n",
99 | " | \n",
100 | " car_ID | \n",
101 | " symboling | \n",
102 | " CarName | \n",
103 | " fueltype | \n",
104 | " aspiration | \n",
105 | " doornumber | \n",
106 | " carbody | \n",
107 | " drivewheel | \n",
108 | " enginelocation | \n",
109 | " wheelbase | \n",
110 | " ... | \n",
111 | " enginesize | \n",
112 | " fuelsystem | \n",
113 | " boreratio | \n",
114 | " stroke | \n",
115 | " compressionratio | \n",
116 | " horsepower | \n",
117 | " peakrpm | \n",
118 | " citympg | \n",
119 | " highwaympg | \n",
120 | " price | \n",
121 | "
\n",
122 | " \n",
123 | " \n",
124 | " \n",
125 | " 0 | \n",
126 | " 1 | \n",
127 | " 3 | \n",
128 | " alfa-romero giulia | \n",
129 | " gas | \n",
130 | " std | \n",
131 | " two | \n",
132 | " convertible | \n",
133 | " rwd | \n",
134 | " front | \n",
135 | " 88.6 | \n",
136 | " ... | \n",
137 | " 130 | \n",
138 | " mpfi | \n",
139 | " 3.47 | \n",
140 | " 2.68 | \n",
141 | " 9.0 | \n",
142 | " 111 | \n",
143 | " 5000 | \n",
144 | " 21 | \n",
145 | " 27 | \n",
146 | " 13495.000 | \n",
147 | "
\n",
148 | " \n",
149 | " 1 | \n",
150 | " 2 | \n",
151 | " 3 | \n",
152 | " alfa-romero stelvio | \n",
153 | " gas | \n",
154 | " std | \n",
155 | " two | \n",
156 | " convertible | \n",
157 | " rwd | \n",
158 | " front | \n",
159 | " 88.6 | \n",
160 | " ... | \n",
161 | " 130 | \n",
162 | " mpfi | \n",
163 | " 3.47 | \n",
164 | " 2.68 | \n",
165 | " 9.0 | \n",
166 | " 111 | \n",
167 | " 5000 | \n",
168 | " 21 | \n",
169 | " 27 | \n",
170 | " 16500.000 | \n",
171 | "
\n",
172 | " \n",
173 | " 2 | \n",
174 | " 3 | \n",
175 | " 1 | \n",
176 | " alfa-romero Quadrifoglio | \n",
177 | " gas | \n",
178 | " std | \n",
179 | " two | \n",
180 | " hatchback | \n",
181 | " rwd | \n",
182 | " front | \n",
183 | " 94.5 | \n",
184 | " ... | \n",
185 | " 152 | \n",
186 | " mpfi | \n",
187 | " 2.68 | \n",
188 | " 3.47 | \n",
189 | " 9.0 | \n",
190 | " 154 | \n",
191 | " 5000 | \n",
192 | " 19 | \n",
193 | " 26 | \n",
194 | " 16500.000 | \n",
195 | "
\n",
196 | " \n",
197 | " 3 | \n",
198 | " 4 | \n",
199 | " 2 | \n",
200 | " audi 100 ls | \n",
201 | " gas | \n",
202 | " std | \n",
203 | " four | \n",
204 | " sedan | \n",
205 | " fwd | \n",
206 | " front | \n",
207 | " 99.8 | \n",
208 | " ... | \n",
209 | " 109 | \n",
210 | " mpfi | \n",
211 | " 3.19 | \n",
212 | " 3.40 | \n",
213 | " 10.0 | \n",
214 | " 102 | \n",
215 | " 5500 | \n",
216 | " 24 | \n",
217 | " 30 | \n",
218 | " 13950.000 | \n",
219 | "
\n",
220 | " \n",
221 | " 4 | \n",
222 | " 5 | \n",
223 | " 2 | \n",
224 | " audi 100ls | \n",
225 | " gas | \n",
226 | " std | \n",
227 | " four | \n",
228 | " sedan | \n",
229 | " 4wd | \n",
230 | " front | \n",
231 | " 99.4 | \n",
232 | " ... | \n",
233 | " 136 | \n",
234 | " mpfi | \n",
235 | " 3.19 | \n",
236 | " 3.40 | \n",
237 | " 8.0 | \n",
238 | " 115 | \n",
239 | " 5500 | \n",
240 | " 18 | \n",
241 | " 22 | \n",
242 | " 17450.000 | \n",
243 | "
\n",
244 | " \n",
245 | " 5 | \n",
246 | " 6 | \n",
247 | " 2 | \n",
248 | " audi fox | \n",
249 | " gas | \n",
250 | " std | \n",
251 | " two | \n",
252 | " sedan | \n",
253 | " fwd | \n",
254 | " front | \n",
255 | " 99.8 | \n",
256 | " ... | \n",
257 | " 136 | \n",
258 | " mpfi | \n",
259 | " 3.19 | \n",
260 | " 3.40 | \n",
261 | " 8.5 | \n",
262 | " 110 | \n",
263 | " 5500 | \n",
264 | " 19 | \n",
265 | " 25 | \n",
266 | " 15250.000 | \n",
267 | "
\n",
268 | " \n",
269 | " 6 | \n",
270 | " 7 | \n",
271 | " 1 | \n",
272 | " audi 100ls | \n",
273 | " gas | \n",
274 | " std | \n",
275 | " four | \n",
276 | " sedan | \n",
277 | " fwd | \n",
278 | " front | \n",
279 | " 105.8 | \n",
280 | " ... | \n",
281 | " 136 | \n",
282 | " mpfi | \n",
283 | " 3.19 | \n",
284 | " 3.40 | \n",
285 | " 8.5 | \n",
286 | " 110 | \n",
287 | " 5500 | \n",
288 | " 19 | \n",
289 | " 25 | \n",
290 | " 17710.000 | \n",
291 | "
\n",
292 | " \n",
293 | " 7 | \n",
294 | " 8 | \n",
295 | " 1 | \n",
296 | " audi 5000 | \n",
297 | " gas | \n",
298 | " std | \n",
299 | " four | \n",
300 | " wagon | \n",
301 | " fwd | \n",
302 | " front | \n",
303 | " 105.8 | \n",
304 | " ... | \n",
305 | " 136 | \n",
306 | " mpfi | \n",
307 | " 3.19 | \n",
308 | " 3.40 | \n",
309 | " 8.5 | \n",
310 | " 110 | \n",
311 | " 5500 | \n",
312 | " 19 | \n",
313 | " 25 | \n",
314 | " 18920.000 | \n",
315 | "
\n",
316 | " \n",
317 | " 8 | \n",
318 | " 9 | \n",
319 | " 1 | \n",
320 | " audi 4000 | \n",
321 | " gas | \n",
322 | " turbo | \n",
323 | " four | \n",
324 | " sedan | \n",
325 | " fwd | \n",
326 | " front | \n",
327 | " 105.8 | \n",
328 | " ... | \n",
329 | " 131 | \n",
330 | " mpfi | \n",
331 | " 3.13 | \n",
332 | " 3.40 | \n",
333 | " 8.3 | \n",
334 | " 140 | \n",
335 | " 5500 | \n",
336 | " 17 | \n",
337 | " 20 | \n",
338 | " 23875.000 | \n",
339 | "
\n",
340 | " \n",
341 | " 9 | \n",
342 | " 10 | \n",
343 | " 0 | \n",
344 | " audi 5000s (diesel) | \n",
345 | " gas | \n",
346 | " turbo | \n",
347 | " two | \n",
348 | " hatchback | \n",
349 | " 4wd | \n",
350 | " front | \n",
351 | " 99.5 | \n",
352 | " ... | \n",
353 | " 131 | \n",
354 | " mpfi | \n",
355 | " 3.13 | \n",
356 | " 3.40 | \n",
357 | " 7.0 | \n",
358 | " 160 | \n",
359 | " 5500 | \n",
360 | " 16 | \n",
361 | " 22 | \n",
362 | " 17859.167 | \n",
363 | "
\n",
364 | " \n",
365 | "
\n",
366 | "
10 rows × 26 columns
\n",
367 | "
"
368 | ],
369 | "text/plain": [
370 | " car_ID symboling CarName fueltype aspiration doornumber \\\n",
371 | "0 1 3 alfa-romero giulia gas std two \n",
372 | "1 2 3 alfa-romero stelvio gas std two \n",
373 | "2 3 1 alfa-romero Quadrifoglio gas std two \n",
374 | "3 4 2 audi 100 ls gas std four \n",
375 | "4 5 2 audi 100ls gas std four \n",
376 | "5 6 2 audi fox gas std two \n",
377 | "6 7 1 audi 100ls gas std four \n",
378 | "7 8 1 audi 5000 gas std four \n",
379 | "8 9 1 audi 4000 gas turbo four \n",
380 | "9 10 0 audi 5000s (diesel) gas turbo two \n",
381 | "\n",
382 | " carbody drivewheel enginelocation wheelbase ... enginesize \\\n",
383 | "0 convertible rwd front 88.6 ... 130 \n",
384 | "1 convertible rwd front 88.6 ... 130 \n",
385 | "2 hatchback rwd front 94.5 ... 152 \n",
386 | "3 sedan fwd front 99.8 ... 109 \n",
387 | "4 sedan 4wd front 99.4 ... 136 \n",
388 | "5 sedan fwd front 99.8 ... 136 \n",
389 | "6 sedan fwd front 105.8 ... 136 \n",
390 | "7 wagon fwd front 105.8 ... 136 \n",
391 | "8 sedan fwd front 105.8 ... 131 \n",
392 | "9 hatchback 4wd front 99.5 ... 131 \n",
393 | "\n",
394 | " fuelsystem boreratio stroke compressionratio horsepower peakrpm citympg \\\n",
395 | "0 mpfi 3.47 2.68 9.0 111 5000 21 \n",
396 | "1 mpfi 3.47 2.68 9.0 111 5000 21 \n",
397 | "2 mpfi 2.68 3.47 9.0 154 5000 19 \n",
398 | "3 mpfi 3.19 3.40 10.0 102 5500 24 \n",
399 | "4 mpfi 3.19 3.40 8.0 115 5500 18 \n",
400 | "5 mpfi 3.19 3.40 8.5 110 5500 19 \n",
401 | "6 mpfi 3.19 3.40 8.5 110 5500 19 \n",
402 | "7 mpfi 3.19 3.40 8.5 110 5500 19 \n",
403 | "8 mpfi 3.13 3.40 8.3 140 5500 17 \n",
404 | "9 mpfi 3.13 3.40 7.0 160 5500 16 \n",
405 | "\n",
406 | " highwaympg price \n",
407 | "0 27 13495.000 \n",
408 | "1 27 16500.000 \n",
409 | "2 26 16500.000 \n",
410 | "3 30 13950.000 \n",
411 | "4 22 17450.000 \n",
412 | "5 25 15250.000 \n",
413 | "6 25 17710.000 \n",
414 | "7 25 18920.000 \n",
415 | "8 20 23875.000 \n",
416 | "9 22 17859.167 \n",
417 | "\n",
418 | "[10 rows x 26 columns]"
419 | ]
420 | },
421 | "execution_count": 3,
422 | "metadata": {},
423 | "output_type": "execute_result"
424 | }
425 | ],
426 | "source": [
427 | "# Print the first 10 rows of the dataset\n",
428 | "df.head(10)"
429 | ]
430 | },
431 | {
432 | "cell_type": "markdown",
433 | "metadata": {},
434 | "source": [
435 | "This Cars Dataset represents cars characteristics, along with their prices.\n",
436 | "\n",
437 | "- `car_ID`: Unique id of each observation (Interger)\n",
438 | "- `symboling`: Its assigned insurance risk rating, A value of +3 indicates that the auto is risky, -3 that it is probably pretty safe.(Categorical) \t\t\n",
439 | "- `carCompany`: Name of car company (Categorical)\t\t\n",
440 | "- `fueltype`: Car fuel type i.e gas or diesel (Categorical)\t\t\n",
441 | "- `aspiration`: Aspiration used in a car (Categorical)\t\t\n",
442 | "- `doornumber`: Number of doors in a car (Categorical)\t\t\n",
443 | "- `carbody`: body of car (Categorical)\t\t\n",
444 | "- `drivewheel`: type of drive wheel (Categorical)\t\t\n",
445 | "- `enginelocation`: Location of car engine (Categorical)\t\t\n",
446 | "- `wheelbase`: Weelbase of car (Numeric)\t\t\n",
447 | "- `carlength`: Length of car (Numeric)\t\t\n",
448 | "- `carwidth`: Width of car (Numeric)\t\t\n",
449 | "- `carheight` Height of car (Numeric)\t\t\n",
450 | "- `curbweight` The weight of a car without occupants or baggage. (Numeric)\t\t\n",
451 | "- `enginetype`: Type of engine. (Categorical)\t\t\n",
452 | "- `cylindernumber`: Cylinder placed in the car (Categorical)\t\t\n",
453 | "- `enginesize`: Size of car (Numeric)\t\t\n",
454 | "- `fuelsystem`: Fuel system of car (Categorical)\t\t\n",
455 | "- `boreratio`: Boreratio of car (Numeric)\t\t\n",
456 | "- `stroke`: Stroke or volume inside the engine (Numeric)\t\t\n",
457 | "- `compressionratio`: Compression ratio of car (Numeric)\t\t\n",
458 | "- `horsepower`: Horsepower (Numeric)\t\t\n",
459 | "- `peakrpm`: Car peak rpm (Numeric)\t\t\n",
460 | "- `citympg`: Mileage in city (Numeric)\t\t\n",
461 | "- `highwaympg`: Mileage on highway (Numeric)\t\t\n",
462 | "- `price` (Dependent variable): Price of car in \\$ (Numeric)\n",
463 | "\n",
464 | "The main aim is to build **a model that predicts a price of a car** (`price` column) based on independent variables."
465 | ]
466 | },
467 | {
468 | "cell_type": "markdown",
469 | "metadata": {},
470 | "source": [
471 | "## 3. Variables"
472 | ]
473 | },
474 | {
475 | "cell_type": "markdown",
476 | "metadata": {},
477 | "source": [
478 | "Let's split the dataset into X and y, where \n",
479 | "- $X$ is a set of independent variables\n",
480 | "- $y$ is a dependent, or target variable (the last column)\n",
481 | "\n",
482 | "To make things simpler, let's pick 3 independent variables."
483 | ]
484 | },
485 | {
486 | "cell_type": "code",
487 | "execution_count": 5,
488 | "metadata": {},
489 | "outputs": [
490 | {
491 | "data": {
492 | "text/html": [
493 | "\n",
494 | "\n",
507 | "
\n",
508 | " \n",
509 | " \n",
510 | " | \n",
511 | " symboling | \n",
512 | " enginesize | \n",
513 | " horsepower | \n",
514 | "
\n",
515 | " \n",
516 | " \n",
517 | " \n",
518 | " 0 | \n",
519 | " 3 | \n",
520 | " 130 | \n",
521 | " 111 | \n",
522 | "
\n",
523 | " \n",
524 | " 1 | \n",
525 | " 3 | \n",
526 | " 130 | \n",
527 | " 111 | \n",
528 | "
\n",
529 | " \n",
530 | " 2 | \n",
531 | " 1 | \n",
532 | " 152 | \n",
533 | " 154 | \n",
534 | "
\n",
535 | " \n",
536 | " 3 | \n",
537 | " 2 | \n",
538 | " 109 | \n",
539 | " 102 | \n",
540 | "
\n",
541 | " \n",
542 | " 4 | \n",
543 | " 2 | \n",
544 | " 136 | \n",
545 | " 115 | \n",
546 | "
\n",
547 | " \n",
548 | " ... | \n",
549 | " ... | \n",
550 | " ... | \n",
551 | " ... | \n",
552 | "
\n",
553 | " \n",
554 | " 200 | \n",
555 | " -1 | \n",
556 | " 141 | \n",
557 | " 114 | \n",
558 | "
\n",
559 | " \n",
560 | " 201 | \n",
561 | " -1 | \n",
562 | " 141 | \n",
563 | " 160 | \n",
564 | "
\n",
565 | " \n",
566 | " 202 | \n",
567 | " -1 | \n",
568 | " 173 | \n",
569 | " 134 | \n",
570 | "
\n",
571 | " \n",
572 | " 203 | \n",
573 | " -1 | \n",
574 | " 145 | \n",
575 | " 106 | \n",
576 | "
\n",
577 | " \n",
578 | " 204 | \n",
579 | " -1 | \n",
580 | " 141 | \n",
581 | " 114 | \n",
582 | "
\n",
583 | " \n",
584 | "
\n",
585 | "
205 rows × 3 columns
\n",
586 | "
"
587 | ],
588 | "text/plain": [
589 | " symboling enginesize horsepower\n",
590 | "0 3 130 111\n",
591 | "1 3 130 111\n",
592 | "2 1 152 154\n",
593 | "3 2 109 102\n",
594 | "4 2 136 115\n",
595 | ".. ... ... ...\n",
596 | "200 -1 141 114\n",
597 | "201 -1 141 160\n",
598 | "202 -1 173 134\n",
599 | "203 -1 145 106\n",
600 | "204 -1 141 114\n",
601 | "\n",
602 | "[205 rows x 3 columns]"
603 | ]
604 | },
605 | "execution_count": 5,
606 | "metadata": {},
607 | "output_type": "execute_result"
608 | }
609 | ],
610 | "source": [
611 | "# Filter out target column\n",
612 | "X = df[['symboling', 'enginesize', 'horsepower']]\n",
613 | "\n",
614 | "# Print X\n",
615 | "X"
616 | ]
617 | },
618 | {
619 | "cell_type": "code",
620 | "execution_count": 6,
621 | "metadata": {},
622 | "outputs": [
623 | {
624 | "data": {
625 | "text/plain": [
626 | "0 13495.0\n",
627 | "1 16500.0\n",
628 | "2 16500.0\n",
629 | "3 13950.0\n",
630 | "4 17450.0\n",
631 | " ... \n",
632 | "200 16845.0\n",
633 | "201 19045.0\n",
634 | "202 21485.0\n",
635 | "203 22470.0\n",
636 | "204 22625.0\n",
637 | "Name: price, Length: 205, dtype: float64"
638 | ]
639 | },
640 | "execution_count": 6,
641 | "metadata": {},
642 | "output_type": "execute_result"
643 | }
644 | ],
645 | "source": [
646 | "# Select target column\n",
647 | "y = df['price']\n",
648 | "\n",
649 | "# Print y\n",
650 | "y"
651 | ]
652 | },
653 | {
654 | "cell_type": "markdown",
655 | "metadata": {},
656 | "source": [
657 | "## 4. Model"
658 | ]
659 | },
660 | {
661 | "cell_type": "markdown",
662 | "metadata": {},
663 | "source": [
664 | "In this section we are going to \n",
665 | "- build a lasso regression model, \n",
666 | "- evaluate its accuracy, and \n",
667 | "- make a prediction"
668 | ]
669 | },
670 | {
671 | "cell_type": "markdown",
672 | "metadata": {},
673 | "source": [
674 | "### 4.1. Building the model"
675 | ]
676 | },
677 | {
678 | "cell_type": "markdown",
679 | "metadata": {},
680 | "source": [
681 | "Let's recall three simple steps:\n",
682 | "\n",
683 | "- Split the $X$ & $y$ variables into train and test sets\n",
684 | "- Initialize the model\n",
685 | "- Train the model with the varialbes"
686 | ]
687 | },
688 | {
689 | "cell_type": "code",
690 | "execution_count": 10,
691 | "metadata": {},
692 | "outputs": [],
693 | "source": [
694 | "# Split variables into train and test\n",
695 | "X_train, X_test, y_train, y_test = train_test_split(X, #independent variables\n",
696 | " y, #dependent variable\n",
697 | " random_state = 3\n",
698 | " )"
699 | ]
700 | },
701 | {
702 | "cell_type": "code",
703 | "execution_count": 11,
704 | "metadata": {},
705 | "outputs": [],
706 | "source": [
707 | "# Initialize the model\n",
708 | "reg = Lasso(alpha=2.0, max_iter = 10000)"
709 | ]
710 | },
711 | {
712 | "cell_type": "code",
713 | "execution_count": 12,
714 | "metadata": {},
715 | "outputs": [
716 | {
717 | "data": {
718 | "text/html": [
719 | "Lasso(alpha=2.0, max_iter=10000)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org. "
720 | ],
721 | "text/plain": [
722 | "Lasso(alpha=2.0, max_iter=10000)"
723 | ]
724 | },
725 | "execution_count": 12,
726 | "metadata": {},
727 | "output_type": "execute_result"
728 | }
729 | ],
730 | "source": [
731 | "# Train the model\n",
732 | "reg.fit(X_train, y_train)"
733 | ]
734 | },
735 | {
736 | "cell_type": "markdown",
737 | "metadata": {},
738 | "source": [
739 | "### 4.2. Checking models accuracy"
740 | ]
741 | },
742 | {
743 | "cell_type": "markdown",
744 | "metadata": {},
745 | "source": [
746 | "After the model has trained with the data, it's essential to understand how precisely it predicts car prices. For that, we need to check model's accuracy. "
747 | ]
748 | },
749 | {
750 | "cell_type": "code",
751 | "execution_count": 13,
752 | "metadata": {},
753 | "outputs": [
754 | {
755 | "name": "stdout",
756 | "output_type": "stream",
757 | "text": [
758 | "Accuracy (R-squared score) of Lasso Regression model on training set: 0.78\n",
759 | "Accuracy (R-squared score) of Lasso Regression model on test set: 0.82\n"
760 | ]
761 | }
762 | ],
763 | "source": [
764 | "print(f'Accuracy (R-squared score) of Lasso Regression model on training set: {reg.score(X_train, y_train):.2f}')\n",
765 | "print(f'Accuracy (R-squared score) of Lasso Regression model on test set: {reg.score(X_test, y_test):.2f}')"
766 | ]
767 | },
768 | {
769 | "cell_type": "markdown",
770 | "metadata": {},
771 | "source": [
772 | "### 4.3. Making a prediction"
773 | ]
774 | },
775 | {
776 | "cell_type": "markdown",
777 | "metadata": {},
778 | "source": [
779 | "Now that we know the model is accurate enough, we can predict the price of any car by passing independent varialbes `symboling`, `enginesize`, `horsepower` to the model. \n",
780 | "\n",
781 | "\n",
782 | "The method `predict` returns such a prediction."
783 | ]
784 | },
785 | {
786 | "cell_type": "code",
787 | "execution_count": 17,
788 | "metadata": {},
789 | "outputs": [
790 | {
791 | "name": "stderr",
792 | "output_type": "stream",
793 | "text": [
794 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/base.py:409: UserWarning: X does not have valid feature names, but Lasso was fitted with feature names\n",
795 | " warnings.warn(\n"
796 | ]
797 | },
798 | {
799 | "data": {
800 | "text/plain": [
801 | "array([29358.44608125])"
802 | ]
803 | },
804 | "execution_count": 17,
805 | "metadata": {},
806 | "output_type": "execute_result"
807 | }
808 | ],
809 | "source": [
810 | "reg.predict([[0, 180, 249]])"
811 | ]
812 | },
813 | {
814 | "cell_type": "markdown",
815 | "metadata": {},
816 | "source": [
817 | "### 4.4. Understanding Features"
818 | ]
819 | },
820 | {
821 | "cell_type": "markdown",
822 | "metadata": {},
823 | "source": [
824 | "We can use Lasso as a tool to check the prediction power of a feature. "
825 | ]
826 | },
827 | {
828 | "cell_type": "code",
829 | "execution_count": 18,
830 | "metadata": {},
831 | "outputs": [
832 | {
833 | "name": "stdout",
834 | "output_type": "stream",
835 | "text": [
836 | "Features with non-zero weight, sorted by absolute magnitude:\n",
837 | "\tsymboling, -492.567\n",
838 | "\tenginesize, 110.565\n",
839 | "\thorsepower, 68.667\n"
840 | ]
841 | }
842 | ],
843 | "source": [
844 | "print('Features with non-zero weight, sorted by absolute magnitude:')\n",
845 | "\n",
846 | "for e in sorted (list(zip(list(X), reg.coef_)),\n",
847 | " key = lambda e: -abs(e[1])):\n",
848 | " if e[1] != 0:\n",
849 | " print('\\t{}, {:.3f}'.format(e[0], e[1]))"
850 | ]
851 | },
852 | {
853 | "cell_type": "markdown",
854 | "metadata": {},
855 | "source": [
856 | "## 5. Hyperparameters Tuning"
857 | ]
858 | },
859 | {
860 | "cell_type": "markdown",
861 | "metadata": {},
862 | "source": [
863 | "Hyperparameter Tuning is one of the critical steps in model building. It helps in increasing model's accuracy even further."
864 | ]
865 | },
866 | {
867 | "cell_type": "markdown",
868 | "metadata": {},
869 | "source": [
870 | "### 5.1. Playing around with regularization parameter alpha"
871 | ]
872 | },
873 | {
874 | "cell_type": "code",
875 | "execution_count": 34,
876 | "metadata": {},
877 | "outputs": [
878 | {
879 | "name": "stdout",
880 | "output_type": "stream",
881 | "text": [
882 | "Lasso regression: effect of alpha regularization parameter:\n",
883 | "\n",
884 | "Alpha = 0.00\n",
885 | " Features kept: 3, \n",
886 | " r-squared training: 0.78,\n",
887 | " r-squared test: 0.82 \n",
888 | "\n",
889 | "Lasso regression: effect of alpha regularization parameter:\n",
890 | "\n",
891 | "Alpha = 1.00\n",
892 | " Features kept: 3, \n",
893 | " r-squared training: 0.78,\n",
894 | " r-squared test: 0.82 \n",
895 | "\n",
896 | "Lasso regression: effect of alpha regularization parameter:\n",
897 | "\n",
898 | "Alpha = 10.00\n",
899 | " Features kept: 3, \n",
900 | " r-squared training: 0.78,\n",
901 | " r-squared test: 0.82 \n",
902 | "\n",
903 | "Lasso regression: effect of alpha regularization parameter:\n",
904 | "\n",
905 | "Alpha = 20.00\n",
906 | " Features kept: 3, \n",
907 | " r-squared training: 0.78,\n",
908 | " r-squared test: 0.82 \n",
909 | "\n",
910 | "Lasso regression: effect of alpha regularization parameter:\n",
911 | "\n",
912 | "Alpha = 50.00\n",
913 | " Features kept: 3, \n",
914 | " r-squared training: 0.78,\n",
915 | " r-squared test: 0.82 \n",
916 | "\n",
917 | "Lasso regression: effect of alpha regularization parameter:\n",
918 | "\n",
919 | "Alpha = 100.00\n",
920 | " Features kept: 3, \n",
921 | " r-squared training: 0.78,\n",
922 | " r-squared test: 0.82 \n",
923 | "\n"
924 | ]
925 | },
926 | {
927 | "name": "stderr",
928 | "output_type": "stream",
929 | "text": [
930 | "/var/folders/5y/7zvhsc3x5nx162713kvx9c1m0000gn/T/ipykernel_44918/1770655528.py:7: UserWarning: With alpha=0, this algorithm does not converge well. You are advised to use the LinearRegression estimator\n",
931 | " reg.fit(X_train, y_train)\n",
932 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/linear_model/_coordinate_descent.py:634: UserWarning: Coordinate descent with no regularization may lead to unexpected results and is discouraged.\n",
933 | " model = cd_fast.enet_coordinate_descent(\n",
934 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/linear_model/_coordinate_descent.py:634: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations, check the scale of the features or consider increasing regularisation. Duality gap: 1.002e+09, tolerance: 9.162e+05 Linear regression models with null weight for the l1 regularization term are more efficiently fitted using one of the solvers implemented in sklearn.linear_model.Ridge/RidgeCV instead.\n",
935 | " model = cd_fast.enet_coordinate_descent(\n"
936 | ]
937 | }
938 | ],
939 | "source": [
940 | "# Lasso regression: effect of alpha regularization parameter:\n",
941 | "\n",
942 | "for this_alpha in [0, 1, 10, 20, 50, 100]:\n",
943 | " \n",
944 | " # Initialize the model\n",
945 | " reg = Lasso(alpha=this_alpha, max_iter = 10000)\n",
946 | " \n",
947 | " # Train the model\n",
948 | " reg.fit(X_train, y_train)\n",
949 | " \n",
950 | " #Save accuracy\n",
951 | " r2_train = reg.score(X_train, y_train)\n",
952 | " r2_test = reg.score(X_test, y_test)\n",
953 | " \n",
954 | " # Print accuracy\n",
955 | " print(f'''Alpha = {this_alpha:.2f}\n",
956 | " Features kept: {len(reg.coef_ != 0)}, \n",
957 | " r-squared training: {r2_train:.2f},\n",
958 | " r-squared test: {r2_test:.2f} \\n''')"
959 | ]
960 | },
961 | {
962 | "cell_type": "markdown",
963 | "metadata": {},
964 | "source": [
965 | "### 5.2. All Hyperparameters of Lasso Regression"
966 | ]
967 | },
968 | {
969 | "cell_type": "markdown",
970 | "metadata": {},
971 | "source": [
972 | "There are many hyperparameters in Lasso Regression. They are all presented below - as you can see, they have values by default. Feel free to play around with them. To learn more about hyperparameters and their meaning, visit https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso."
973 | ]
974 | },
975 | {
976 | "cell_type": "code",
977 | "execution_count": 33,
978 | "metadata": {},
979 | "outputs": [],
980 | "source": [
981 | "reg = Lasso(alpha=1.0, \n",
982 | " fit_intercept=True, \n",
983 | " precompute=False, \n",
984 | " copy_X=True, \n",
985 | " max_iter=1000, \n",
986 | " tol=0.0001, \n",
987 | " warm_start=False, \n",
988 | " positive=False, \n",
989 | " random_state=None, \n",
990 | " selection='cyclic')"
991 | ]
992 | }
993 | ],
994 | "metadata": {
995 | "kernelspec": {
996 | "display_name": "Python 3 (ipykernel)",
997 | "language": "python",
998 | "name": "python3"
999 | },
1000 | "language_info": {
1001 | "codemirror_mode": {
1002 | "name": "ipython",
1003 | "version": 3
1004 | },
1005 | "file_extension": ".py",
1006 | "mimetype": "text/x-python",
1007 | "name": "python",
1008 | "nbconvert_exporter": "python",
1009 | "pygments_lexer": "ipython3",
1010 | "version": "3.10.7"
1011 | }
1012 | },
1013 | "nbformat": 4,
1014 | "nbformat_minor": 2
1015 | }
1016 |
--------------------------------------------------------------------------------
/regression/neural_networks_regressor.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Neural Networks Regression"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "- This is a supplement material for my lectures on ML. It sheds light on Python implementations of the supervised machine learning algorithms. \n",
15 | "- I assume you know Python syntax and how it works. If you don't, I highly recommend you to take a break and get introduced to the language before going forward with my code. \n",
16 | "- This material is represented as a Jupyter notebook, which you can easily download to reproduce the code and play around with it. "
17 | ]
18 | },
19 | {
20 | "cell_type": "markdown",
21 | "metadata": {},
22 | "source": [
23 | "## 1. Libraries"
24 | ]
25 | },
26 | {
27 | "cell_type": "markdown",
28 | "metadata": {},
29 | "source": [
30 | "To build a model, we need \n",
31 | "- `pandas` library to work with panel dataframes\n",
32 | "- `sklearn.model_selection.train_test_split` to split the dataset into train and test\n",
33 | "- `sklearn.neural_network.MLPRegressor` to build a model\n",
34 | "\n",
35 | ""
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "execution_count": 1,
41 | "metadata": {},
42 | "outputs": [],
43 | "source": [
44 | "import pandas as pd\n",
45 | "from sklearn.neural_network import MLPRegressor\n",
46 | "from sklearn.model_selection import train_test_split"
47 | ]
48 | },
49 | {
50 | "cell_type": "markdown",
51 | "metadata": {},
52 | "source": [
53 | "## 2. Data Load & Overview"
54 | ]
55 | },
56 | {
57 | "cell_type": "markdown",
58 | "metadata": {},
59 | "source": [
60 | "Let's load the dataset and understand it."
61 | ]
62 | },
63 | {
64 | "cell_type": "code",
65 | "execution_count": 2,
66 | "metadata": {},
67 | "outputs": [],
68 | "source": [
69 | "# Load the dataset\n",
70 | "df = pd.read_csv('https://raw.githubusercontent.com/5x12/ml-cookbook/master/supplements/data/cars.csv')"
71 | ]
72 | },
73 | {
74 | "cell_type": "code",
75 | "execution_count": 3,
76 | "metadata": {},
77 | "outputs": [
78 | {
79 | "data": {
80 | "text/html": [
81 | "\n",
82 | "\n",
95 | "
\n",
96 | " \n",
97 | " \n",
98 | " | \n",
99 | " car_ID | \n",
100 | " symboling | \n",
101 | " CarName | \n",
102 | " fueltype | \n",
103 | " aspiration | \n",
104 | " doornumber | \n",
105 | " carbody | \n",
106 | " drivewheel | \n",
107 | " enginelocation | \n",
108 | " wheelbase | \n",
109 | " ... | \n",
110 | " enginesize | \n",
111 | " fuelsystem | \n",
112 | " boreratio | \n",
113 | " stroke | \n",
114 | " compressionratio | \n",
115 | " horsepower | \n",
116 | " peakrpm | \n",
117 | " citympg | \n",
118 | " highwaympg | \n",
119 | " price | \n",
120 | "
\n",
121 | " \n",
122 | " \n",
123 | " \n",
124 | " 0 | \n",
125 | " 1 | \n",
126 | " 3 | \n",
127 | " alfa-romero giulia | \n",
128 | " gas | \n",
129 | " std | \n",
130 | " two | \n",
131 | " convertible | \n",
132 | " rwd | \n",
133 | " front | \n",
134 | " 88.6 | \n",
135 | " ... | \n",
136 | " 130 | \n",
137 | " mpfi | \n",
138 | " 3.47 | \n",
139 | " 2.68 | \n",
140 | " 9.0 | \n",
141 | " 111 | \n",
142 | " 5000 | \n",
143 | " 21 | \n",
144 | " 27 | \n",
145 | " 13495.000 | \n",
146 | "
\n",
147 | " \n",
148 | " 1 | \n",
149 | " 2 | \n",
150 | " 3 | \n",
151 | " alfa-romero stelvio | \n",
152 | " gas | \n",
153 | " std | \n",
154 | " two | \n",
155 | " convertible | \n",
156 | " rwd | \n",
157 | " front | \n",
158 | " 88.6 | \n",
159 | " ... | \n",
160 | " 130 | \n",
161 | " mpfi | \n",
162 | " 3.47 | \n",
163 | " 2.68 | \n",
164 | " 9.0 | \n",
165 | " 111 | \n",
166 | " 5000 | \n",
167 | " 21 | \n",
168 | " 27 | \n",
169 | " 16500.000 | \n",
170 | "
\n",
171 | " \n",
172 | " 2 | \n",
173 | " 3 | \n",
174 | " 1 | \n",
175 | " alfa-romero Quadrifoglio | \n",
176 | " gas | \n",
177 | " std | \n",
178 | " two | \n",
179 | " hatchback | \n",
180 | " rwd | \n",
181 | " front | \n",
182 | " 94.5 | \n",
183 | " ... | \n",
184 | " 152 | \n",
185 | " mpfi | \n",
186 | " 2.68 | \n",
187 | " 3.47 | \n",
188 | " 9.0 | \n",
189 | " 154 | \n",
190 | " 5000 | \n",
191 | " 19 | \n",
192 | " 26 | \n",
193 | " 16500.000 | \n",
194 | "
\n",
195 | " \n",
196 | " 3 | \n",
197 | " 4 | \n",
198 | " 2 | \n",
199 | " audi 100 ls | \n",
200 | " gas | \n",
201 | " std | \n",
202 | " four | \n",
203 | " sedan | \n",
204 | " fwd | \n",
205 | " front | \n",
206 | " 99.8 | \n",
207 | " ... | \n",
208 | " 109 | \n",
209 | " mpfi | \n",
210 | " 3.19 | \n",
211 | " 3.40 | \n",
212 | " 10.0 | \n",
213 | " 102 | \n",
214 | " 5500 | \n",
215 | " 24 | \n",
216 | " 30 | \n",
217 | " 13950.000 | \n",
218 | "
\n",
219 | " \n",
220 | " 4 | \n",
221 | " 5 | \n",
222 | " 2 | \n",
223 | " audi 100ls | \n",
224 | " gas | \n",
225 | " std | \n",
226 | " four | \n",
227 | " sedan | \n",
228 | " 4wd | \n",
229 | " front | \n",
230 | " 99.4 | \n",
231 | " ... | \n",
232 | " 136 | \n",
233 | " mpfi | \n",
234 | " 3.19 | \n",
235 | " 3.40 | \n",
236 | " 8.0 | \n",
237 | " 115 | \n",
238 | " 5500 | \n",
239 | " 18 | \n",
240 | " 22 | \n",
241 | " 17450.000 | \n",
242 | "
\n",
243 | " \n",
244 | " 5 | \n",
245 | " 6 | \n",
246 | " 2 | \n",
247 | " audi fox | \n",
248 | " gas | \n",
249 | " std | \n",
250 | " two | \n",
251 | " sedan | \n",
252 | " fwd | \n",
253 | " front | \n",
254 | " 99.8 | \n",
255 | " ... | \n",
256 | " 136 | \n",
257 | " mpfi | \n",
258 | " 3.19 | \n",
259 | " 3.40 | \n",
260 | " 8.5 | \n",
261 | " 110 | \n",
262 | " 5500 | \n",
263 | " 19 | \n",
264 | " 25 | \n",
265 | " 15250.000 | \n",
266 | "
\n",
267 | " \n",
268 | " 6 | \n",
269 | " 7 | \n",
270 | " 1 | \n",
271 | " audi 100ls | \n",
272 | " gas | \n",
273 | " std | \n",
274 | " four | \n",
275 | " sedan | \n",
276 | " fwd | \n",
277 | " front | \n",
278 | " 105.8 | \n",
279 | " ... | \n",
280 | " 136 | \n",
281 | " mpfi | \n",
282 | " 3.19 | \n",
283 | " 3.40 | \n",
284 | " 8.5 | \n",
285 | " 110 | \n",
286 | " 5500 | \n",
287 | " 19 | \n",
288 | " 25 | \n",
289 | " 17710.000 | \n",
290 | "
\n",
291 | " \n",
292 | " 7 | \n",
293 | " 8 | \n",
294 | " 1 | \n",
295 | " audi 5000 | \n",
296 | " gas | \n",
297 | " std | \n",
298 | " four | \n",
299 | " wagon | \n",
300 | " fwd | \n",
301 | " front | \n",
302 | " 105.8 | \n",
303 | " ... | \n",
304 | " 136 | \n",
305 | " mpfi | \n",
306 | " 3.19 | \n",
307 | " 3.40 | \n",
308 | " 8.5 | \n",
309 | " 110 | \n",
310 | " 5500 | \n",
311 | " 19 | \n",
312 | " 25 | \n",
313 | " 18920.000 | \n",
314 | "
\n",
315 | " \n",
316 | " 8 | \n",
317 | " 9 | \n",
318 | " 1 | \n",
319 | " audi 4000 | \n",
320 | " gas | \n",
321 | " turbo | \n",
322 | " four | \n",
323 | " sedan | \n",
324 | " fwd | \n",
325 | " front | \n",
326 | " 105.8 | \n",
327 | " ... | \n",
328 | " 131 | \n",
329 | " mpfi | \n",
330 | " 3.13 | \n",
331 | " 3.40 | \n",
332 | " 8.3 | \n",
333 | " 140 | \n",
334 | " 5500 | \n",
335 | " 17 | \n",
336 | " 20 | \n",
337 | " 23875.000 | \n",
338 | "
\n",
339 | " \n",
340 | " 9 | \n",
341 | " 10 | \n",
342 | " 0 | \n",
343 | " audi 5000s (diesel) | \n",
344 | " gas | \n",
345 | " turbo | \n",
346 | " two | \n",
347 | " hatchback | \n",
348 | " 4wd | \n",
349 | " front | \n",
350 | " 99.5 | \n",
351 | " ... | \n",
352 | " 131 | \n",
353 | " mpfi | \n",
354 | " 3.13 | \n",
355 | " 3.40 | \n",
356 | " 7.0 | \n",
357 | " 160 | \n",
358 | " 5500 | \n",
359 | " 16 | \n",
360 | " 22 | \n",
361 | " 17859.167 | \n",
362 | "
\n",
363 | " \n",
364 | "
\n",
365 | "
10 rows × 26 columns
\n",
366 | "
"
367 | ],
368 | "text/plain": [
369 | " car_ID symboling CarName fueltype aspiration doornumber \\\n",
370 | "0 1 3 alfa-romero giulia gas std two \n",
371 | "1 2 3 alfa-romero stelvio gas std two \n",
372 | "2 3 1 alfa-romero Quadrifoglio gas std two \n",
373 | "3 4 2 audi 100 ls gas std four \n",
374 | "4 5 2 audi 100ls gas std four \n",
375 | "5 6 2 audi fox gas std two \n",
376 | "6 7 1 audi 100ls gas std four \n",
377 | "7 8 1 audi 5000 gas std four \n",
378 | "8 9 1 audi 4000 gas turbo four \n",
379 | "9 10 0 audi 5000s (diesel) gas turbo two \n",
380 | "\n",
381 | " carbody drivewheel enginelocation wheelbase ... enginesize \\\n",
382 | "0 convertible rwd front 88.6 ... 130 \n",
383 | "1 convertible rwd front 88.6 ... 130 \n",
384 | "2 hatchback rwd front 94.5 ... 152 \n",
385 | "3 sedan fwd front 99.8 ... 109 \n",
386 | "4 sedan 4wd front 99.4 ... 136 \n",
387 | "5 sedan fwd front 99.8 ... 136 \n",
388 | "6 sedan fwd front 105.8 ... 136 \n",
389 | "7 wagon fwd front 105.8 ... 136 \n",
390 | "8 sedan fwd front 105.8 ... 131 \n",
391 | "9 hatchback 4wd front 99.5 ... 131 \n",
392 | "\n",
393 | " fuelsystem boreratio stroke compressionratio horsepower peakrpm citympg \\\n",
394 | "0 mpfi 3.47 2.68 9.0 111 5000 21 \n",
395 | "1 mpfi 3.47 2.68 9.0 111 5000 21 \n",
396 | "2 mpfi 2.68 3.47 9.0 154 5000 19 \n",
397 | "3 mpfi 3.19 3.40 10.0 102 5500 24 \n",
398 | "4 mpfi 3.19 3.40 8.0 115 5500 18 \n",
399 | "5 mpfi 3.19 3.40 8.5 110 5500 19 \n",
400 | "6 mpfi 3.19 3.40 8.5 110 5500 19 \n",
401 | "7 mpfi 3.19 3.40 8.5 110 5500 19 \n",
402 | "8 mpfi 3.13 3.40 8.3 140 5500 17 \n",
403 | "9 mpfi 3.13 3.40 7.0 160 5500 16 \n",
404 | "\n",
405 | " highwaympg price \n",
406 | "0 27 13495.000 \n",
407 | "1 27 16500.000 \n",
408 | "2 26 16500.000 \n",
409 | "3 30 13950.000 \n",
410 | "4 22 17450.000 \n",
411 | "5 25 15250.000 \n",
412 | "6 25 17710.000 \n",
413 | "7 25 18920.000 \n",
414 | "8 20 23875.000 \n",
415 | "9 22 17859.167 \n",
416 | "\n",
417 | "[10 rows x 26 columns]"
418 | ]
419 | },
420 | "execution_count": 3,
421 | "metadata": {},
422 | "output_type": "execute_result"
423 | }
424 | ],
425 | "source": [
426 | "# Print the first 10 rows of the dataset\n",
427 | "df.head(10)"
428 | ]
429 | },
430 | {
431 | "cell_type": "markdown",
432 | "metadata": {},
433 | "source": [
434 | "This Cars Dataset represents cars characteristics, along with their prices.\n",
435 | "\n",
436 | "- `car_ID`: Unique id of each observation (Interger)\n",
437 | "- `symboling`: Its assigned insurance risk rating, A value of +3 indicates that the auto is risky, -3 that it is probably pretty safe.(Categorical) \t\t\n",
438 | "- `carCompany`: Name of car company (Categorical)\t\t\n",
439 | "- `fueltype`: Car fuel type i.e gas or diesel (Categorical)\t\t\n",
440 | "- `aspiration`: Aspiration used in a car (Categorical)\t\t\n",
441 | "- `doornumber`: Number of doors in a car (Categorical)\t\t\n",
442 | "- `carbody`: body of car (Categorical)\t\t\n",
443 | "- `drivewheel`: type of drive wheel (Categorical)\t\t\n",
444 | "- `enginelocation`: Location of car engine (Categorical)\t\t\n",
445 | "- `wheelbase`: Weelbase of car (Numeric)\t\t\n",
446 | "- `carlength`: Length of car (Numeric)\t\t\n",
447 | "- `carwidth`: Width of car (Numeric)\t\t\n",
448 | "- `carheight` Height of car (Numeric)\t\t\n",
449 | "- `curbweight` The weight of a car without occupants or baggage. (Numeric)\t\t\n",
450 | "- `enginetype`: Type of engine. (Categorical)\t\t\n",
451 | "- `cylindernumber`: Cylinder placed in the car (Categorical)\t\t\n",
452 | "- `enginesize`: Size of car (Numeric)\t\t\n",
453 | "- `fuelsystem`: Fuel system of car (Categorical)\t\t\n",
454 | "- `boreratio`: Boreratio of car (Numeric)\t\t\n",
455 | "- `stroke`: Stroke or volume inside the engine (Numeric)\t\t\n",
456 | "- `compressionratio`: Compression ratio of car (Numeric)\t\t\n",
457 | "- `horsepower`: Horsepower (Numeric)\t\t\n",
458 | "- `peakrpm`: Car peak rpm (Numeric)\t\t\n",
459 | "- `citympg`: Mileage in city (Numeric)\t\t\n",
460 | "- `highwaympg`: Mileage on highway (Numeric)\t\t\n",
461 | "- `price` (Dependent variable): Price of car in \\$ (Numeric)\n",
462 | "\n",
463 | "The main aim is to build **a model that predicts a price of a car** (`price` column) based on independent variables."
464 | ]
465 | },
466 | {
467 | "cell_type": "markdown",
468 | "metadata": {},
469 | "source": [
470 | "## 3. Variables"
471 | ]
472 | },
473 | {
474 | "cell_type": "markdown",
475 | "metadata": {},
476 | "source": [
477 | "Let's split the dataset into X and y, where \n",
478 | "- $X$ is a set of independent variables\n",
479 | "- $y$ is a dependent, or target variable (the last column)\n",
480 | "\n",
481 | "To make things simpler, let's pick 3 independent variables."
482 | ]
483 | },
484 | {
485 | "cell_type": "code",
486 | "execution_count": 4,
487 | "metadata": {},
488 | "outputs": [
489 | {
490 | "data": {
491 | "text/html": [
492 | "\n",
493 | "\n",
506 | "
\n",
507 | " \n",
508 | " \n",
509 | " | \n",
510 | " symboling | \n",
511 | " enginesize | \n",
512 | " horsepower | \n",
513 | "
\n",
514 | " \n",
515 | " \n",
516 | " \n",
517 | " 0 | \n",
518 | " 3 | \n",
519 | " 130 | \n",
520 | " 111 | \n",
521 | "
\n",
522 | " \n",
523 | " 1 | \n",
524 | " 3 | \n",
525 | " 130 | \n",
526 | " 111 | \n",
527 | "
\n",
528 | " \n",
529 | " 2 | \n",
530 | " 1 | \n",
531 | " 152 | \n",
532 | " 154 | \n",
533 | "
\n",
534 | " \n",
535 | " 3 | \n",
536 | " 2 | \n",
537 | " 109 | \n",
538 | " 102 | \n",
539 | "
\n",
540 | " \n",
541 | " 4 | \n",
542 | " 2 | \n",
543 | " 136 | \n",
544 | " 115 | \n",
545 | "
\n",
546 | " \n",
547 | " ... | \n",
548 | " ... | \n",
549 | " ... | \n",
550 | " ... | \n",
551 | "
\n",
552 | " \n",
553 | " 200 | \n",
554 | " -1 | \n",
555 | " 141 | \n",
556 | " 114 | \n",
557 | "
\n",
558 | " \n",
559 | " 201 | \n",
560 | " -1 | \n",
561 | " 141 | \n",
562 | " 160 | \n",
563 | "
\n",
564 | " \n",
565 | " 202 | \n",
566 | " -1 | \n",
567 | " 173 | \n",
568 | " 134 | \n",
569 | "
\n",
570 | " \n",
571 | " 203 | \n",
572 | " -1 | \n",
573 | " 145 | \n",
574 | " 106 | \n",
575 | "
\n",
576 | " \n",
577 | " 204 | \n",
578 | " -1 | \n",
579 | " 141 | \n",
580 | " 114 | \n",
581 | "
\n",
582 | " \n",
583 | "
\n",
584 | "
205 rows × 3 columns
\n",
585 | "
"
586 | ],
587 | "text/plain": [
588 | " symboling enginesize horsepower\n",
589 | "0 3 130 111\n",
590 | "1 3 130 111\n",
591 | "2 1 152 154\n",
592 | "3 2 109 102\n",
593 | "4 2 136 115\n",
594 | ".. ... ... ...\n",
595 | "200 -1 141 114\n",
596 | "201 -1 141 160\n",
597 | "202 -1 173 134\n",
598 | "203 -1 145 106\n",
599 | "204 -1 141 114\n",
600 | "\n",
601 | "[205 rows x 3 columns]"
602 | ]
603 | },
604 | "execution_count": 4,
605 | "metadata": {},
606 | "output_type": "execute_result"
607 | }
608 | ],
609 | "source": [
610 | "# Filter out target column\n",
611 | "X = df[['symboling', 'enginesize', 'horsepower']]\n",
612 | "\n",
613 | "# Print X\n",
614 | "X"
615 | ]
616 | },
617 | {
618 | "cell_type": "code",
619 | "execution_count": 5,
620 | "metadata": {},
621 | "outputs": [
622 | {
623 | "data": {
624 | "text/plain": [
625 | "0 13495.0\n",
626 | "1 16500.0\n",
627 | "2 16500.0\n",
628 | "3 13950.0\n",
629 | "4 17450.0\n",
630 | " ... \n",
631 | "200 16845.0\n",
632 | "201 19045.0\n",
633 | "202 21485.0\n",
634 | "203 22470.0\n",
635 | "204 22625.0\n",
636 | "Name: price, Length: 205, dtype: float64"
637 | ]
638 | },
639 | "execution_count": 5,
640 | "metadata": {},
641 | "output_type": "execute_result"
642 | }
643 | ],
644 | "source": [
645 | "# Select target column\n",
646 | "y = df['price']\n",
647 | "\n",
648 | "# Print y\n",
649 | "y"
650 | ]
651 | },
652 | {
653 | "cell_type": "markdown",
654 | "metadata": {},
655 | "source": [
656 | "## 4. Model"
657 | ]
658 | },
659 | {
660 | "cell_type": "markdown",
661 | "metadata": {},
662 | "source": [
663 | "In this section we are going to \n",
664 | "- build a neural nets model, \n",
665 | "- evaluate its accuracy, and \n",
666 | "- make a prediction"
667 | ]
668 | },
669 | {
670 | "cell_type": "markdown",
671 | "metadata": {},
672 | "source": [
673 | "### 4.1. Building the model"
674 | ]
675 | },
676 | {
677 | "cell_type": "markdown",
678 | "metadata": {},
679 | "source": [
680 | "Let's recall three simple steps:\n",
681 | "\n",
682 | "- Split the $X$ & $y$ variables into train and test sets\n",
683 | "- Initialize the model\n",
684 | "- Train the model with the varialbes"
685 | ]
686 | },
687 | {
688 | "cell_type": "code",
689 | "execution_count": 6,
690 | "metadata": {},
691 | "outputs": [],
692 | "source": [
693 | "# Split variables into train and test\n",
694 | "X_train, X_test, y_train, y_test = train_test_split(X, #independent variables\n",
695 | " y, #dependent variable\n",
696 | " random_state = 3\n",
697 | " )"
698 | ]
699 | },
700 | {
701 | "cell_type": "code",
702 | "execution_count": 9,
703 | "metadata": {},
704 | "outputs": [],
705 | "source": [
706 | "# Initialize the model\n",
707 | "reg = MLPRegressor(hidden_layer_sizes = [100, 100], \n",
708 | " alpha = 5.0, \n",
709 | " random_state = 3\n",
710 | " )"
711 | ]
712 | },
713 | {
714 | "cell_type": "code",
715 | "execution_count": 10,
716 | "metadata": {},
717 | "outputs": [
718 | {
719 | "data": {
720 | "text/html": [
721 | "MLPRegressor(alpha=5.0, hidden_layer_sizes=[100, 100], random_state=3)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org. "
722 | ],
723 | "text/plain": [
724 | "MLPRegressor(alpha=5.0, hidden_layer_sizes=[100, 100], random_state=3)"
725 | ]
726 | },
727 | "execution_count": 10,
728 | "metadata": {},
729 | "output_type": "execute_result"
730 | }
731 | ],
732 | "source": [
733 | "# Train the model\n",
734 | "reg.fit(X_train, y_train)"
735 | ]
736 | },
737 | {
738 | "cell_type": "markdown",
739 | "metadata": {},
740 | "source": [
741 | "### 4.2. Checking models accuracy"
742 | ]
743 | },
744 | {
745 | "cell_type": "markdown",
746 | "metadata": {},
747 | "source": [
748 | "After the model has trained with the data, it's essential to understand how precisely it predicts car prices. For that, we need to check model's accuracy. "
749 | ]
750 | },
751 | {
752 | "cell_type": "code",
753 | "execution_count": 11,
754 | "metadata": {},
755 | "outputs": [
756 | {
757 | "name": "stdout",
758 | "output_type": "stream",
759 | "text": [
760 | "Accuracy (R-squared score) of NN regression model on training set: 0.67\n",
761 | "Accuracy (R-squared score) of NN regression model on test set: 0.71\n"
762 | ]
763 | }
764 | ],
765 | "source": [
766 | "print(f'Accuracy (R-squared score) of NN regression model on training set: {reg.score(X_train, y_train):.2f}')\n",
767 | "print(f'Accuracy (R-squared score) of NN regression model on test set: {reg.score(X_test, y_test):.2f}')"
768 | ]
769 | },
770 | {
771 | "cell_type": "markdown",
772 | "metadata": {},
773 | "source": [
774 | "### 4.3. Making a prediction"
775 | ]
776 | },
777 | {
778 | "cell_type": "markdown",
779 | "metadata": {},
780 | "source": [
781 | "Now that we know the model is accurate enough, we can predict the price of any car by passing independent varialbes `symboling`, `enginesize`, `horsepower` to the model. \n",
782 | "\n",
783 | "\n",
784 | "The method `predict` returns such a prediction."
785 | ]
786 | },
787 | {
788 | "cell_type": "code",
789 | "execution_count": 12,
790 | "metadata": {},
791 | "outputs": [
792 | {
793 | "name": "stderr",
794 | "output_type": "stream",
795 | "text": [
796 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/base.py:409: UserWarning: X does not have valid feature names, but MLPRegressor was fitted with feature names\n",
797 | " warnings.warn(\n"
798 | ]
799 | },
800 | {
801 | "data": {
802 | "text/plain": [
803 | "array([25421.43933963])"
804 | ]
805 | },
806 | "execution_count": 12,
807 | "metadata": {},
808 | "output_type": "execute_result"
809 | }
810 | ],
811 | "source": [
812 | "reg.predict([[0, 180, 249]])"
813 | ]
814 | },
815 | {
816 | "cell_type": "markdown",
817 | "metadata": {},
818 | "source": [
819 | "## 5. Hyperparameters Tuning"
820 | ]
821 | },
822 | {
823 | "cell_type": "markdown",
824 | "metadata": {},
825 | "source": [
826 | "Hyperparameter Tuning is one of the critical steps in model building. It helps in increasing model's accuracy even further."
827 | ]
828 | },
829 | {
830 | "cell_type": "markdown",
831 | "metadata": {},
832 | "source": [
833 | "### 5.1. Playing around with activation functions and regularization parameter alpha"
834 | ]
835 | },
836 | {
837 | "cell_type": "code",
838 | "execution_count": 16,
839 | "metadata": {},
840 | "outputs": [
841 | {
842 | "name": "stderr",
843 | "output_type": "stream",
844 | "text": [
845 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
846 | " warnings.warn(\n"
847 | ]
848 | },
849 | {
850 | "name": "stdout",
851 | "output_type": "stream",
852 | "text": [
853 | "activation funtion = tanh || alpha = 0.0001\n",
854 | " r-squared training: -2.83,\n",
855 | " r-squared test: -2.64 \n",
856 | "\n"
857 | ]
858 | },
859 | {
860 | "name": "stderr",
861 | "output_type": "stream",
862 | "text": [
863 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
864 | " warnings.warn(\n"
865 | ]
866 | },
867 | {
868 | "name": "stdout",
869 | "output_type": "stream",
870 | "text": [
871 | "activation funtion = tanh || alpha = 1.0\n",
872 | " r-squared training: -2.83,\n",
873 | " r-squared test: -2.64 \n",
874 | "\n"
875 | ]
876 | },
877 | {
878 | "name": "stderr",
879 | "output_type": "stream",
880 | "text": [
881 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
882 | " warnings.warn(\n",
883 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
884 | " warnings.warn(\n"
885 | ]
886 | },
887 | {
888 | "name": "stdout",
889 | "output_type": "stream",
890 | "text": [
891 | "activation funtion = tanh || alpha = 100\n",
892 | " r-squared training: -2.83,\n",
893 | " r-squared test: -2.64 \n",
894 | "\n",
895 | "activation funtion = relu || alpha = 0.0001\n",
896 | " r-squared training: 0.65,\n",
897 | " r-squared test: 0.65 \n",
898 | "\n",
899 | "activation funtion = relu || alpha = 1.0\n",
900 | " r-squared training: 0.67,\n",
901 | " r-squared test: 0.68 \n",
902 | "\n",
903 | "activation funtion = relu || alpha = 100\n",
904 | " r-squared training: 0.67,\n",
905 | " r-squared test: 0.71 \n",
906 | "\n"
907 | ]
908 | },
909 | {
910 | "name": "stderr",
911 | "output_type": "stream",
912 | "text": [
913 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
914 | " warnings.warn(\n",
915 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
916 | " warnings.warn(\n"
917 | ]
918 | }
919 | ],
920 | "source": [
921 | "# Accuracy with different activation functions and regularization parameter alpha\n",
922 | "\n",
923 | "for this_activation in ['tanh', 'relu']:\n",
924 | " for this_alpha in [0.0001, 1.0, 100]:\n",
925 | " \n",
926 | " # Initialize the model\n",
927 | " reg = MLPRegressor(hidden_layer_sizes = [100,100],\n",
928 | " activation = this_activation,\n",
929 | " alpha = this_alpha)\n",
930 | " \n",
931 | " # Train the model\n",
932 | " reg.fit(X_train, y_train)\n",
933 | " \n",
934 | " # Print results\n",
935 | " print(f'''activation funtion = {this_activation} || alpha = {this_alpha}\n",
936 | " r-squared training: {reg.score(X_train, y_train):.2f},\n",
937 | " r-squared test: {reg.score(X_test, y_test):.2f} \\n''')"
938 | ]
939 | },
940 | {
941 | "cell_type": "markdown",
942 | "metadata": {},
943 | "source": [
944 | "### 5.2. All Hyperparameters of NN Regression"
945 | ]
946 | },
947 | {
948 | "cell_type": "markdown",
949 | "metadata": {},
950 | "source": [
951 | "There are many hyperparameters in Ridge Regression. They are all presented below - as you can see, they have values by default. Feel free to play around with them. To learn more about hyperparameters and their meaning, visit https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor."
952 | ]
953 | },
954 | {
955 | "cell_type": "code",
956 | "execution_count": 17,
957 | "metadata": {},
958 | "outputs": [],
959 | "source": [
960 | "reg = MLPRegressor(hidden_layer_sizes=(100,), \n",
961 | " activation='relu',\n",
962 | " solver='adam', \n",
963 | " alpha=0.0001, \n",
964 | " batch_size='auto', \n",
965 | " learning_rate='constant', \n",
966 | " learning_rate_init=0.001, \n",
967 | " power_t=0.5, \n",
968 | " max_iter=200, \n",
969 | " shuffle=True, \n",
970 | " random_state=None, \n",
971 | " tol=0.0001, \n",
972 | " verbose=False, \n",
973 | " warm_start=False, \n",
974 | " momentum=0.9, \n",
975 | " nesterovs_momentum=True, \n",
976 | " early_stopping=False, \n",
977 | " validation_fraction=0.1, \n",
978 | " beta_1=0.9, \n",
979 | " beta_2=0.999, \n",
980 | " epsilon=1e-08, \n",
981 | " n_iter_no_change=10, \n",
982 | " max_fun=15000\n",
983 | " )"
984 | ]
985 | },
986 | {
987 | "cell_type": "markdown",
988 | "metadata": {},
989 | "source": [
990 | "## 6. NN Regression with normalized data"
991 | ]
992 | },
993 | {
994 | "cell_type": "markdown",
995 | "metadata": {},
996 | "source": [
997 | "To do"
998 | ]
999 | },
1000 | {
1001 | "cell_type": "code",
1002 | "execution_count": 21,
1003 | "metadata": {},
1004 | "outputs": [
1005 | {
1006 | "name": "stdout",
1007 | "output_type": "stream",
1008 | "text": [
1009 | "Accuracy of NN regressor on training set: -2.84\n",
1010 | "Accuracy of NN regressor on test set: -2.64\n"
1011 | ]
1012 | },
1013 | {
1014 | "name": "stderr",
1015 | "output_type": "stream",
1016 | "text": [
1017 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/neural_network/_multilayer_perceptron.py:679: ConvergenceWarning: Stochastic Optimizer: Maximum iterations (200) reached and the optimization hasn't converged yet.\n",
1018 | " warnings.warn(\n"
1019 | ]
1020 | }
1021 | ],
1022 | "source": [
1023 | "from sklearn.neural_network import MLPClassifier\n",
1024 | "from sklearn.preprocessing import MinMaxScaler\n",
1025 | "from sklearn.neural_network import MLPRegressor\n",
1026 | "\n",
1027 | "#initialize scaler\n",
1028 | "scaler = MinMaxScaler()\n",
1029 | "\n",
1030 | "#transform variables\n",
1031 | "X_train_scaled = scaler.fit_transform(X_train)\n",
1032 | "X_test_scaled = scaler.transform(X_test)\n",
1033 | "\n",
1034 | "#initialize the model\n",
1035 | "clf = MLPRegressor(hidden_layer_sizes = [100, 100], alpha = 5.0, random_state = 3)\n",
1036 | "\n",
1037 | "#train the model\n",
1038 | "reg.fit(X_train_scaled, y_train)\n",
1039 | "\n",
1040 | "#print results\n",
1041 | "print(f'Accuracy of NN regressor on training set: {reg.score(X_train_scaled, y_train):.2f}')\n",
1042 | "print(f'Accuracy of NN regressor on test set: {reg.score(X_test_scaled, y_test):.2f}')"
1043 | ]
1044 | },
1045 | {
1046 | "cell_type": "code",
1047 | "execution_count": null,
1048 | "metadata": {},
1049 | "outputs": [],
1050 | "source": []
1051 | }
1052 | ],
1053 | "metadata": {
1054 | "kernelspec": {
1055 | "display_name": "Python 3 (ipykernel)",
1056 | "language": "python",
1057 | "name": "python3"
1058 | },
1059 | "language_info": {
1060 | "codemirror_mode": {
1061 | "name": "ipython",
1062 | "version": 3
1063 | },
1064 | "file_extension": ".py",
1065 | "mimetype": "text/x-python",
1066 | "name": "python",
1067 | "nbconvert_exporter": "python",
1068 | "pygments_lexer": "ipython3",
1069 | "version": "3.10.7"
1070 | }
1071 | },
1072 | "nbformat": 4,
1073 | "nbformat_minor": 2
1074 | }
1075 |
--------------------------------------------------------------------------------
/regression/ridge_regression.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Ridge Regression"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "- This is a supplement material for my lectures on ML. It sheds light on Python implementations of the supervised machine learning algorithms. \n",
15 | "- I assume you know Python syntax and how it works. If you don't, I highly recommend you to take a break and get introduced to the language before going forward with my code. \n",
16 | "- This material is represented as a Jupyter notebook, which you can easily download to reproduce the code and play around with it. "
17 | ]
18 | },
19 | {
20 | "cell_type": "markdown",
21 | "metadata": {},
22 | "source": [
23 | "## 1. Libraries"
24 | ]
25 | },
26 | {
27 | "cell_type": "markdown",
28 | "metadata": {},
29 | "source": [
30 | "To build a model, we need \n",
31 | "- `pandas` library to work with panel dataframes\n",
32 | "- `sklearn.model_selection.train_test_split` to split the dataset into train and test\n",
33 | "- `sklearn.linear_model.Ridge` to build a model\n",
34 | "\n",
35 | "In addition, I'd like to show you `sklearn.preprocessing.StandardScaler` - a library for data normalization."
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "execution_count": 15,
41 | "metadata": {},
42 | "outputs": [],
43 | "source": [
44 | "import pandas as pd\n",
45 | "from sklearn.preprocessing import StandardScaler\n",
46 | "from sklearn.linear_model import Ridge\n",
47 | "from sklearn.model_selection import train_test_split"
48 | ]
49 | },
50 | {
51 | "cell_type": "markdown",
52 | "metadata": {},
53 | "source": [
54 | "## 2. Data Load & Overview"
55 | ]
56 | },
57 | {
58 | "cell_type": "markdown",
59 | "metadata": {},
60 | "source": [
61 | "Let's load the dataset and understand it."
62 | ]
63 | },
64 | {
65 | "cell_type": "code",
66 | "execution_count": 3,
67 | "metadata": {},
68 | "outputs": [],
69 | "source": [
70 | "# Load the dataset\n",
71 | "df = pd.read_csv('https://raw.githubusercontent.com/5x12/ml-cookbook/master/supplements/data/cars.csv')"
72 | ]
73 | },
74 | {
75 | "cell_type": "code",
76 | "execution_count": 4,
77 | "metadata": {},
78 | "outputs": [
79 | {
80 | "data": {
81 | "text/html": [
82 | "\n",
83 | "\n",
96 | "
\n",
97 | " \n",
98 | " \n",
99 | " | \n",
100 | " car_ID | \n",
101 | " symboling | \n",
102 | " CarName | \n",
103 | " fueltype | \n",
104 | " aspiration | \n",
105 | " doornumber | \n",
106 | " carbody | \n",
107 | " drivewheel | \n",
108 | " enginelocation | \n",
109 | " wheelbase | \n",
110 | " ... | \n",
111 | " enginesize | \n",
112 | " fuelsystem | \n",
113 | " boreratio | \n",
114 | " stroke | \n",
115 | " compressionratio | \n",
116 | " horsepower | \n",
117 | " peakrpm | \n",
118 | " citympg | \n",
119 | " highwaympg | \n",
120 | " price | \n",
121 | "
\n",
122 | " \n",
123 | " \n",
124 | " \n",
125 | " 0 | \n",
126 | " 1 | \n",
127 | " 3 | \n",
128 | " alfa-romero giulia | \n",
129 | " gas | \n",
130 | " std | \n",
131 | " two | \n",
132 | " convertible | \n",
133 | " rwd | \n",
134 | " front | \n",
135 | " 88.6 | \n",
136 | " ... | \n",
137 | " 130 | \n",
138 | " mpfi | \n",
139 | " 3.47 | \n",
140 | " 2.68 | \n",
141 | " 9.0 | \n",
142 | " 111 | \n",
143 | " 5000 | \n",
144 | " 21 | \n",
145 | " 27 | \n",
146 | " 13495.000 | \n",
147 | "
\n",
148 | " \n",
149 | " 1 | \n",
150 | " 2 | \n",
151 | " 3 | \n",
152 | " alfa-romero stelvio | \n",
153 | " gas | \n",
154 | " std | \n",
155 | " two | \n",
156 | " convertible | \n",
157 | " rwd | \n",
158 | " front | \n",
159 | " 88.6 | \n",
160 | " ... | \n",
161 | " 130 | \n",
162 | " mpfi | \n",
163 | " 3.47 | \n",
164 | " 2.68 | \n",
165 | " 9.0 | \n",
166 | " 111 | \n",
167 | " 5000 | \n",
168 | " 21 | \n",
169 | " 27 | \n",
170 | " 16500.000 | \n",
171 | "
\n",
172 | " \n",
173 | " 2 | \n",
174 | " 3 | \n",
175 | " 1 | \n",
176 | " alfa-romero Quadrifoglio | \n",
177 | " gas | \n",
178 | " std | \n",
179 | " two | \n",
180 | " hatchback | \n",
181 | " rwd | \n",
182 | " front | \n",
183 | " 94.5 | \n",
184 | " ... | \n",
185 | " 152 | \n",
186 | " mpfi | \n",
187 | " 2.68 | \n",
188 | " 3.47 | \n",
189 | " 9.0 | \n",
190 | " 154 | \n",
191 | " 5000 | \n",
192 | " 19 | \n",
193 | " 26 | \n",
194 | " 16500.000 | \n",
195 | "
\n",
196 | " \n",
197 | " 3 | \n",
198 | " 4 | \n",
199 | " 2 | \n",
200 | " audi 100 ls | \n",
201 | " gas | \n",
202 | " std | \n",
203 | " four | \n",
204 | " sedan | \n",
205 | " fwd | \n",
206 | " front | \n",
207 | " 99.8 | \n",
208 | " ... | \n",
209 | " 109 | \n",
210 | " mpfi | \n",
211 | " 3.19 | \n",
212 | " 3.40 | \n",
213 | " 10.0 | \n",
214 | " 102 | \n",
215 | " 5500 | \n",
216 | " 24 | \n",
217 | " 30 | \n",
218 | " 13950.000 | \n",
219 | "
\n",
220 | " \n",
221 | " 4 | \n",
222 | " 5 | \n",
223 | " 2 | \n",
224 | " audi 100ls | \n",
225 | " gas | \n",
226 | " std | \n",
227 | " four | \n",
228 | " sedan | \n",
229 | " 4wd | \n",
230 | " front | \n",
231 | " 99.4 | \n",
232 | " ... | \n",
233 | " 136 | \n",
234 | " mpfi | \n",
235 | " 3.19 | \n",
236 | " 3.40 | \n",
237 | " 8.0 | \n",
238 | " 115 | \n",
239 | " 5500 | \n",
240 | " 18 | \n",
241 | " 22 | \n",
242 | " 17450.000 | \n",
243 | "
\n",
244 | " \n",
245 | " 5 | \n",
246 | " 6 | \n",
247 | " 2 | \n",
248 | " audi fox | \n",
249 | " gas | \n",
250 | " std | \n",
251 | " two | \n",
252 | " sedan | \n",
253 | " fwd | \n",
254 | " front | \n",
255 | " 99.8 | \n",
256 | " ... | \n",
257 | " 136 | \n",
258 | " mpfi | \n",
259 | " 3.19 | \n",
260 | " 3.40 | \n",
261 | " 8.5 | \n",
262 | " 110 | \n",
263 | " 5500 | \n",
264 | " 19 | \n",
265 | " 25 | \n",
266 | " 15250.000 | \n",
267 | "
\n",
268 | " \n",
269 | " 6 | \n",
270 | " 7 | \n",
271 | " 1 | \n",
272 | " audi 100ls | \n",
273 | " gas | \n",
274 | " std | \n",
275 | " four | \n",
276 | " sedan | \n",
277 | " fwd | \n",
278 | " front | \n",
279 | " 105.8 | \n",
280 | " ... | \n",
281 | " 136 | \n",
282 | " mpfi | \n",
283 | " 3.19 | \n",
284 | " 3.40 | \n",
285 | " 8.5 | \n",
286 | " 110 | \n",
287 | " 5500 | \n",
288 | " 19 | \n",
289 | " 25 | \n",
290 | " 17710.000 | \n",
291 | "
\n",
292 | " \n",
293 | " 7 | \n",
294 | " 8 | \n",
295 | " 1 | \n",
296 | " audi 5000 | \n",
297 | " gas | \n",
298 | " std | \n",
299 | " four | \n",
300 | " wagon | \n",
301 | " fwd | \n",
302 | " front | \n",
303 | " 105.8 | \n",
304 | " ... | \n",
305 | " 136 | \n",
306 | " mpfi | \n",
307 | " 3.19 | \n",
308 | " 3.40 | \n",
309 | " 8.5 | \n",
310 | " 110 | \n",
311 | " 5500 | \n",
312 | " 19 | \n",
313 | " 25 | \n",
314 | " 18920.000 | \n",
315 | "
\n",
316 | " \n",
317 | " 8 | \n",
318 | " 9 | \n",
319 | " 1 | \n",
320 | " audi 4000 | \n",
321 | " gas | \n",
322 | " turbo | \n",
323 | " four | \n",
324 | " sedan | \n",
325 | " fwd | \n",
326 | " front | \n",
327 | " 105.8 | \n",
328 | " ... | \n",
329 | " 131 | \n",
330 | " mpfi | \n",
331 | " 3.13 | \n",
332 | " 3.40 | \n",
333 | " 8.3 | \n",
334 | " 140 | \n",
335 | " 5500 | \n",
336 | " 17 | \n",
337 | " 20 | \n",
338 | " 23875.000 | \n",
339 | "
\n",
340 | " \n",
341 | " 9 | \n",
342 | " 10 | \n",
343 | " 0 | \n",
344 | " audi 5000s (diesel) | \n",
345 | " gas | \n",
346 | " turbo | \n",
347 | " two | \n",
348 | " hatchback | \n",
349 | " 4wd | \n",
350 | " front | \n",
351 | " 99.5 | \n",
352 | " ... | \n",
353 | " 131 | \n",
354 | " mpfi | \n",
355 | " 3.13 | \n",
356 | " 3.40 | \n",
357 | " 7.0 | \n",
358 | " 160 | \n",
359 | " 5500 | \n",
360 | " 16 | \n",
361 | " 22 | \n",
362 | " 17859.167 | \n",
363 | "
\n",
364 | " \n",
365 | "
\n",
366 | "
10 rows × 26 columns
\n",
367 | "
"
368 | ],
369 | "text/plain": [
370 | " car_ID symboling CarName fueltype aspiration doornumber \\\n",
371 | "0 1 3 alfa-romero giulia gas std two \n",
372 | "1 2 3 alfa-romero stelvio gas std two \n",
373 | "2 3 1 alfa-romero Quadrifoglio gas std two \n",
374 | "3 4 2 audi 100 ls gas std four \n",
375 | "4 5 2 audi 100ls gas std four \n",
376 | "5 6 2 audi fox gas std two \n",
377 | "6 7 1 audi 100ls gas std four \n",
378 | "7 8 1 audi 5000 gas std four \n",
379 | "8 9 1 audi 4000 gas turbo four \n",
380 | "9 10 0 audi 5000s (diesel) gas turbo two \n",
381 | "\n",
382 | " carbody drivewheel enginelocation wheelbase ... enginesize \\\n",
383 | "0 convertible rwd front 88.6 ... 130 \n",
384 | "1 convertible rwd front 88.6 ... 130 \n",
385 | "2 hatchback rwd front 94.5 ... 152 \n",
386 | "3 sedan fwd front 99.8 ... 109 \n",
387 | "4 sedan 4wd front 99.4 ... 136 \n",
388 | "5 sedan fwd front 99.8 ... 136 \n",
389 | "6 sedan fwd front 105.8 ... 136 \n",
390 | "7 wagon fwd front 105.8 ... 136 \n",
391 | "8 sedan fwd front 105.8 ... 131 \n",
392 | "9 hatchback 4wd front 99.5 ... 131 \n",
393 | "\n",
394 | " fuelsystem boreratio stroke compressionratio horsepower peakrpm citympg \\\n",
395 | "0 mpfi 3.47 2.68 9.0 111 5000 21 \n",
396 | "1 mpfi 3.47 2.68 9.0 111 5000 21 \n",
397 | "2 mpfi 2.68 3.47 9.0 154 5000 19 \n",
398 | "3 mpfi 3.19 3.40 10.0 102 5500 24 \n",
399 | "4 mpfi 3.19 3.40 8.0 115 5500 18 \n",
400 | "5 mpfi 3.19 3.40 8.5 110 5500 19 \n",
401 | "6 mpfi 3.19 3.40 8.5 110 5500 19 \n",
402 | "7 mpfi 3.19 3.40 8.5 110 5500 19 \n",
403 | "8 mpfi 3.13 3.40 8.3 140 5500 17 \n",
404 | "9 mpfi 3.13 3.40 7.0 160 5500 16 \n",
405 | "\n",
406 | " highwaympg price \n",
407 | "0 27 13495.000 \n",
408 | "1 27 16500.000 \n",
409 | "2 26 16500.000 \n",
410 | "3 30 13950.000 \n",
411 | "4 22 17450.000 \n",
412 | "5 25 15250.000 \n",
413 | "6 25 17710.000 \n",
414 | "7 25 18920.000 \n",
415 | "8 20 23875.000 \n",
416 | "9 22 17859.167 \n",
417 | "\n",
418 | "[10 rows x 26 columns]"
419 | ]
420 | },
421 | "execution_count": 4,
422 | "metadata": {},
423 | "output_type": "execute_result"
424 | }
425 | ],
426 | "source": [
427 | "# Print the first 10 rows of the dataset\n",
428 | "df.head(10)"
429 | ]
430 | },
431 | {
432 | "cell_type": "markdown",
433 | "metadata": {},
434 | "source": [
435 | "This Cars Dataset represents cars characteristics, along with their prices.\n",
436 | "\n",
437 | "- `car_ID`: Unique id of each observation (Interger)\n",
438 | "- `symboling`: Its assigned insurance risk rating, A value of +3 indicates that the auto is risky, -3 that it is probably pretty safe.(Categorical) \t\t\n",
439 | "- `carCompany`: Name of car company (Categorical)\t\t\n",
440 | "- `fueltype`: Car fuel type i.e gas or diesel (Categorical)\t\t\n",
441 | "- `aspiration`: Aspiration used in a car (Categorical)\t\t\n",
442 | "- `doornumber`: Number of doors in a car (Categorical)\t\t\n",
443 | "- `carbody`: body of car (Categorical)\t\t\n",
444 | "- `drivewheel`: type of drive wheel (Categorical)\t\t\n",
445 | "- `enginelocation`: Location of car engine (Categorical)\t\t\n",
446 | "- `wheelbase`: Weelbase of car (Numeric)\t\t\n",
447 | "- `carlength`: Length of car (Numeric)\t\t\n",
448 | "- `carwidth`: Width of car (Numeric)\t\t\n",
449 | "- `carheight` Height of car (Numeric)\t\t\n",
450 | "- `curbweight` The weight of a car without occupants or baggage. (Numeric)\t\t\n",
451 | "- `enginetype`: Type of engine. (Categorical)\t\t\n",
452 | "- `cylindernumber`: Cylinder placed in the car (Categorical)\t\t\n",
453 | "- `enginesize`: Size of car (Numeric)\t\t\n",
454 | "- `fuelsystem`: Fuel system of car (Categorical)\t\t\n",
455 | "- `boreratio`: Boreratio of car (Numeric)\t\t\n",
456 | "- `stroke`: Stroke or volume inside the engine (Numeric)\t\t\n",
457 | "- `compressionratio`: Compression ratio of car (Numeric)\t\t\n",
458 | "- `horsepower`: Horsepower (Numeric)\t\t\n",
459 | "- `peakrpm`: Car peak rpm (Numeric)\t\t\n",
460 | "- `citympg`: Mileage in city (Numeric)\t\t\n",
461 | "- `highwaympg`: Mileage on highway (Numeric)\t\t\n",
462 | "- `price` (Dependent variable): Price of car in \\$ (Numeric)\n",
463 | "\n",
464 | "The main aim is to build **a model that predicts a price of a car** (`price` column) based on independent variables."
465 | ]
466 | },
467 | {
468 | "cell_type": "markdown",
469 | "metadata": {},
470 | "source": [
471 | "## 3. Variables"
472 | ]
473 | },
474 | {
475 | "cell_type": "markdown",
476 | "metadata": {},
477 | "source": [
478 | "Let's split the dataset into X and y, where \n",
479 | "- $X$ is a set of independent variables\n",
480 | "- $y$ is a dependent, or target variable (the last column)\n",
481 | "\n",
482 | "To make things simpler, let's pick 3 independent variables."
483 | ]
484 | },
485 | {
486 | "cell_type": "code",
487 | "execution_count": 5,
488 | "metadata": {},
489 | "outputs": [
490 | {
491 | "data": {
492 | "text/html": [
493 | "\n",
494 | "\n",
507 | "
\n",
508 | " \n",
509 | " \n",
510 | " | \n",
511 | " symboling | \n",
512 | " enginesize | \n",
513 | " horsepower | \n",
514 | "
\n",
515 | " \n",
516 | " \n",
517 | " \n",
518 | " 0 | \n",
519 | " 3 | \n",
520 | " 130 | \n",
521 | " 111 | \n",
522 | "
\n",
523 | " \n",
524 | " 1 | \n",
525 | " 3 | \n",
526 | " 130 | \n",
527 | " 111 | \n",
528 | "
\n",
529 | " \n",
530 | " 2 | \n",
531 | " 1 | \n",
532 | " 152 | \n",
533 | " 154 | \n",
534 | "
\n",
535 | " \n",
536 | " 3 | \n",
537 | " 2 | \n",
538 | " 109 | \n",
539 | " 102 | \n",
540 | "
\n",
541 | " \n",
542 | " 4 | \n",
543 | " 2 | \n",
544 | " 136 | \n",
545 | " 115 | \n",
546 | "
\n",
547 | " \n",
548 | " ... | \n",
549 | " ... | \n",
550 | " ... | \n",
551 | " ... | \n",
552 | "
\n",
553 | " \n",
554 | " 200 | \n",
555 | " -1 | \n",
556 | " 141 | \n",
557 | " 114 | \n",
558 | "
\n",
559 | " \n",
560 | " 201 | \n",
561 | " -1 | \n",
562 | " 141 | \n",
563 | " 160 | \n",
564 | "
\n",
565 | " \n",
566 | " 202 | \n",
567 | " -1 | \n",
568 | " 173 | \n",
569 | " 134 | \n",
570 | "
\n",
571 | " \n",
572 | " 203 | \n",
573 | " -1 | \n",
574 | " 145 | \n",
575 | " 106 | \n",
576 | "
\n",
577 | " \n",
578 | " 204 | \n",
579 | " -1 | \n",
580 | " 141 | \n",
581 | " 114 | \n",
582 | "
\n",
583 | " \n",
584 | "
\n",
585 | "
205 rows × 3 columns
\n",
586 | "
"
587 | ],
588 | "text/plain": [
589 | " symboling enginesize horsepower\n",
590 | "0 3 130 111\n",
591 | "1 3 130 111\n",
592 | "2 1 152 154\n",
593 | "3 2 109 102\n",
594 | "4 2 136 115\n",
595 | ".. ... ... ...\n",
596 | "200 -1 141 114\n",
597 | "201 -1 141 160\n",
598 | "202 -1 173 134\n",
599 | "203 -1 145 106\n",
600 | "204 -1 141 114\n",
601 | "\n",
602 | "[205 rows x 3 columns]"
603 | ]
604 | },
605 | "execution_count": 5,
606 | "metadata": {},
607 | "output_type": "execute_result"
608 | }
609 | ],
610 | "source": [
611 | "# Filter out target column\n",
612 | "X = df[['symboling', 'enginesize', 'horsepower']]\n",
613 | "\n",
614 | "# Print X\n",
615 | "X"
616 | ]
617 | },
618 | {
619 | "cell_type": "code",
620 | "execution_count": 6,
621 | "metadata": {},
622 | "outputs": [
623 | {
624 | "data": {
625 | "text/plain": [
626 | "0 13495.0\n",
627 | "1 16500.0\n",
628 | "2 16500.0\n",
629 | "3 13950.0\n",
630 | "4 17450.0\n",
631 | " ... \n",
632 | "200 16845.0\n",
633 | "201 19045.0\n",
634 | "202 21485.0\n",
635 | "203 22470.0\n",
636 | "204 22625.0\n",
637 | "Name: price, Length: 205, dtype: float64"
638 | ]
639 | },
640 | "execution_count": 6,
641 | "metadata": {},
642 | "output_type": "execute_result"
643 | }
644 | ],
645 | "source": [
646 | "# Select target column\n",
647 | "y = df['price']\n",
648 | "\n",
649 | "# Print y\n",
650 | "y"
651 | ]
652 | },
653 | {
654 | "cell_type": "markdown",
655 | "metadata": {},
656 | "source": [
657 | "## 4. Model"
658 | ]
659 | },
660 | {
661 | "cell_type": "markdown",
662 | "metadata": {},
663 | "source": [
664 | "In this section we are going to \n",
665 | "- build a ridge regression model, \n",
666 | "- evaluate its accuracy, and \n",
667 | "- make a prediction"
668 | ]
669 | },
670 | {
671 | "cell_type": "markdown",
672 | "metadata": {},
673 | "source": [
674 | "### 4.1. Building the model"
675 | ]
676 | },
677 | {
678 | "cell_type": "markdown",
679 | "metadata": {},
680 | "source": [
681 | "Let's recall three simple steps:\n",
682 | "\n",
683 | "- Split the $X$ & $y$ variables into train and test sets\n",
684 | "- Initialize the model\n",
685 | "- Train the model with the varialbes"
686 | ]
687 | },
688 | {
689 | "cell_type": "code",
690 | "execution_count": 7,
691 | "metadata": {},
692 | "outputs": [],
693 | "source": [
694 | "# Split variables into train and test\n",
695 | "X_train, X_test, y_train, y_test = train_test_split(X, #independent variables\n",
696 | " y, #dependent variable\n",
697 | " random_state = 3\n",
698 | " )"
699 | ]
700 | },
701 | {
702 | "cell_type": "code",
703 | "execution_count": 8,
704 | "metadata": {},
705 | "outputs": [],
706 | "source": [
707 | "# Initialize the model\n",
708 | "reg = Ridge(alpha=2.0, max_iter = 10000)"
709 | ]
710 | },
711 | {
712 | "cell_type": "code",
713 | "execution_count": 9,
714 | "metadata": {},
715 | "outputs": [
716 | {
717 | "data": {
718 | "text/html": [
719 | "Ridge(alpha=2.0, max_iter=10000)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org. "
720 | ],
721 | "text/plain": [
722 | "Ridge(alpha=2.0, max_iter=10000)"
723 | ]
724 | },
725 | "execution_count": 9,
726 | "metadata": {},
727 | "output_type": "execute_result"
728 | }
729 | ],
730 | "source": [
731 | "# Train the model\n",
732 | "reg.fit(X_train, y_train)"
733 | ]
734 | },
735 | {
736 | "cell_type": "markdown",
737 | "metadata": {},
738 | "source": [
739 | "### 4.2. Checking models accuracy"
740 | ]
741 | },
742 | {
743 | "cell_type": "markdown",
744 | "metadata": {},
745 | "source": [
746 | "After the model has trained with the data, it's essential to understand how precisely it predicts car prices. For that, we need to check model's accuracy. "
747 | ]
748 | },
749 | {
750 | "cell_type": "code",
751 | "execution_count": 10,
752 | "metadata": {},
753 | "outputs": [
754 | {
755 | "name": "stdout",
756 | "output_type": "stream",
757 | "text": [
758 | "Accuracy (R-squared score) of Ridge Regression model on training set: 0.78\n",
759 | "Accuracy (R-squared score) of Ridge Regression model on test set: 0.82\n"
760 | ]
761 | }
762 | ],
763 | "source": [
764 | "print(f'Accuracy (R-squared score) of Ridge Regression model on training set: {reg.score(X_train, y_train):.2f}')\n",
765 | "print(f'Accuracy (R-squared score) of Ridge Regression model on test set: {reg.score(X_test, y_test):.2f}')"
766 | ]
767 | },
768 | {
769 | "cell_type": "markdown",
770 | "metadata": {},
771 | "source": [
772 | "### 4.3. Making a prediction"
773 | ]
774 | },
775 | {
776 | "cell_type": "markdown",
777 | "metadata": {},
778 | "source": [
779 | "Now that we know the model is accurate enough, we can predict the price of any car by passing independent varialbes `symboling`, `enginesize`, `horsepower` to the model. \n",
780 | "\n",
781 | "\n",
782 | "The method `predict` returns such a prediction."
783 | ]
784 | },
785 | {
786 | "cell_type": "code",
787 | "execution_count": 11,
788 | "metadata": {},
789 | "outputs": [
790 | {
791 | "name": "stderr",
792 | "output_type": "stream",
793 | "text": [
794 | "/Users/andrewwolf/.pyenv/versions/3.10.7/lib/python3.10/site-packages/sklearn/base.py:409: UserWarning: X does not have valid feature names, but Ridge was fitted with feature names\n",
795 | " warnings.warn(\n"
796 | ]
797 | },
798 | {
799 | "data": {
800 | "text/plain": [
801 | "array([29353.06594801])"
802 | ]
803 | },
804 | "execution_count": 11,
805 | "metadata": {},
806 | "output_type": "execute_result"
807 | }
808 | ],
809 | "source": [
810 | "reg.predict([[0, 180, 249]])"
811 | ]
812 | },
813 | {
814 | "cell_type": "markdown",
815 | "metadata": {},
816 | "source": [
817 | "## 5. Hyperparameters Tuning"
818 | ]
819 | },
820 | {
821 | "cell_type": "markdown",
822 | "metadata": {},
823 | "source": [
824 | "Hyperparameter Tuning is one of the critical steps in model building. It helps in increasing model's accuracy even further."
825 | ]
826 | },
827 | {
828 | "cell_type": "markdown",
829 | "metadata": {},
830 | "source": [
831 | "### 5.1. Playing around with regularization parameter alpha"
832 | ]
833 | },
834 | {
835 | "cell_type": "code",
836 | "execution_count": 26,
837 | "metadata": {},
838 | "outputs": [
839 | {
840 | "name": "stdout",
841 | "output_type": "stream",
842 | "text": [
843 | "Alpha = 0.00\n",
844 | " r-squared training: 0.78,\n",
845 | " r-squared test: 0.82 \n",
846 | "\n",
847 | "Alpha = 1.00\n",
848 | " r-squared training: 0.78,\n",
849 | " r-squared test: 0.82 \n",
850 | "\n",
851 | "Alpha = 10.00\n",
852 | " r-squared training: 0.78,\n",
853 | " r-squared test: 0.82 \n",
854 | "\n",
855 | "Alpha = 20.00\n",
856 | " r-squared training: 0.78,\n",
857 | " r-squared test: 0.82 \n",
858 | "\n",
859 | "Alpha = 50.00\n",
860 | " r-squared training: 0.78,\n",
861 | " r-squared test: 0.82 \n",
862 | "\n",
863 | "Alpha = 100.00\n",
864 | " r-squared training: 0.78,\n",
865 | " r-squared test: 0.82 \n",
866 | "\n"
867 | ]
868 | }
869 | ],
870 | "source": [
871 | "# Ridge regression: effect of alpha regularization parameter\n",
872 | "\n",
873 | "for this_alpha in [0, 1, 10, 20, 50, 100]:\n",
874 | " \n",
875 | " # Initialize the model\n",
876 | " reg = Ridge(alpha=this_alpha, max_iter = 10000)\n",
877 | " \n",
878 | " # Train the model\n",
879 | " reg.fit(X_train, y_train)\n",
880 | " \n",
881 | " #Save accuracy\n",
882 | " r2_train = reg.score(X_train, y_train)\n",
883 | " r2_test = reg.score(X_test, y_test)\n",
884 | " \n",
885 | " # Print results\n",
886 | " print(f'''Alpha = {this_alpha:.2f}\n",
887 | " r-squared training: {r2_train:.2f},\n",
888 | " r-squared test: {r2_test:.2f} \\n''')"
889 | ]
890 | },
891 | {
892 | "cell_type": "markdown",
893 | "metadata": {},
894 | "source": [
895 | "### 5.2. All Hyperparameters of Ridge Regression"
896 | ]
897 | },
898 | {
899 | "cell_type": "markdown",
900 | "metadata": {},
901 | "source": [
902 | "There are many hyperparameters in Ridge Regression. They are all presented below - as you can see, they have values by default. Feel free to play around with them. To learn more about hyperparameters and their meaning, visit https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge."
903 | ]
904 | },
905 | {
906 | "cell_type": "code",
907 | "execution_count": 21,
908 | "metadata": {},
909 | "outputs": [],
910 | "source": [
911 | "reg = Ridge(alpha=1.0,\n",
912 | " fit_intercept=True, \n",
913 | " copy_X=True, \n",
914 | " max_iter=None, \n",
915 | " tol=0.0001, \n",
916 | " solver='auto', \n",
917 | " positive=False, \n",
918 | " random_state=None)"
919 | ]
920 | },
921 | {
922 | "cell_type": "markdown",
923 | "metadata": {},
924 | "source": [
925 | "## 6. Ridge Regression with normalized data"
926 | ]
927 | },
928 | {
929 | "cell_type": "markdown",
930 | "metadata": {},
931 | "source": [
932 | "(feature preprocessing using minmax scaling)"
933 | ]
934 | },
935 | {
936 | "cell_type": "code",
937 | "execution_count": 19,
938 | "metadata": {},
939 | "outputs": [
940 | {
941 | "name": "stdout",
942 | "output_type": "stream",
943 | "text": [
944 | "Ridge regression linear model intercept: 13045.07625490196\n",
945 | "Ridge regression linear model coeff: [-582.02217923 3782.60816914 2880.08326775]\n",
946 | "\n",
947 | "R-squared score (training): 0.777\n",
948 | "R-squared score (test): 0.806\n",
949 | "\n"
950 | ]
951 | }
952 | ],
953 | "source": [
954 | "#initialize scaler\n",
955 | "scaler = StandardScaler()\n",
956 | "\n",
957 | "#transform variables\n",
958 | "X_train_scaled = scaler.fit_transform(X_train)\n",
959 | "X_test_scaled = scaler.transform(X_test)\n",
960 | "\n",
961 | "#initialize the model\n",
962 | "reg = Ridge(alpha=20.0)\n",
963 | "\n",
964 | "#train the model\n",
965 | "reg.fit(X_train_scaled, y_train)\n",
966 | "\n",
967 | "#print results\n",
968 | "print(f'Ridge regression linear model intercept: {(reg.intercept_)}')\n",
969 | "print(f'Ridge regression linear model coeff: {(reg.coef_)}\\n')\n",
970 | "print(f'R-squared score (training): {reg.score(X_train_scaled, y_train):.3f}')\n",
971 | "print(f'R-squared score (test): {reg.score(X_test_scaled, y_test):.3f}\\n')"
972 | ]
973 | }
974 | ],
975 | "metadata": {
976 | "kernelspec": {
977 | "display_name": "Python 3 (ipykernel)",
978 | "language": "python",
979 | "name": "python3"
980 | },
981 | "language_info": {
982 | "codemirror_mode": {
983 | "name": "ipython",
984 | "version": 3
985 | },
986 | "file_extension": ".py",
987 | "mimetype": "text/x-python",
988 | "name": "python",
989 | "nbconvert_exporter": "python",
990 | "pygments_lexer": "ipython3",
991 | "version": "3.10.7"
992 | }
993 | },
994 | "nbformat": 4,
995 | "nbformat_minor": 2
996 | }
997 |
--------------------------------------------------------------------------------
/supplements/data/cars.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 |
--------------------------------------------------------------------------------
/supplements/data/heart.csv:
--------------------------------------------------------------------------------
1 | age,sex,cp,trestbps,chol,fbs,restecg,thalach,exang,oldpeak,slope,ca,thal,target
2 | 52,1,0,125,212,0,1,168,0,1,2,2,3,0
3 | 53,1,0,140,203,1,0,155,1,3.1,0,0,3,0
4 | 70,1,0,145,174,0,1,125,1,2.6,0,0,3,0
5 | 61,1,0,148,203,0,1,161,0,0,2,1,3,0
6 | 62,0,0,138,294,1,1,106,0,1.9,1,3,2,0
7 | 58,0,0,100,248,0,0,122,0,1,1,0,2,1
8 | 58,1,0,114,318,0,2,140,0,4.4,0,3,1,0
9 | 55,1,0,160,289,0,0,145,1,0.8,1,1,3,0
10 | 46,1,0,120,249,0,0,144,0,0.8,2,0,3,0
11 | 54,1,0,122,286,0,0,116,1,3.2,1,2,2,0
12 | 71,0,0,112,149,0,1,125,0,1.6,1,0,2,1
13 | 43,0,0,132,341,1,0,136,1,3,1,0,3,0
14 | 34,0,1,118,210,0,1,192,0,0.7,2,0,2,1
15 | 51,1,0,140,298,0,1,122,1,4.2,1,3,3,0
16 | 52,1,0,128,204,1,1,156,1,1,1,0,0,0
17 | 34,0,1,118,210,0,1,192,0,0.7,2,0,2,1
18 | 51,0,2,140,308,0,0,142,0,1.5,2,1,2,1
19 | 54,1,0,124,266,0,0,109,1,2.2,1,1,3,0
20 | 50,0,1,120,244,0,1,162,0,1.1,2,0,2,1
21 | 58,1,2,140,211,1,0,165,0,0,2,0,2,1
22 | 60,1,2,140,185,0,0,155,0,3,1,0,2,0
23 | 67,0,0,106,223,0,1,142,0,0.3,2,2,2,1
24 | 45,1,0,104,208,0,0,148,1,3,1,0,2,1
25 | 63,0,2,135,252,0,0,172,0,0,2,0,2,1
26 | 42,0,2,120,209,0,1,173,0,0,1,0,2,1
27 | 61,0,0,145,307,0,0,146,1,1,1,0,3,0
28 | 44,1,2,130,233,0,1,179,1,0.4,2,0,2,1
29 | 58,0,1,136,319,1,0,152,0,0,2,2,2,0
30 | 56,1,2,130,256,1,0,142,1,0.6,1,1,1,0
31 | 55,0,0,180,327,0,2,117,1,3.4,1,0,2,0
32 | 44,1,0,120,169,0,1,144,1,2.8,0,0,1,0
33 | 50,0,1,120,244,0,1,162,0,1.1,2,0,2,1
34 | 57,1,0,130,131,0,1,115,1,1.2,1,1,3,0
35 | 70,1,2,160,269,0,1,112,1,2.9,1,1,3,0
36 | 50,1,2,129,196,0,1,163,0,0,2,0,2,1
37 | 46,1,2,150,231,0,1,147,0,3.6,1,0,2,0
38 | 51,1,3,125,213,0,0,125,1,1.4,2,1,2,1
39 | 59,1,0,138,271,0,0,182,0,0,2,0,2,1
40 | 64,1,0,128,263,0,1,105,1,0.2,1,1,3,1
41 | 57,1,2,128,229,0,0,150,0,0.4,1,1,3,0
42 | 65,0,2,160,360,0,0,151,0,0.8,2,0,2,1
43 | 54,1,2,120,258,0,0,147,0,0.4,1,0,3,1
44 | 61,0,0,130,330,0,0,169,0,0,2,0,2,0
45 | 46,1,0,120,249,0,0,144,0,0.8,2,0,3,0
46 | 55,0,1,132,342,0,1,166,0,1.2,2,0,2,1
47 | 42,1,0,140,226,0,1,178,0,0,2,0,2,1
48 | 41,1,1,135,203,0,1,132,0,0,1,0,1,1
49 | 66,0,0,178,228,1,1,165,1,1,1,2,3,0
50 | 66,0,2,146,278,0,0,152,0,0,1,1,2,1
51 | 60,1,0,117,230,1,1,160,1,1.4,2,2,3,0
52 | 58,0,3,150,283,1,0,162,0,1,2,0,2,1
53 | 57,0,0,140,241,0,1,123,1,0.2,1,0,3,0
54 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
55 | 49,1,2,120,188,0,1,139,0,2,1,3,3,0
56 | 55,1,0,140,217,0,1,111,1,5.6,0,0,3,0
57 | 55,1,0,140,217,0,1,111,1,5.6,0,0,3,0
58 | 56,1,3,120,193,0,0,162,0,1.9,1,0,3,1
59 | 48,1,1,130,245,0,0,180,0,0.2,1,0,2,1
60 | 67,1,2,152,212,0,0,150,0,0.8,1,0,3,0
61 | 57,1,1,154,232,0,0,164,0,0,2,1,2,0
62 | 29,1,1,130,204,0,0,202,0,0,2,0,2,1
63 | 66,0,2,146,278,0,0,152,0,0,1,1,2,1
64 | 67,1,0,100,299,0,0,125,1,0.9,1,2,2,0
65 | 59,1,2,150,212,1,1,157,0,1.6,2,0,2,1
66 | 29,1,1,130,204,0,0,202,0,0,2,0,2,1
67 | 59,1,3,170,288,0,0,159,0,0.2,1,0,3,0
68 | 53,1,2,130,197,1,0,152,0,1.2,0,0,2,1
69 | 42,1,0,136,315,0,1,125,1,1.8,1,0,1,0
70 | 37,0,2,120,215,0,1,170,0,0,2,0,2,1
71 | 62,0,0,160,164,0,0,145,0,6.2,0,3,3,0
72 | 59,1,0,170,326,0,0,140,1,3.4,0,0,3,0
73 | 61,1,0,140,207,0,0,138,1,1.9,2,1,3,0
74 | 56,1,0,125,249,1,0,144,1,1.2,1,1,2,0
75 | 59,1,0,140,177,0,1,162,1,0,2,1,3,0
76 | 48,1,0,130,256,1,0,150,1,0,2,2,3,0
77 | 47,1,2,138,257,0,0,156,0,0,2,0,2,1
78 | 48,1,2,124,255,1,1,175,0,0,2,2,2,1
79 | 63,1,0,140,187,0,0,144,1,4,2,2,3,0
80 | 52,1,1,134,201,0,1,158,0,0.8,2,1,2,1
81 | 52,1,1,134,201,0,1,158,0,0.8,2,1,2,1
82 | 50,1,2,140,233,0,1,163,0,0.6,1,1,3,0
83 | 49,1,2,118,149,0,0,126,0,0.8,2,3,2,0
84 | 46,1,2,150,231,0,1,147,0,3.6,1,0,2,0
85 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
86 | 37,0,2,120,215,0,1,170,0,0,2,0,2,1
87 | 44,1,1,120,220,0,1,170,0,0,2,0,2,1
88 | 58,1,2,140,211,1,0,165,0,0,2,0,2,1
89 | 59,0,0,174,249,0,1,143,1,0,1,0,2,0
90 | 62,0,0,140,268,0,0,160,0,3.6,0,2,2,0
91 | 68,1,0,144,193,1,1,141,0,3.4,1,2,3,0
92 | 54,0,2,108,267,0,0,167,0,0,2,0,2,1
93 | 62,0,0,124,209,0,1,163,0,0,2,0,2,1
94 | 63,1,0,140,187,0,0,144,1,4,2,2,3,0
95 | 44,1,0,120,169,0,1,144,1,2.8,0,0,1,0
96 | 62,1,1,128,208,1,0,140,0,0,2,0,2,1
97 | 45,0,0,138,236,0,0,152,1,0.2,1,0,2,1
98 | 57,0,0,128,303,0,0,159,0,0,2,1,2,1
99 | 53,1,0,123,282,0,1,95,1,2,1,2,3,0
100 | 65,1,0,110,248,0,0,158,0,0.6,2,2,1,0
101 | 76,0,2,140,197,0,2,116,0,1.1,1,0,2,1
102 | 43,0,2,122,213,0,1,165,0,0.2,1,0,2,1
103 | 57,1,2,150,126,1,1,173,0,0.2,2,1,3,1
104 | 54,1,1,108,309,0,1,156,0,0,2,0,3,1
105 | 47,1,2,138,257,0,0,156,0,0,2,0,2,1
106 | 52,1,3,118,186,0,0,190,0,0,1,0,1,1
107 | 47,1,0,110,275,0,0,118,1,1,1,1,2,0
108 | 51,1,0,140,299,0,1,173,1,1.6,2,0,3,0
109 | 62,1,1,120,281,0,0,103,0,1.4,1,1,3,0
110 | 40,1,0,152,223,0,1,181,0,0,2,0,3,0
111 | 54,1,0,110,206,0,0,108,1,0,1,1,2,0
112 | 44,1,0,110,197,0,0,177,0,0,2,1,2,0
113 | 53,1,0,142,226,0,0,111,1,0,2,0,3,1
114 | 48,1,0,130,256,1,0,150,1,0,2,2,3,0
115 | 57,1,0,110,335,0,1,143,1,3,1,1,3,0
116 | 59,1,2,126,218,1,1,134,0,2.2,1,1,1,0
117 | 61,0,0,145,307,0,0,146,1,1,1,0,3,0
118 | 63,1,0,130,254,0,0,147,0,1.4,1,1,3,0
119 | 43,1,0,120,177,0,0,120,1,2.5,1,0,3,0
120 | 29,1,1,130,204,0,0,202,0,0,2,0,2,1
121 | 42,1,1,120,295,0,1,162,0,0,2,0,2,1
122 | 54,1,1,108,309,0,1,156,0,0,2,0,3,1
123 | 44,1,0,120,169,0,1,144,1,2.8,0,0,1,0
124 | 60,1,0,145,282,0,0,142,1,2.8,1,2,3,0
125 | 65,0,2,140,417,1,0,157,0,0.8,2,1,2,1
126 | 61,1,0,120,260,0,1,140,1,3.6,1,1,3,0
127 | 60,0,3,150,240,0,1,171,0,0.9,2,0,2,1
128 | 66,1,0,120,302,0,0,151,0,0.4,1,0,2,1
129 | 53,1,2,130,197,1,0,152,0,1.2,0,0,2,1
130 | 52,1,2,138,223,0,1,169,0,0,2,4,2,1
131 | 57,1,0,140,192,0,1,148,0,0.4,1,0,1,1
132 | 60,0,3,150,240,0,1,171,0,0.9,2,0,2,1
133 | 51,0,2,130,256,0,0,149,0,0.5,2,0,2,1
134 | 41,1,1,135,203,0,1,132,0,0,1,0,1,1
135 | 50,1,2,129,196,0,1,163,0,0,2,0,2,1
136 | 54,1,1,108,309,0,1,156,0,0,2,0,3,1
137 | 58,0,0,170,225,1,0,146,1,2.8,1,2,1,0
138 | 55,0,1,132,342,0,1,166,0,1.2,2,0,2,1
139 | 64,0,0,180,325,0,1,154,1,0,2,0,2,1
140 | 47,1,2,138,257,0,0,156,0,0,2,0,2,1
141 | 41,1,1,110,235,0,1,153,0,0,2,0,2,1
142 | 57,1,0,152,274,0,1,88,1,1.2,1,1,3,0
143 | 63,0,0,124,197,0,1,136,1,0,1,0,2,0
144 | 61,1,3,134,234,0,1,145,0,2.6,1,2,2,0
145 | 34,1,3,118,182,0,0,174,0,0,2,0,2,1
146 | 47,1,0,112,204,0,1,143,0,0.1,2,0,2,1
147 | 40,1,0,110,167,0,0,114,1,2,1,0,3,0
148 | 51,0,2,120,295,0,0,157,0,0.6,2,0,2,1
149 | 41,1,0,110,172,0,0,158,0,0,2,0,3,0
150 | 52,1,3,152,298,1,1,178,0,1.2,1,0,3,1
151 | 39,1,2,140,321,0,0,182,0,0,2,0,2,1
152 | 58,1,0,114,318,0,2,140,0,4.4,0,3,1,0
153 | 54,1,1,192,283,0,0,195,0,0,2,1,3,0
154 | 58,1,0,125,300,0,0,171,0,0,2,2,3,0
155 | 54,1,2,120,258,0,0,147,0,0.4,1,0,3,1
156 | 63,1,0,130,330,1,0,132,1,1.8,2,3,3,0
157 | 54,1,1,108,309,0,1,156,0,0,2,0,3,1
158 | 40,1,3,140,199,0,1,178,1,1.4,2,0,3,1
159 | 54,1,2,120,258,0,0,147,0,0.4,1,0,3,1
160 | 67,0,2,115,564,0,0,160,0,1.6,1,0,3,1
161 | 41,1,1,120,157,0,1,182,0,0,2,0,2,1
162 | 77,1,0,125,304,0,0,162,1,0,2,3,2,0
163 | 51,1,2,100,222,0,1,143,1,1.2,1,0,2,1
164 | 77,1,0,125,304,0,0,162,1,0,2,3,2,0
165 | 48,1,0,124,274,0,0,166,0,0.5,1,0,3,0
166 | 56,1,0,125,249,1,0,144,1,1.2,1,1,2,0
167 | 59,1,0,170,326,0,0,140,1,3.4,0,0,3,0
168 | 56,1,0,132,184,0,0,105,1,2.1,1,1,1,0
169 | 57,0,0,120,354,0,1,163,1,0.6,2,0,2,1
170 | 43,1,2,130,315,0,1,162,0,1.9,2,1,2,1
171 | 45,0,1,112,160,0,1,138,0,0,1,0,2,1
172 | 43,1,0,150,247,0,1,171,0,1.5,2,0,2,1
173 | 56,1,0,130,283,1,0,103,1,1.6,0,0,3,0
174 | 56,1,1,120,240,0,1,169,0,0,0,0,2,1
175 | 39,0,2,94,199,0,1,179,0,0,2,0,2,1
176 | 54,1,0,110,239,0,1,126,1,2.8,1,1,3,0
177 | 56,0,0,200,288,1,0,133,1,4,0,2,3,0
178 | 56,1,0,130,283,1,0,103,1,1.6,0,0,3,0
179 | 64,1,0,120,246,0,0,96,1,2.2,0,1,2,0
180 | 44,1,0,110,197,0,0,177,0,0,2,1,2,0
181 | 56,0,0,134,409,0,0,150,1,1.9,1,2,3,0
182 | 63,1,0,140,187,0,0,144,1,4,2,2,3,0
183 | 64,1,3,110,211,0,0,144,1,1.8,1,0,2,1
184 | 60,1,0,140,293,0,0,170,0,1.2,1,2,3,0
185 | 42,1,2,130,180,0,1,150,0,0,2,0,2,1
186 | 45,1,1,128,308,0,0,170,0,0,2,0,2,1
187 | 57,1,0,165,289,1,0,124,0,1,1,3,3,0
188 | 40,1,0,110,167,0,0,114,1,2,1,0,3,0
189 | 56,1,0,125,249,1,0,144,1,1.2,1,1,2,0
190 | 63,1,0,130,254,0,0,147,0,1.4,1,1,3,0
191 | 64,1,2,125,309,0,1,131,1,1.8,1,0,3,0
192 | 41,1,2,112,250,0,1,179,0,0,2,0,2,1
193 | 56,1,1,130,221,0,0,163,0,0,2,0,3,1
194 | 67,0,2,115,564,0,0,160,0,1.6,1,0,3,1
195 | 69,1,3,160,234,1,0,131,0,0.1,1,1,2,1
196 | 67,1,0,160,286,0,0,108,1,1.5,1,3,2,0
197 | 59,1,2,150,212,1,1,157,0,1.6,2,0,2,1
198 | 58,1,0,100,234,0,1,156,0,0.1,2,1,3,0
199 | 45,1,0,115,260,0,0,185,0,0,2,0,2,1
200 | 60,0,2,102,318,0,1,160,0,0,2,1,2,1
201 | 50,1,0,144,200,0,0,126,1,0.9,1,0,3,0
202 | 62,0,0,124,209,0,1,163,0,0,2,0,2,1
203 | 34,1,3,118,182,0,0,174,0,0,2,0,2,1
204 | 52,1,3,152,298,1,1,178,0,1.2,1,0,3,1
205 | 64,1,3,170,227,0,0,155,0,0.6,1,0,3,1
206 | 66,0,2,146,278,0,0,152,0,0,1,1,2,1
207 | 42,1,3,148,244,0,0,178,0,0.8,2,2,2,1
208 | 59,1,2,126,218,1,1,134,0,2.2,1,1,1,0
209 | 41,1,2,112,250,0,1,179,0,0,2,0,2,1
210 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
211 | 62,1,1,120,281,0,0,103,0,1.4,1,1,3,0
212 | 42,1,2,120,240,1,1,194,0,0.8,0,0,3,1
213 | 67,1,0,100,299,0,0,125,1,0.9,1,2,2,0
214 | 50,1,0,150,243,0,0,128,0,2.6,1,0,3,0
215 | 43,1,2,130,315,0,1,162,0,1.9,2,1,2,1
216 | 45,1,1,128,308,0,0,170,0,0,2,0,2,1
217 | 49,1,1,130,266,0,1,171,0,0.6,2,0,2,1
218 | 65,1,0,135,254,0,0,127,0,2.8,1,1,3,0
219 | 41,1,1,120,157,0,1,182,0,0,2,0,2,1
220 | 46,1,0,140,311,0,1,120,1,1.8,1,2,3,0
221 | 54,1,0,122,286,0,0,116,1,3.2,1,2,2,0
222 | 57,0,1,130,236,0,0,174,0,0,1,1,2,0
223 | 63,1,0,130,254,0,0,147,0,1.4,1,1,3,0
224 | 64,1,3,110,211,0,0,144,1,1.8,1,0,2,1
225 | 39,0,2,94,199,0,1,179,0,0,2,0,2,1
226 | 51,1,0,140,261,0,0,186,1,0,2,0,2,1
227 | 54,1,2,150,232,0,0,165,0,1.6,2,0,3,1
228 | 49,1,2,118,149,0,0,126,0,0.8,2,3,2,0
229 | 44,0,2,118,242,0,1,149,0,0.3,1,1,2,1
230 | 52,1,1,128,205,1,1,184,0,0,2,0,2,1
231 | 66,0,0,178,228,1,1,165,1,1,1,2,3,0
232 | 58,1,0,125,300,0,0,171,0,0,2,2,3,0
233 | 56,1,1,120,236,0,1,178,0,0.8,2,0,2,1
234 | 60,1,0,125,258,0,0,141,1,2.8,1,1,3,0
235 | 41,0,1,126,306,0,1,163,0,0,2,0,2,1
236 | 49,0,0,130,269,0,1,163,0,0,2,0,2,1
237 | 64,1,3,170,227,0,0,155,0,0.6,1,0,3,1
238 | 49,1,2,118,149,0,0,126,0,0.8,2,3,2,0
239 | 57,1,1,124,261,0,1,141,0,0.3,2,0,3,0
240 | 60,1,0,117,230,1,1,160,1,1.4,2,2,3,0
241 | 62,0,0,150,244,0,1,154,1,1.4,1,0,2,0
242 | 54,0,1,132,288,1,0,159,1,0,2,1,2,1
243 | 67,1,2,152,212,0,0,150,0,0.8,1,0,3,0
244 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
245 | 60,1,2,140,185,0,0,155,0,3,1,0,2,0
246 | 51,1,2,125,245,1,0,166,0,2.4,1,0,2,1
247 | 44,1,1,130,219,0,0,188,0,0,2,0,2,1
248 | 54,1,1,192,283,0,0,195,0,0,2,1,3,0
249 | 46,1,0,140,311,0,1,120,1,1.8,1,2,3,0
250 | 39,0,2,138,220,0,1,152,0,0,1,0,2,1
251 | 42,1,2,130,180,0,1,150,0,0,2,0,2,1
252 | 47,1,0,110,275,0,0,118,1,1,1,1,2,0
253 | 45,0,1,112,160,0,1,138,0,0,1,0,2,1
254 | 55,1,0,132,353,0,1,132,1,1.2,1,1,3,0
255 | 57,1,0,165,289,1,0,124,0,1,1,3,3,0
256 | 35,1,0,120,198,0,1,130,1,1.6,1,0,3,0
257 | 62,0,0,140,394,0,0,157,0,1.2,1,0,2,1
258 | 35,0,0,138,183,0,1,182,0,1.4,2,0,2,1
259 | 64,0,0,180,325,0,1,154,1,0,2,0,2,1
260 | 38,1,3,120,231,0,1,182,1,3.8,1,0,3,0
261 | 66,1,0,120,302,0,0,151,0,0.4,1,0,2,1
262 | 44,1,2,120,226,0,1,169,0,0,2,0,2,1
263 | 54,1,2,150,232,0,0,165,0,1.6,2,0,3,1
264 | 48,1,0,122,222,0,0,186,0,0,2,0,2,1
265 | 55,0,1,132,342,0,1,166,0,1.2,2,0,2,1
266 | 58,0,0,170,225,1,0,146,1,2.8,1,2,1,0
267 | 45,1,0,104,208,0,0,148,1,3,1,0,2,1
268 | 53,1,0,123,282,0,1,95,1,2,1,2,3,0
269 | 67,1,0,120,237,0,1,71,0,1,1,0,2,0
270 | 58,1,2,132,224,0,0,173,0,3.2,2,2,3,0
271 | 71,0,2,110,265,1,0,130,0,0,2,1,2,1
272 | 43,1,0,110,211,0,1,161,0,0,2,0,3,1
273 | 44,1,1,120,263,0,1,173,0,0,2,0,3,1
274 | 39,0,2,138,220,0,1,152,0,0,1,0,2,1
275 | 54,1,0,110,206,0,0,108,1,0,1,1,2,0
276 | 66,1,0,160,228,0,0,138,0,2.3,2,0,1,1
277 | 56,1,0,130,283,1,0,103,1,1.6,0,0,3,0
278 | 57,1,0,132,207,0,1,168,1,0,2,0,3,1
279 | 44,1,1,130,219,0,0,188,0,0,2,0,2,1
280 | 55,1,0,160,289,0,0,145,1,0.8,1,1,3,0
281 | 41,0,1,105,198,0,1,168,0,0,2,1,2,1
282 | 45,0,1,130,234,0,0,175,0,0.6,1,0,2,1
283 | 35,1,1,122,192,0,1,174,0,0,2,0,2,1
284 | 41,0,1,130,204,0,0,172,0,1.4,2,0,2,1
285 | 64,1,3,110,211,0,0,144,1,1.8,1,0,2,1
286 | 58,1,2,132,224,0,0,173,0,3.2,2,2,3,0
287 | 71,0,2,110,265,1,0,130,0,0,2,1,2,1
288 | 64,0,2,140,313,0,1,133,0,0.2,2,0,3,1
289 | 71,0,1,160,302,0,1,162,0,0.4,2,2,2,1
290 | 58,0,2,120,340,0,1,172,0,0,2,0,2,1
291 | 40,1,0,152,223,0,1,181,0,0,2,0,3,0
292 | 52,1,2,138,223,0,1,169,0,0,2,4,2,1
293 | 58,1,0,128,259,0,0,130,1,3,1,2,3,0
294 | 61,1,2,150,243,1,1,137,1,1,1,0,2,1
295 | 59,1,2,150,212,1,1,157,0,1.6,2,0,2,1
296 | 56,0,0,200,288,1,0,133,1,4,0,2,3,0
297 | 67,1,0,100,299,0,0,125,1,0.9,1,2,2,0
298 | 67,1,0,120,237,0,1,71,0,1,1,0,2,0
299 | 58,1,0,150,270,0,0,111,1,0.8,2,0,3,0
300 | 35,1,1,122,192,0,1,174,0,0,2,0,2,1
301 | 52,1,1,120,325,0,1,172,0,0.2,2,0,2,1
302 | 46,0,1,105,204,0,1,172,0,0,2,0,2,1
303 | 51,1,2,94,227,0,1,154,1,0,2,1,3,1
304 | 55,0,1,132,342,0,1,166,0,1.2,2,0,2,1
305 | 60,1,0,145,282,0,0,142,1,2.8,1,2,3,0
306 | 52,0,2,136,196,0,0,169,0,0.1,1,0,2,1
307 | 62,1,0,120,267,0,1,99,1,1.8,1,2,3,0
308 | 44,0,2,118,242,0,1,149,0,0.3,1,1,2,1
309 | 44,1,1,120,220,0,1,170,0,0,2,0,2,1
310 | 59,1,2,126,218,1,1,134,0,2.2,1,1,1,0
311 | 56,0,1,140,294,0,0,153,0,1.3,1,0,2,1
312 | 61,1,0,120,260,0,1,140,1,3.6,1,1,3,0
313 | 48,1,0,130,256,1,0,150,1,0,2,2,3,0
314 | 70,1,2,160,269,0,1,112,1,2.9,1,1,3,0
315 | 74,0,1,120,269,0,0,121,1,0.2,2,1,2,1
316 | 40,1,3,140,199,0,1,178,1,1.4,2,0,3,1
317 | 42,1,3,148,244,0,0,178,0,0.8,2,2,2,1
318 | 64,0,2,140,313,0,1,133,0,0.2,2,0,3,1
319 | 63,0,2,135,252,0,0,172,0,0,2,0,2,1
320 | 59,1,0,140,177,0,1,162,1,0,2,1,3,0
321 | 53,0,2,128,216,0,0,115,0,0,2,0,0,1
322 | 53,0,0,130,264,0,0,143,0,0.4,1,0,2,1
323 | 48,0,2,130,275,0,1,139,0,0.2,2,0,2,1
324 | 45,1,0,142,309,0,0,147,1,0,1,3,3,0
325 | 66,1,1,160,246,0,1,120,1,0,1,3,1,0
326 | 48,1,1,130,245,0,0,180,0,0.2,1,0,2,1
327 | 56,0,1,140,294,0,0,153,0,1.3,1,0,2,1
328 | 54,1,1,192,283,0,0,195,0,0,2,1,3,0
329 | 57,1,0,150,276,0,0,112,1,0.6,1,1,1,0
330 | 70,1,0,130,322,0,0,109,0,2.4,1,3,2,0
331 | 53,0,2,128,216,0,0,115,0,0,2,0,0,1
332 | 37,0,2,120,215,0,1,170,0,0,2,0,2,1
333 | 63,0,0,108,269,0,1,169,1,1.8,1,2,2,0
334 | 37,1,2,130,250,0,1,187,0,3.5,0,0,2,1
335 | 54,0,2,110,214,0,1,158,0,1.6,1,0,2,1
336 | 60,1,0,130,206,0,0,132,1,2.4,1,2,3,0
337 | 58,1,0,150,270,0,0,111,1,0.8,2,0,3,0
338 | 57,1,2,150,126,1,1,173,0,0.2,2,1,3,1
339 | 54,1,2,125,273,0,0,152,0,0.5,0,1,2,1
340 | 56,1,2,130,256,1,0,142,1,0.6,1,1,1,0
341 | 60,1,0,130,253,0,1,144,1,1.4,2,1,3,0
342 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
343 | 44,1,2,120,226,0,1,169,0,0,2,0,2,1
344 | 65,0,2,155,269,0,1,148,0,0.8,2,0,2,1
345 | 52,1,2,172,199,1,1,162,0,0.5,2,0,3,1
346 | 41,1,1,120,157,0,1,182,0,0,2,0,2,1
347 | 66,1,1,160,246,0,1,120,1,0,1,3,1,0
348 | 50,1,0,150,243,0,0,128,0,2.6,1,0,3,0
349 | 54,0,2,108,267,0,0,167,0,0,2,0,2,1
350 | 43,1,0,132,247,1,0,143,1,0.1,1,4,3,0
351 | 62,0,2,130,263,0,1,97,0,1.2,1,1,3,0
352 | 66,1,0,120,302,0,0,151,0,0.4,1,0,2,1
353 | 50,1,0,144,200,0,0,126,1,0.9,1,0,3,0
354 | 57,1,0,110,335,0,1,143,1,3,1,1,3,0
355 | 57,1,0,110,201,0,1,126,1,1.5,1,0,1,1
356 | 57,1,1,124,261,0,1,141,0,0.3,2,0,3,0
357 | 46,0,0,138,243,0,0,152,1,0,1,0,2,1
358 | 59,1,0,164,176,1,0,90,0,1,1,2,1,0
359 | 67,1,0,160,286,0,0,108,1,1.5,1,3,2,0
360 | 59,1,3,134,204,0,1,162,0,0.8,2,2,2,0
361 | 53,0,2,128,216,0,0,115,0,0,2,0,0,1
362 | 48,1,0,122,222,0,0,186,0,0,2,0,2,1
363 | 62,1,2,130,231,0,1,146,0,1.8,1,3,3,1
364 | 43,0,2,122,213,0,1,165,0,0.2,1,0,2,1
365 | 53,1,2,130,246,1,0,173,0,0,2,3,2,1
366 | 57,0,1,130,236,0,0,174,0,0,1,1,2,0
367 | 53,1,2,130,246,1,0,173,0,0,2,3,2,1
368 | 58,1,2,112,230,0,0,165,0,2.5,1,1,3,0
369 | 48,1,1,110,229,0,1,168,0,1,0,0,3,0
370 | 58,1,2,105,240,0,0,154,1,0.6,1,0,3,1
371 | 51,1,2,110,175,0,1,123,0,0.6,2,0,2,1
372 | 43,0,0,132,341,1,0,136,1,3,1,0,3,0
373 | 55,1,0,132,353,0,1,132,1,1.2,1,1,3,0
374 | 54,0,2,110,214,0,1,158,0,1.6,1,0,2,1
375 | 58,1,1,120,284,0,0,160,0,1.8,1,0,2,0
376 | 46,0,2,142,177,0,0,160,1,1.4,0,0,2,1
377 | 66,1,0,160,228,0,0,138,0,2.3,2,0,1,1
378 | 59,1,1,140,221,0,1,164,1,0,2,0,2,1
379 | 64,0,0,130,303,0,1,122,0,2,1,2,2,1
380 | 67,1,0,120,237,0,1,71,0,1,1,0,2,0
381 | 52,1,3,118,186,0,0,190,0,0,1,0,1,1
382 | 58,1,0,146,218,0,1,105,0,2,1,1,3,0
383 | 58,1,2,132,224,0,0,173,0,3.2,2,2,3,0
384 | 59,1,0,110,239,0,0,142,1,1.2,1,1,3,0
385 | 58,1,0,150,270,0,0,111,1,0.8,2,0,3,0
386 | 35,1,0,126,282,0,0,156,1,0,2,0,3,0
387 | 51,1,2,110,175,0,1,123,0,0.6,2,0,2,1
388 | 42,0,2,120,209,0,1,173,0,0,1,0,2,1
389 | 77,1,0,125,304,0,0,162,1,0,2,3,2,0
390 | 64,1,0,120,246,0,0,96,1,2.2,0,1,2,0
391 | 63,1,3,145,233,1,0,150,0,2.3,0,0,1,1
392 | 58,0,1,136,319,1,0,152,0,0,2,2,2,0
393 | 45,1,3,110,264,0,1,132,0,1.2,1,0,3,0
394 | 51,1,2,110,175,0,1,123,0,0.6,2,0,2,1
395 | 62,0,0,160,164,0,0,145,0,6.2,0,3,3,0
396 | 63,1,0,130,330,1,0,132,1,1.8,2,3,3,0
397 | 66,0,2,146,278,0,0,152,0,0,1,1,2,1
398 | 68,1,2,180,274,1,0,150,1,1.6,1,0,3,0
399 | 40,1,0,110,167,0,0,114,1,2,1,0,3,0
400 | 66,1,0,160,228,0,0,138,0,2.3,2,0,1,1
401 | 63,1,3,145,233,1,0,150,0,2.3,0,0,1,1
402 | 49,1,2,120,188,0,1,139,0,2,1,3,3,0
403 | 71,0,0,112,149,0,1,125,0,1.6,1,0,2,1
404 | 70,1,1,156,245,0,0,143,0,0,2,0,2,1
405 | 46,0,1,105,204,0,1,172,0,0,2,0,2,1
406 | 61,1,0,140,207,0,0,138,1,1.9,2,1,3,0
407 | 56,1,2,130,256,1,0,142,1,0.6,1,1,1,0
408 | 58,1,2,140,211,1,0,165,0,0,2,0,2,1
409 | 58,1,0,100,234,0,1,156,0,0.1,2,1,3,0
410 | 46,0,0,138,243,0,0,152,1,0,1,0,2,1
411 | 46,1,2,150,231,0,1,147,0,3.6,1,0,2,0
412 | 41,0,1,105,198,0,1,168,0,0,2,1,2,1
413 | 56,1,0,125,249,1,0,144,1,1.2,1,1,2,0
414 | 57,1,0,150,276,0,0,112,1,0.6,1,1,1,0
415 | 70,1,0,130,322,0,0,109,0,2.4,1,3,2,0
416 | 59,1,3,170,288,0,0,159,0,0.2,1,0,3,0
417 | 41,0,1,130,204,0,0,172,0,1.4,2,0,2,1
418 | 54,1,2,125,273,0,0,152,0,0.5,0,1,2,1
419 | 52,1,2,138,223,0,1,169,0,0,2,4,2,1
420 | 62,0,0,124,209,0,1,163,0,0,2,0,2,1
421 | 65,0,2,160,360,0,0,151,0,0.8,2,0,2,1
422 | 57,0,0,128,303,0,0,159,0,0,2,1,2,1
423 | 42,0,0,102,265,0,0,122,0,0.6,1,0,2,1
424 | 57,0,0,120,354,0,1,163,1,0.6,2,0,2,1
425 | 58,0,1,136,319,1,0,152,0,0,2,2,2,0
426 | 45,1,0,142,309,0,0,147,1,0,1,3,3,0
427 | 51,0,0,130,305,0,1,142,1,1.2,1,0,3,0
428 | 54,0,2,160,201,0,1,163,0,0,2,1,2,1
429 | 57,1,2,150,168,0,1,174,0,1.6,2,0,2,1
430 | 43,1,0,132,247,1,0,143,1,0.1,1,4,3,0
431 | 47,1,2,108,243,0,1,152,0,0,2,0,2,0
432 | 67,1,2,152,212,0,0,150,0,0.8,1,0,3,0
433 | 65,0,0,150,225,0,0,114,0,1,1,3,3,0
434 | 60,0,2,102,318,0,1,160,0,0,2,1,2,1
435 | 37,1,2,130,250,0,1,187,0,3.5,0,0,2,1
436 | 41,0,2,112,268,0,0,172,1,0,2,0,2,1
437 | 57,0,0,120,354,0,1,163,1,0.6,2,0,2,1
438 | 59,0,0,174,249,0,1,143,1,0,1,0,2,0
439 | 67,1,0,120,229,0,0,129,1,2.6,1,2,3,0
440 | 47,1,2,130,253,0,1,179,0,0,2,0,2,1
441 | 58,1,1,120,284,0,0,160,0,1.8,1,0,2,0
442 | 62,0,0,150,244,0,1,154,1,1.4,1,0,2,0
443 | 60,1,0,140,293,0,0,170,0,1.2,1,2,3,0
444 | 57,1,0,152,274,0,1,88,1,1.2,1,1,3,0
445 | 57,1,2,150,168,0,1,174,0,1.6,2,0,2,1
446 | 47,1,2,130,253,0,1,179,0,0,2,0,2,1
447 | 52,1,1,128,205,1,1,184,0,0,2,0,2,1
448 | 53,1,2,130,246,1,0,173,0,0,2,3,2,1
449 | 55,1,0,160,289,0,0,145,1,0.8,1,1,3,0
450 | 51,0,2,120,295,0,0,157,0,0.6,2,0,2,1
451 | 52,1,0,112,230,0,1,160,0,0,2,1,2,0
452 | 63,0,0,150,407,0,0,154,0,4,1,3,3,0
453 | 49,0,1,134,271,0,1,162,0,0,1,0,2,1
454 | 66,0,0,178,228,1,1,165,1,1,1,2,3,0
455 | 49,0,1,134,271,0,1,162,0,0,1,0,2,1
456 | 65,0,0,150,225,0,0,114,0,1,1,3,3,0
457 | 69,1,3,160,234,1,0,131,0,0.1,1,1,2,1
458 | 47,1,2,108,243,0,1,152,0,0,2,0,2,0
459 | 39,0,2,138,220,0,1,152,0,0,1,0,2,1
460 | 43,1,0,150,247,0,1,171,0,1.5,2,0,2,1
461 | 51,1,0,140,261,0,0,186,1,0,2,0,2,1
462 | 69,1,2,140,254,0,0,146,0,2,1,3,3,0
463 | 48,1,2,124,255,1,1,175,0,0,2,2,2,1
464 | 52,1,3,118,186,0,0,190,0,0,1,0,1,1
465 | 43,1,0,110,211,0,1,161,0,0,2,0,3,1
466 | 67,0,2,115,564,0,0,160,0,1.6,1,0,3,1
467 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
468 | 44,1,1,130,219,0,0,188,0,0,2,0,2,1
469 | 47,1,0,110,275,0,0,118,1,1,1,1,2,0
470 | 61,1,2,150,243,1,1,137,1,1,1,0,2,1
471 | 67,1,0,160,286,0,0,108,1,1.5,1,3,2,0
472 | 60,0,3,150,240,0,1,171,0,0.9,2,0,2,1
473 | 64,0,2,140,313,0,1,133,0,0.2,2,0,3,1
474 | 58,0,0,130,197,0,1,131,0,0.6,1,0,2,1
475 | 41,1,2,130,214,0,0,168,0,2,1,0,2,1
476 | 48,1,1,110,229,0,1,168,0,1,0,0,3,0
477 | 57,1,2,150,126,1,1,173,0,0.2,2,1,3,1
478 | 57,1,0,165,289,1,0,124,0,1,1,3,3,0
479 | 57,1,2,128,229,0,0,150,0,0.4,1,1,3,0
480 | 39,1,2,140,321,0,0,182,0,0,2,0,2,1
481 | 58,1,0,128,216,0,0,131,1,2.2,1,3,3,0
482 | 51,0,0,130,305,0,1,142,1,1.2,1,0,3,0
483 | 63,0,0,150,407,0,0,154,0,4,1,3,3,0
484 | 51,1,0,140,298,0,1,122,1,4.2,1,3,3,0
485 | 35,1,1,122,192,0,1,174,0,0,2,0,2,1
486 | 65,1,0,110,248,0,0,158,0,0.6,2,2,1,0
487 | 62,1,1,120,281,0,0,103,0,1.4,1,1,3,0
488 | 41,1,0,110,172,0,0,158,0,0,2,0,3,0
489 | 65,1,0,135,254,0,0,127,0,2.8,1,1,3,0
490 | 54,0,1,132,288,1,0,159,1,0,2,1,2,1
491 | 61,1,2,150,243,1,1,137,1,1,1,0,2,1
492 | 57,0,0,128,303,0,0,159,0,0,2,1,2,1
493 | 57,1,2,150,168,0,1,174,0,1.6,2,0,2,1
494 | 64,1,2,125,309,0,1,131,1,1.8,1,0,3,0
495 | 55,1,0,132,353,0,1,132,1,1.2,1,1,3,0
496 | 51,1,2,125,245,1,0,166,0,2.4,1,0,2,1
497 | 59,1,0,135,234,0,1,161,0,0.5,1,0,3,1
498 | 68,1,2,180,274,1,0,150,1,1.6,1,0,3,0
499 | 57,1,1,154,232,0,0,164,0,0,2,1,2,0
500 | 54,1,0,140,239,0,1,160,0,1.2,2,0,2,1
501 | 46,0,2,142,177,0,0,160,1,1.4,0,0,2,1
502 | 71,0,0,112,149,0,1,125,0,1.6,1,0,2,1
503 | 35,0,0,138,183,0,1,182,0,1.4,2,0,2,1
504 | 46,0,2,142,177,0,0,160,1,1.4,0,0,2,1
505 | 45,0,1,130,234,0,0,175,0,0.6,1,0,2,1
506 | 47,1,2,108,243,0,1,152,0,0,2,0,2,0
507 | 44,0,2,118,242,0,1,149,0,0.3,1,1,2,1
508 | 61,1,0,120,260,0,1,140,1,3.6,1,1,3,0
509 | 41,0,1,130,204,0,0,172,0,1.4,2,0,2,1
510 | 56,0,0,200,288,1,0,133,1,4,0,2,3,0
511 | 55,0,0,180,327,0,2,117,1,3.4,1,0,2,0
512 | 54,0,1,132,288,1,0,159,1,0,2,1,2,1
513 | 43,1,0,120,177,0,0,120,1,2.5,1,0,3,0
514 | 44,1,0,112,290,0,0,153,0,0,2,1,2,0
515 | 54,1,0,110,206,0,0,108,1,0,1,1,2,0
516 | 44,1,1,120,220,0,1,170,0,0,2,0,2,1
517 | 49,1,2,120,188,0,1,139,0,2,1,3,3,0
518 | 60,1,0,130,206,0,0,132,1,2.4,1,2,3,0
519 | 41,0,1,105,198,0,1,168,0,0,2,1,2,1
520 | 49,1,2,120,188,0,1,139,0,2,1,3,3,0
521 | 61,1,0,148,203,0,1,161,0,0,2,1,3,0
522 | 59,1,0,140,177,0,1,162,1,0,2,1,3,0
523 | 58,1,1,125,220,0,1,144,0,0.4,1,4,3,1
524 | 67,0,2,152,277,0,1,172,0,0,2,1,2,1
525 | 61,1,0,148,203,0,1,161,0,0,2,1,3,0
526 | 58,1,2,112,230,0,0,165,0,2.5,1,1,3,0
527 | 51,0,2,130,256,0,0,149,0,0.5,2,0,2,1
528 | 62,0,0,160,164,0,0,145,0,6.2,0,3,3,0
529 | 62,0,0,124,209,0,1,163,0,0,2,0,2,1
530 | 59,1,3,178,270,0,0,145,0,4.2,0,0,3,1
531 | 69,1,3,160,234,1,0,131,0,0.1,1,1,2,1
532 | 60,0,0,150,258,0,0,157,0,2.6,1,2,3,0
533 | 65,0,2,155,269,0,1,148,0,0.8,2,0,2,1
534 | 63,0,0,124,197,0,1,136,1,0,1,0,2,0
535 | 53,0,0,138,234,0,0,160,0,0,2,0,2,1
536 | 54,0,2,108,267,0,0,167,0,0,2,0,2,1
537 | 76,0,2,140,197,0,2,116,0,1.1,1,0,2,1
538 | 50,0,2,120,219,0,1,158,0,1.6,1,0,2,1
539 | 52,1,1,120,325,0,1,172,0,0.2,2,0,2,1
540 | 46,1,0,120,249,0,0,144,0,0.8,2,0,3,0
541 | 64,1,3,170,227,0,0,155,0,0.6,1,0,3,1
542 | 58,1,0,128,259,0,0,130,1,3,1,2,3,0
543 | 44,1,2,140,235,0,0,180,0,0,2,0,2,1
544 | 62,0,0,140,394,0,0,157,0,1.2,1,0,2,1
545 | 59,1,3,134,204,0,1,162,0,0.8,2,2,2,0
546 | 54,1,2,125,273,0,0,152,0,0.5,0,1,2,1
547 | 48,1,1,110,229,0,1,168,0,1,0,0,3,0
548 | 70,1,0,130,322,0,0,109,0,2.4,1,3,2,0
549 | 67,0,0,106,223,0,1,142,0,0.3,2,2,2,1
550 | 51,0,2,120,295,0,0,157,0,0.6,2,0,2,1
551 | 68,1,2,118,277,0,1,151,0,1,2,1,3,1
552 | 69,1,2,140,254,0,0,146,0,2,1,3,3,0
553 | 54,1,0,122,286,0,0,116,1,3.2,1,2,2,0
554 | 43,0,0,132,341,1,0,136,1,3,1,0,3,0
555 | 53,1,2,130,197,1,0,152,0,1.2,0,0,2,1
556 | 58,1,0,100,234,0,1,156,0,0.1,2,1,3,0
557 | 67,1,0,125,254,1,1,163,0,0.2,1,2,3,0
558 | 59,1,0,140,177,0,1,162,1,0,2,1,3,0
559 | 48,1,0,122,222,0,0,186,0,0,2,0,2,1
560 | 39,0,2,94,199,0,1,179,0,0,2,0,2,1
561 | 67,1,0,120,237,0,1,71,0,1,1,0,2,0
562 | 58,0,0,130,197,0,1,131,0,0.6,1,0,2,1
563 | 65,0,2,155,269,0,1,148,0,0.8,2,0,2,1
564 | 42,0,2,120,209,0,1,173,0,0,1,0,2,1
565 | 44,1,0,112,290,0,0,153,0,0,2,1,2,0
566 | 56,1,0,132,184,0,0,105,1,2.1,1,1,1,0
567 | 53,0,0,138,234,0,0,160,0,0,2,0,2,1
568 | 50,0,0,110,254,0,0,159,0,0,2,0,2,1
569 | 41,1,2,130,214,0,0,168,0,2,1,0,2,1
570 | 54,0,2,160,201,0,1,163,0,0,2,1,2,1
571 | 42,1,2,120,240,1,1,194,0,0.8,0,0,3,1
572 | 54,0,2,135,304,1,1,170,0,0,2,0,2,1
573 | 60,1,0,145,282,0,0,142,1,2.8,1,2,3,0
574 | 34,1,3,118,182,0,0,174,0,0,2,0,2,1
575 | 44,1,0,112,290,0,0,153,0,0,2,1,2,0
576 | 60,1,0,125,258,0,0,141,1,2.8,1,1,3,0
577 | 43,1,0,150,247,0,1,171,0,1.5,2,0,2,1
578 | 52,1,3,152,298,1,1,178,0,1.2,1,0,3,1
579 | 70,1,0,130,322,0,0,109,0,2.4,1,3,2,0
580 | 62,0,0,140,394,0,0,157,0,1.2,1,0,2,1
581 | 58,1,0,146,218,0,1,105,0,2,1,1,3,0
582 | 46,1,1,101,197,1,1,156,0,0,2,0,3,1
583 | 44,1,2,140,235,0,0,180,0,0,2,0,2,1
584 | 55,1,1,130,262,0,1,155,0,0,2,0,2,1
585 | 43,1,0,120,177,0,0,120,1,2.5,1,0,3,0
586 | 55,1,0,132,353,0,1,132,1,1.2,1,1,3,0
587 | 40,1,3,140,199,0,1,178,1,1.4,2,0,3,1
588 | 64,1,2,125,309,0,1,131,1,1.8,1,0,3,0
589 | 59,1,0,164,176,1,0,90,0,1,1,2,1,0
590 | 61,0,0,145,307,0,0,146,1,1,1,0,3,0
591 | 54,1,0,122,286,0,0,116,1,3.2,1,2,2,0
592 | 74,0,1,120,269,0,0,121,1,0.2,2,1,2,1
593 | 63,0,0,108,269,0,1,169,1,1.8,1,2,2,0
594 | 70,1,2,160,269,0,1,112,1,2.9,1,1,3,0
595 | 63,0,0,108,269,0,1,169,1,1.8,1,2,2,0
596 | 64,1,0,145,212,0,0,132,0,2,1,2,1,0
597 | 61,1,0,148,203,0,1,161,0,0,2,1,3,0
598 | 59,1,1,140,221,0,1,164,1,0,2,0,2,1
599 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
600 | 58,1,1,120,284,0,0,160,0,1.8,1,0,2,0
601 | 63,0,1,140,195,0,1,179,0,0,2,2,2,1
602 | 62,0,2,130,263,0,1,97,0,1.2,1,1,3,0
603 | 46,1,0,140,311,0,1,120,1,1.8,1,2,3,0
604 | 58,0,2,120,340,0,1,172,0,0,2,0,2,1
605 | 63,0,1,140,195,0,1,179,0,0,2,2,2,1
606 | 47,1,2,130,253,0,1,179,0,0,2,0,2,1
607 | 71,0,2,110,265,1,0,130,0,0,2,1,2,1
608 | 66,1,0,112,212,0,0,132,1,0.1,2,1,2,0
609 | 42,1,0,136,315,0,1,125,1,1.8,1,0,1,0
610 | 64,1,0,145,212,0,0,132,0,2,1,2,1,0
611 | 55,0,0,180,327,0,2,117,1,3.4,1,0,2,0
612 | 43,0,0,132,341,1,0,136,1,3,1,0,3,0
613 | 55,0,0,128,205,0,2,130,1,2,1,1,3,0
614 | 58,0,0,170,225,1,0,146,1,2.8,1,2,1,0
615 | 55,1,0,140,217,0,1,111,1,5.6,0,0,3,0
616 | 51,0,0,130,305,0,1,142,1,1.2,1,0,3,0
617 | 50,0,2,120,219,0,1,158,0,1.6,1,0,2,1
618 | 43,1,0,115,303,0,1,181,0,1.2,1,0,2,1
619 | 41,0,1,126,306,0,1,163,0,0,2,0,2,1
620 | 49,1,1,130,266,0,1,171,0,0.6,2,0,2,1
621 | 65,1,0,110,248,0,0,158,0,0.6,2,2,1,0
622 | 57,1,0,152,274,0,1,88,1,1.2,1,1,3,0
623 | 48,1,0,130,256,1,0,150,1,0,2,2,3,0
624 | 62,0,0,138,294,1,1,106,0,1.9,1,3,2,0
625 | 61,1,3,134,234,0,1,145,0,2.6,1,2,2,0
626 | 59,1,3,178,270,0,0,145,0,4.2,0,0,3,1
627 | 69,1,2,140,254,0,0,146,0,2,1,3,3,0
628 | 58,1,2,132,224,0,0,173,0,3.2,2,2,3,0
629 | 38,1,3,120,231,0,1,182,1,3.8,1,0,3,0
630 | 69,0,3,140,239,0,1,151,0,1.8,2,2,2,1
631 | 65,1,3,138,282,1,0,174,0,1.4,1,1,2,0
632 | 45,1,3,110,264,0,1,132,0,1.2,1,0,3,0
633 | 49,1,1,130,266,0,1,171,0,0.6,2,0,2,1
634 | 45,0,1,130,234,0,0,175,0,0.6,1,0,2,1
635 | 61,1,0,138,166,0,0,125,1,3.6,1,1,2,0
636 | 52,1,0,125,212,0,1,168,0,1,2,2,3,0
637 | 53,0,0,130,264,0,0,143,0,0.4,1,0,2,1
638 | 59,0,0,174,249,0,1,143,1,0,1,0,2,0
639 | 58,0,2,120,340,0,1,172,0,0,2,0,2,1
640 | 65,1,3,138,282,1,0,174,0,1.4,1,1,2,0
641 | 58,0,0,130,197,0,1,131,0,0.6,1,0,2,1
642 | 46,0,0,138,243,0,0,152,1,0,1,0,2,1
643 | 56,0,0,134,409,0,0,150,1,1.9,1,2,3,0
644 | 64,1,0,128,263,0,1,105,1,0.2,1,1,3,1
645 | 65,1,0,120,177,0,1,140,0,0.4,2,0,3,1
646 | 44,1,2,120,226,0,1,169,0,0,2,0,2,1
647 | 50,1,0,150,243,0,0,128,0,2.6,1,0,3,0
648 | 47,1,2,108,243,0,1,152,0,0,2,0,2,0
649 | 64,0,0,130,303,0,1,122,0,2,1,2,2,1
650 | 71,0,0,112,149,0,1,125,0,1.6,1,0,2,1
651 | 45,0,1,130,234,0,0,175,0,0.6,1,0,2,1
652 | 62,1,0,120,267,0,1,99,1,1.8,1,2,3,0
653 | 41,1,1,120,157,0,1,182,0,0,2,0,2,1
654 | 66,0,3,150,226,0,1,114,0,2.6,0,0,2,1
655 | 56,1,0,130,283,1,0,103,1,1.6,0,0,3,0
656 | 41,0,1,126,306,0,1,163,0,0,2,0,2,1
657 | 41,1,1,110,235,0,1,153,0,0,2,0,2,1
658 | 57,0,1,130,236,0,0,174,0,0,1,1,2,0
659 | 39,0,2,138,220,0,1,152,0,0,1,0,2,1
660 | 64,1,2,125,309,0,1,131,1,1.8,1,0,3,0
661 | 59,1,0,138,271,0,0,182,0,0,2,0,2,1
662 | 61,1,0,138,166,0,0,125,1,3.6,1,1,2,0
663 | 58,1,0,114,318,0,2,140,0,4.4,0,3,1,0
664 | 47,1,0,112,204,0,1,143,0,0.1,2,0,2,1
665 | 58,0,0,100,248,0,0,122,0,1,1,0,2,1
666 | 66,0,3,150,226,0,1,114,0,2.6,0,0,2,1
667 | 65,0,2,140,417,1,0,157,0,0.8,2,1,2,1
668 | 35,1,1,122,192,0,1,174,0,0,2,0,2,1
669 | 57,1,1,124,261,0,1,141,0,0.3,2,0,3,0
670 | 29,1,1,130,204,0,0,202,0,0,2,0,2,1
671 | 66,1,1,160,246,0,1,120,1,0,1,3,1,0
672 | 61,0,0,130,330,0,0,169,0,0,2,0,2,0
673 | 52,1,0,125,212,0,1,168,0,1,2,2,3,0
674 | 68,1,2,118,277,0,1,151,0,1,2,1,3,1
675 | 54,1,2,120,258,0,0,147,0,0.4,1,0,3,1
676 | 63,1,0,130,330,1,0,132,1,1.8,2,3,3,0
677 | 58,1,0,100,234,0,1,156,0,0.1,2,1,3,0
678 | 60,1,0,130,253,0,1,144,1,1.4,2,1,3,0
679 | 63,1,0,130,254,0,0,147,0,1.4,1,1,3,0
680 | 41,0,2,112,268,0,0,172,1,0,2,0,2,1
681 | 68,1,2,180,274,1,0,150,1,1.6,1,0,3,0
682 | 42,1,1,120,295,0,1,162,0,0,2,0,2,1
683 | 59,1,0,170,326,0,0,140,1,3.4,0,0,3,0
684 | 59,1,0,164,176,1,0,90,0,1,1,2,1,0
685 | 43,1,0,120,177,0,0,120,1,2.5,1,0,3,0
686 | 60,1,2,140,185,0,0,155,0,3,1,0,2,0
687 | 63,0,0,150,407,0,0,154,0,4,1,3,3,0
688 | 52,1,0,128,204,1,1,156,1,1,1,0,0,0
689 | 58,1,0,125,300,0,0,171,0,0,2,2,3,0
690 | 56,0,0,200,288,1,0,133,1,4,0,2,3,0
691 | 54,0,2,135,304,1,1,170,0,0,2,0,2,1
692 | 58,1,2,105,240,0,0,154,1,0.6,1,0,3,1
693 | 55,0,1,135,250,0,0,161,0,1.4,1,0,2,1
694 | 53,1,0,140,203,1,0,155,1,3.1,0,0,3,0
695 | 63,0,1,140,195,0,1,179,0,0,2,2,2,1
696 | 39,1,0,118,219,0,1,140,0,1.2,1,0,3,0
697 | 35,1,0,126,282,0,0,156,1,0,2,0,3,0
698 | 50,0,2,120,219,0,1,158,0,1.6,1,0,2,1
699 | 67,1,2,152,212,0,0,150,0,0.8,1,0,3,0
700 | 66,1,0,112,212,0,0,132,1,0.1,2,1,2,0
701 | 35,1,0,126,282,0,0,156,1,0,2,0,3,0
702 | 41,1,2,130,214,0,0,168,0,2,1,0,2,1
703 | 35,1,0,120,198,0,1,130,1,1.6,1,0,3,0
704 | 71,0,1,160,302,0,1,162,0,0.4,2,2,2,1
705 | 57,1,0,110,201,0,1,126,1,1.5,1,0,1,1
706 | 51,1,2,94,227,0,1,154,1,0,2,1,3,1
707 | 58,1,0,128,216,0,0,131,1,2.2,1,3,3,0
708 | 57,1,2,128,229,0,0,150,0,0.4,1,1,3,0
709 | 56,0,1,140,294,0,0,153,0,1.3,1,0,2,1
710 | 60,0,2,120,178,1,1,96,0,0,2,0,2,1
711 | 45,1,3,110,264,0,1,132,0,1.2,1,0,3,0
712 | 56,1,1,130,221,0,0,163,0,0,2,0,3,1
713 | 35,1,0,120,198,0,1,130,1,1.6,1,0,3,0
714 | 45,0,1,112,160,0,1,138,0,0,1,0,2,1
715 | 66,0,3,150,226,0,1,114,0,2.6,0,0,2,1
716 | 51,1,3,125,213,0,0,125,1,1.4,2,1,2,1
717 | 70,1,1,156,245,0,0,143,0,0,2,0,2,1
718 | 55,0,0,128,205,0,2,130,1,2,1,1,3,0
719 | 56,1,2,130,256,1,0,142,1,0.6,1,1,1,0
720 | 55,0,1,135,250,0,0,161,0,1.4,1,0,2,1
721 | 52,1,0,108,233,1,1,147,0,0.1,2,3,3,1
722 | 64,1,2,140,335,0,1,158,0,0,2,0,2,0
723 | 45,1,0,115,260,0,0,185,0,0,2,0,2,1
724 | 67,0,2,152,277,0,1,172,0,0,2,1,2,1
725 | 68,0,2,120,211,0,0,115,0,1.5,1,0,2,1
726 | 74,0,1,120,269,0,0,121,1,0.2,2,1,2,1
727 | 60,0,0,150,258,0,0,157,0,2.6,1,2,3,0
728 | 48,1,0,124,274,0,0,166,0,0.5,1,0,3,0
729 | 56,1,1,130,221,0,0,163,0,0,2,0,3,1
730 | 46,1,0,140,311,0,1,120,1,1.8,1,2,3,0
731 | 55,0,1,135,250,0,0,161,0,1.4,1,0,2,1
732 | 44,1,1,120,220,0,1,170,0,0,2,0,2,1
733 | 52,1,0,112,230,0,1,160,0,0,2,1,2,0
734 | 51,1,2,94,227,0,1,154,1,0,2,1,3,1
735 | 44,0,2,108,141,0,1,175,0,0.6,1,0,2,1
736 | 52,1,0,128,204,1,1,156,1,1,1,0,0,0
737 | 50,1,2,129,196,0,1,163,0,0,2,0,2,1
738 | 59,1,0,110,239,0,0,142,1,1.2,1,1,3,0
739 | 67,1,0,120,229,0,0,129,1,2.6,1,2,3,0
740 | 58,1,0,125,300,0,0,171,0,0,2,2,3,0
741 | 52,1,0,128,255,0,1,161,1,0,2,1,3,0
742 | 44,1,2,140,235,0,0,180,0,0,2,0,2,1
743 | 41,0,2,112,268,0,0,172,1,0,2,0,2,1
744 | 63,1,0,130,330,1,0,132,1,1.8,2,3,3,0
745 | 58,1,1,125,220,0,1,144,0,0.4,1,4,3,1
746 | 60,0,2,102,318,0,1,160,0,0,2,1,2,1
747 | 51,1,2,100,222,0,1,143,1,1.2,1,0,2,1
748 | 64,1,2,140,335,0,1,158,0,0,2,0,2,0
749 | 60,1,0,117,230,1,1,160,1,1.4,2,2,3,0
750 | 44,1,2,120,226,0,1,169,0,0,2,0,2,1
751 | 58,1,1,125,220,0,1,144,0,0.4,1,4,3,1
752 | 55,1,1,130,262,0,1,155,0,0,2,0,2,1
753 | 65,0,2,160,360,0,0,151,0,0.8,2,0,2,1
754 | 48,1,1,130,245,0,0,180,0,0.2,1,0,2,1
755 | 65,1,0,120,177,0,1,140,0,0.4,2,0,3,1
756 | 51,0,2,130,256,0,0,149,0,0.5,2,0,2,1
757 | 48,1,2,124,255,1,1,175,0,0,2,2,2,1
758 | 64,1,0,120,246,0,0,96,1,2.2,0,1,2,0
759 | 66,1,0,160,228,0,0,138,0,2.3,2,0,1,1
760 | 46,0,1,105,204,0,1,172,0,0,2,0,2,1
761 | 61,0,0,130,330,0,0,169,0,0,2,0,2,0
762 | 57,1,0,150,276,0,0,112,1,0.6,1,1,1,0
763 | 49,0,0,130,269,0,1,163,0,0,2,0,2,1
764 | 56,1,1,130,221,0,0,163,0,0,2,0,3,1
765 | 58,0,3,150,283,1,0,162,0,1,2,0,2,1
766 | 63,1,0,140,187,0,0,144,1,4,2,2,3,0
767 | 57,1,0,110,335,0,1,143,1,3,1,1,3,0
768 | 57,1,0,110,335,0,1,143,1,3,1,1,3,0
769 | 68,1,0,144,193,1,1,141,0,3.4,1,2,3,0
770 | 46,1,1,101,197,1,1,156,0,0,2,0,3,1
771 | 71,0,2,110,265,1,0,130,0,0,2,1,2,1
772 | 41,1,1,135,203,0,1,132,0,0,1,0,1,1
773 | 45,0,0,138,236,0,0,152,1,0.2,1,0,2,1
774 | 62,0,0,150,244,0,1,154,1,1.4,1,0,2,0
775 | 65,0,0,150,225,0,0,114,0,1,1,3,3,0
776 | 48,0,2,130,275,0,1,139,0,0.2,2,0,2,1
777 | 51,1,2,100,222,0,1,143,1,1.2,1,0,2,1
778 | 61,0,0,145,307,0,0,146,1,1,1,0,3,0
779 | 53,1,0,123,282,0,1,95,1,2,1,2,3,0
780 | 59,1,3,134,204,0,1,162,0,0.8,2,2,2,0
781 | 34,0,1,118,210,0,1,192,0,0.7,2,0,2,1
782 | 44,1,0,120,169,0,1,144,1,2.8,0,0,1,0
783 | 58,1,0,146,218,0,1,105,0,2,1,1,3,0
784 | 64,0,0,130,303,0,1,122,0,2,1,2,2,1
785 | 56,1,1,120,240,0,1,169,0,0,0,0,2,1
786 | 54,1,2,150,232,0,0,165,0,1.6,2,0,3,1
787 | 55,1,0,160,289,0,0,145,1,0.8,1,1,3,0
788 | 67,1,0,125,254,1,1,163,0,0.2,1,2,3,0
789 | 51,1,0,140,298,0,1,122,1,4.2,1,3,3,0
790 | 62,0,0,138,294,1,1,106,0,1.9,1,3,2,0
791 | 62,1,1,120,281,0,0,103,0,1.4,1,1,3,0
792 | 54,1,0,110,239,0,1,126,1,2.8,1,1,3,0
793 | 54,1,0,110,239,0,1,126,1,2.8,1,1,3,0
794 | 68,1,0,144,193,1,1,141,0,3.4,1,2,3,0
795 | 60,0,2,120,178,1,1,96,0,0,2,0,2,1
796 | 61,1,3,134,234,0,1,145,0,2.6,1,2,2,0
797 | 62,1,1,128,208,1,0,140,0,0,2,0,2,1
798 | 41,1,1,135,203,0,1,132,0,0,1,0,1,1
799 | 65,0,0,150,225,0,0,114,0,1,1,3,3,0
800 | 59,1,3,170,288,0,0,159,0,0.2,1,0,3,0
801 | 43,1,0,115,303,0,1,181,0,1.2,1,0,2,1
802 | 67,1,0,120,229,0,0,129,1,2.6,1,2,3,0
803 | 63,1,3,145,233,1,0,150,0,2.3,0,0,1,1
804 | 63,0,0,124,197,0,1,136,1,0,1,0,2,0
805 | 52,1,0,112,230,0,1,160,0,0,2,1,2,0
806 | 58,0,0,130,197,0,1,131,0,0.6,1,0,2,1
807 | 53,1,0,142,226,0,0,111,1,0,2,0,3,1
808 | 57,1,0,150,276,0,0,112,1,0.6,1,1,1,0
809 | 44,1,2,130,233,0,1,179,1,0.4,2,0,2,1
810 | 51,1,2,94,227,0,1,154,1,0,2,1,3,1
811 | 54,0,2,110,214,0,1,158,0,1.6,1,0,2,1
812 | 40,1,0,110,167,0,0,114,1,2,1,0,3,0
813 | 57,1,1,124,261,0,1,141,0,0.3,2,0,3,0
814 | 62,0,0,140,268,0,0,160,0,3.6,0,2,2,0
815 | 53,1,0,140,203,1,0,155,1,3.1,0,0,3,0
816 | 62,1,1,128,208,1,0,140,0,0,2,0,2,1
817 | 58,1,2,105,240,0,0,154,1,0.6,1,0,3,1
818 | 70,1,1,156,245,0,0,143,0,0,2,0,2,1
819 | 45,1,0,115,260,0,0,185,0,0,2,0,2,1
820 | 42,1,3,148,244,0,0,178,0,0.8,2,2,2,1
821 | 58,0,0,170,225,1,0,146,1,2.8,1,2,1,0
822 | 61,1,0,140,207,0,0,138,1,1.9,2,1,3,0
823 | 62,0,0,140,268,0,0,160,0,3.6,0,2,2,0
824 | 60,1,0,130,253,0,1,144,1,1.4,2,1,3,0
825 | 54,1,0,140,239,0,1,160,0,1.2,2,0,2,1
826 | 61,1,0,138,166,0,0,125,1,3.6,1,1,2,0
827 | 63,0,2,135,252,0,0,172,0,0,2,0,2,1
828 | 42,1,2,130,180,0,1,150,0,0,2,0,2,1
829 | 57,1,2,128,229,0,0,150,0,0.4,1,1,3,0
830 | 44,1,2,130,233,0,1,179,1,0.4,2,0,2,1
831 | 54,1,0,124,266,0,0,109,1,2.2,1,1,3,0
832 | 51,1,2,100,222,0,1,143,1,1.2,1,0,2,1
833 | 58,1,1,125,220,0,1,144,0,0.4,1,4,3,1
834 | 68,1,2,118,277,0,1,151,0,1,2,1,3,1
835 | 55,1,0,140,217,0,1,111,1,5.6,0,0,3,0
836 | 42,1,0,136,315,0,1,125,1,1.8,1,0,1,0
837 | 49,1,2,118,149,0,0,126,0,0.8,2,3,2,0
838 | 53,0,0,138,234,0,0,160,0,0,2,0,2,1
839 | 52,1,2,172,199,1,1,162,0,0.5,2,0,3,1
840 | 51,1,3,125,213,0,0,125,1,1.4,2,1,2,1
841 | 51,1,0,140,261,0,0,186,1,0,2,0,2,1
842 | 70,1,0,145,174,0,1,125,1,2.6,0,0,3,0
843 | 35,0,0,138,183,0,1,182,0,1.4,2,0,2,1
844 | 58,1,2,112,230,0,0,165,0,2.5,1,1,3,0
845 | 59,1,3,160,273,0,0,125,0,0,2,0,2,0
846 | 60,1,0,140,293,0,0,170,0,1.2,1,2,3,0
847 | 56,1,0,132,184,0,0,105,1,2.1,1,1,1,0
848 | 35,0,0,138,183,0,1,182,0,1.4,2,0,2,1
849 | 61,1,0,138,166,0,0,125,1,3.6,1,1,2,0
850 | 58,0,3,150,283,1,0,162,0,1,2,0,2,1
851 | 52,1,0,128,255,0,1,161,1,0,2,1,3,0
852 | 58,1,1,120,284,0,0,160,0,1.8,1,0,2,0
853 | 37,1,2,130,250,0,1,187,0,3.5,0,0,2,1
854 | 52,1,0,128,255,0,1,161,1,0,2,1,3,0
855 | 67,1,0,120,229,0,0,129,1,2.6,1,2,3,0
856 | 65,1,3,138,282,1,0,174,0,1.4,1,1,2,0
857 | 46,1,1,101,197,1,1,156,0,0,2,0,3,1
858 | 68,0,2,120,211,0,0,115,0,1.5,1,0,2,1
859 | 43,1,0,115,303,0,1,181,0,1.2,1,0,2,1
860 | 68,0,2,120,211,0,0,115,0,1.5,1,0,2,1
861 | 51,1,0,140,299,0,1,173,1,1.6,2,0,3,0
862 | 52,1,0,112,230,0,1,160,0,0,2,1,2,0
863 | 64,1,2,140,335,0,1,158,0,0,2,0,2,0
864 | 59,1,3,170,288,0,0,159,0,0.2,1,0,3,0
865 | 52,1,0,125,212,0,1,168,0,1,2,2,3,0
866 | 59,1,3,160,273,0,0,125,0,0,2,0,2,0
867 | 60,0,3,150,240,0,1,171,0,0.9,2,0,2,1
868 | 41,1,2,112,250,0,1,179,0,0,2,0,2,1
869 | 41,1,1,110,235,0,1,153,0,0,2,0,2,1
870 | 56,1,1,120,240,0,1,169,0,0,0,0,2,1
871 | 56,1,1,120,236,0,1,178,0,0.8,2,0,2,1
872 | 48,0,2,130,275,0,1,139,0,0.2,2,0,2,1
873 | 39,1,2,140,321,0,0,182,0,0,2,0,2,1
874 | 64,1,3,170,227,0,0,155,0,0.6,1,0,3,1
875 | 57,1,0,140,192,0,1,148,0,0.4,1,0,1,1
876 | 59,1,3,160,273,0,0,125,0,0,2,0,2,0
877 | 60,1,0,130,206,0,0,132,1,2.4,1,2,3,0
878 | 61,1,0,140,207,0,0,138,1,1.9,2,1,3,0
879 | 43,0,2,122,213,0,1,165,0,0.2,1,0,2,1
880 | 54,1,0,120,188,0,1,113,0,1.4,1,1,3,0
881 | 59,1,0,138,271,0,0,182,0,0,2,0,2,1
882 | 57,1,0,132,207,0,1,168,1,0,2,0,3,1
883 | 57,1,1,154,232,0,0,164,0,0,2,1,2,0
884 | 57,1,0,130,131,0,1,115,1,1.2,1,1,3,0
885 | 48,1,0,124,274,0,0,166,0,0.5,1,0,3,0
886 | 70,1,0,145,174,0,1,125,1,2.6,0,0,3,0
887 | 57,1,0,165,289,1,0,124,0,1,1,3,3,0
888 | 61,1,0,120,260,0,1,140,1,3.6,1,1,3,0
889 | 57,1,0,110,201,0,1,126,1,1.5,1,0,1,1
890 | 60,0,0,150,258,0,0,157,0,2.6,1,2,3,0
891 | 63,0,0,150,407,0,0,154,0,4,1,3,3,0
892 | 55,0,0,128,205,0,2,130,1,2,1,1,3,0
893 | 64,0,0,180,325,0,1,154,1,0,2,0,2,1
894 | 54,1,0,110,239,0,1,126,1,2.8,1,1,3,0
895 | 52,1,0,128,204,1,1,156,1,1,1,0,0,0
896 | 51,1,0,140,299,0,1,173,1,1.6,2,0,3,0
897 | 62,0,2,130,263,0,1,97,0,1.2,1,1,3,0
898 | 59,1,3,178,270,0,0,145,0,4.2,0,0,3,1
899 | 52,1,1,134,201,0,1,158,0,0.8,2,1,2,1
900 | 42,0,0,102,265,0,0,122,0,0.6,1,0,2,1
901 | 59,1,0,135,234,0,1,161,0,0.5,1,0,3,1
902 | 61,1,3,134,234,0,1,145,0,2.6,1,2,2,0
903 | 42,0,0,102,265,0,0,122,0,0.6,1,0,2,1
904 | 62,0,0,140,268,0,0,160,0,3.6,0,2,2,0
905 | 59,1,2,126,218,1,1,134,0,2.2,1,1,1,0
906 | 55,1,1,130,262,0,1,155,0,0,2,0,2,1
907 | 64,1,0,120,246,0,0,96,1,2.2,0,1,2,0
908 | 42,1,0,140,226,0,1,178,0,0,2,0,2,1
909 | 50,0,1,120,244,0,1,162,0,1.1,2,0,2,1
910 | 62,1,0,120,267,0,1,99,1,1.8,1,2,3,0
911 | 50,1,0,144,200,0,0,126,1,0.9,1,0,3,0
912 | 50,1,2,140,233,0,1,163,0,0.6,1,1,3,0
913 | 58,0,1,136,319,1,0,152,0,0,2,2,2,0
914 | 35,1,0,120,198,0,1,130,1,1.6,1,0,3,0
915 | 45,1,0,104,208,0,0,148,1,3,1,0,2,1
916 | 66,1,0,112,212,0,0,132,1,0.1,2,1,2,0
917 | 46,1,0,120,249,0,0,144,0,0.8,2,0,3,0
918 | 65,1,0,135,254,0,0,127,0,2.8,1,1,3,0
919 | 47,1,2,130,253,0,1,179,0,0,2,0,2,1
920 | 59,1,3,134,204,0,1,162,0,0.8,2,2,2,0
921 | 38,1,3,120,231,0,1,182,1,3.8,1,0,3,0
922 | 39,1,0,118,219,0,1,140,0,1.2,1,0,3,0
923 | 58,1,0,146,218,0,1,105,0,2,1,1,3,0
924 | 44,1,1,120,263,0,1,173,0,0,2,0,3,1
925 | 54,1,0,140,239,0,1,160,0,1.2,2,0,2,1
926 | 61,0,0,130,330,0,0,169,0,0,2,0,2,0
927 | 57,1,0,130,131,0,1,115,1,1.2,1,1,3,0
928 | 54,1,0,110,206,0,0,108,1,0,1,1,2,0
929 | 42,1,2,120,240,1,1,194,0,0.8,0,0,3,1
930 | 54,1,0,124,266,0,0,109,1,2.2,1,1,3,0
931 | 60,1,0,130,206,0,0,132,1,2.4,1,2,3,0
932 | 65,1,0,135,254,0,0,127,0,2.8,1,1,3,0
933 | 40,1,0,152,223,0,1,181,0,0,2,0,3,0
934 | 51,0,2,140,308,0,0,142,0,1.5,2,1,2,1
935 | 38,1,3,120,231,0,1,182,1,3.8,1,0,3,0
936 | 42,1,2,130,180,0,1,150,0,0,2,0,2,1
937 | 56,1,1,120,240,0,1,169,0,0,0,0,2,1
938 | 43,1,2,130,315,0,1,162,0,1.9,2,1,2,1
939 | 64,1,2,140,335,0,1,158,0,0,2,0,2,0
940 | 53,1,0,142,226,0,0,111,1,0,2,0,3,1
941 | 49,0,1,134,271,0,1,162,0,0,1,0,2,1
942 | 57,0,0,140,241,0,1,123,1,0.2,1,0,3,0
943 | 52,0,2,136,196,0,0,169,0,0.1,1,0,2,1
944 | 69,0,3,140,239,0,1,151,0,1.8,2,2,2,1
945 | 65,1,0,120,177,0,1,140,0,0.4,2,0,3,1
946 | 66,0,0,178,228,1,1,165,1,1,1,2,3,0
947 | 56,1,3,120,193,0,0,162,0,1.9,1,0,3,1
948 | 67,0,2,152,277,0,1,172,0,0,2,1,2,1
949 | 54,0,2,160,201,0,1,163,0,0,2,1,2,1
950 | 70,1,0,145,174,0,1,125,1,2.6,0,0,3,0
951 | 57,1,0,132,207,0,1,168,1,0,2,0,3,1
952 | 67,1,0,160,286,0,0,108,1,1.5,1,3,2,0
953 | 62,0,2,130,263,0,1,97,0,1.2,1,1,3,0
954 | 54,0,2,135,304,1,1,170,0,0,2,0,2,1
955 | 45,0,0,138,236,0,0,152,1,0.2,1,0,2,1
956 | 53,0,0,130,264,0,0,143,0,0.4,1,0,2,1
957 | 62,1,2,130,231,0,1,146,0,1.8,1,3,3,1
958 | 49,0,0,130,269,0,1,163,0,0,2,0,2,1
959 | 50,1,2,140,233,0,1,163,0,0.6,1,1,3,0
960 | 65,0,2,140,417,1,0,157,0,0.8,2,1,2,1
961 | 69,0,3,140,239,0,1,151,0,1.8,2,2,2,1
962 | 52,0,2,136,196,0,0,169,0,0.1,1,0,2,1
963 | 58,0,0,100,248,0,0,122,0,1,1,0,2,1
964 | 52,1,0,108,233,1,1,147,0,0.1,2,3,3,1
965 | 57,0,0,140,241,0,1,123,1,0.2,1,0,3,0
966 | 44,0,2,108,141,0,1,175,0,0.6,1,0,2,1
967 | 76,0,2,140,197,0,2,116,0,1.1,1,0,2,1
968 | 58,1,0,128,259,0,0,130,1,3,1,2,3,0
969 | 60,0,2,120,178,1,1,96,0,0,2,0,2,1
970 | 53,1,0,140,203,1,0,155,1,3.1,0,0,3,0
971 | 52,1,1,120,325,0,1,172,0,0.2,2,0,2,1
972 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1
973 | 52,1,2,172,199,1,1,162,0,0.5,2,0,3,1
974 | 52,1,3,118,186,0,0,190,0,0,1,0,1,1
975 | 51,1,2,125,245,1,0,166,0,2.4,1,0,2,1
976 | 43,1,0,110,211,0,1,161,0,0,2,0,3,1
977 | 39,1,0,118,219,0,1,140,0,1.2,1,0,3,0
978 | 63,0,0,108,269,0,1,169,1,1.8,1,2,2,0
979 | 52,1,1,128,205,1,1,184,0,0,2,0,2,1
980 | 44,1,0,110,197,0,0,177,0,0,2,1,2,0
981 | 45,1,0,142,309,0,0,147,1,0,1,3,3,0
982 | 57,1,0,140,192,0,1,148,0,0.4,1,0,1,1
983 | 39,1,0,118,219,0,1,140,0,1.2,1,0,3,0
984 | 67,0,0,106,223,0,1,142,0,0.3,2,2,2,1
985 | 64,1,0,128,263,0,1,105,1,0.2,1,1,3,1
986 | 59,1,0,135,234,0,1,161,0,0.5,1,0,3,1
987 | 62,1,2,130,231,0,1,146,0,1.8,1,3,3,1
988 | 55,0,0,180,327,0,2,117,1,3.4,1,0,2,0
989 | 57,1,1,154,232,0,0,164,0,0,2,1,2,0
990 | 60,1,0,140,293,0,0,170,0,1.2,1,2,3,0
991 | 71,0,1,160,302,0,1,162,0,0.4,2,2,2,1
992 | 56,1,1,120,236,0,1,178,0,0.8,2,0,2,1
993 | 60,1,0,117,230,1,1,160,1,1.4,2,2,3,0
994 | 50,0,0,110,254,0,0,159,0,0,2,0,2,1
995 | 43,1,0,132,247,1,0,143,1,0.1,1,4,3,0
996 | 59,1,0,110,239,0,0,142,1,1.2,1,1,3,0
997 | 44,1,1,120,263,0,1,173,0,0,2,0,3,1
998 | 56,0,0,134,409,0,0,150,1,1.9,1,2,3,0
999 | 54,1,0,120,188,0,1,113,0,1.4,1,1,3,0
1000 | 42,1,0,136,315,0,1,125,1,1.8,1,0,1,0
1001 | 67,1,0,125,254,1,1,163,0,0.2,1,2,3,0
1002 | 64,1,0,145,212,0,0,132,0,2,1,2,1,0
1003 | 42,1,0,140,226,0,1,178,0,0,2,0,2,1
1004 | 66,1,0,112,212,0,0,132,1,0.1,2,1,2,0
1005 | 52,1,0,108,233,1,1,147,0,0.1,2,3,3,1
1006 | 51,0,2,140,308,0,0,142,0,1.5,2,1,2,1
1007 | 55,0,0,128,205,0,2,130,1,2,1,1,3,0
1008 | 58,1,2,140,211,1,0,165,0,0,2,0,2,1
1009 | 56,1,3,120,193,0,0,162,0,1.9,1,0,3,1
1010 | 42,1,1,120,295,0,1,162,0,0,2,0,2,1
1011 | 40,1,0,152,223,0,1,181,0,0,2,0,3,0
1012 | 51,1,0,140,299,0,1,173,1,1.6,2,0,3,0
1013 | 45,1,1,128,308,0,0,170,0,0,2,0,2,1
1014 | 48,1,1,110,229,0,1,168,0,1,0,0,3,0
1015 | 58,1,0,114,318,0,2,140,0,4.4,0,3,1,0
1016 | 44,0,2,108,141,0,1,175,0,0.6,1,0,2,1
1017 | 58,1,0,128,216,0,0,131,1,2.2,1,3,3,0
1018 | 65,1,3,138,282,1,0,174,0,1.4,1,1,2,0
1019 | 53,1,0,123,282,0,1,95,1,2,1,2,3,0
1020 | 41,1,0,110,172,0,0,158,0,0,2,0,3,0
1021 | 47,1,0,112,204,0,1,143,0,0.1,2,0,2,1
1022 | 59,1,1,140,221,0,1,164,1,0,2,0,2,1
1023 | 60,1,0,125,258,0,0,141,1,2.8,1,1,3,0
1024 | 47,1,0,110,275,0,0,118,1,1,1,1,2,0
1025 | 50,0,0,110,254,0,0,159,0,0,2,0,2,1
1026 | 54,1,0,120,188,0,1,113,0,1.4,1,1,3,0
1027 |
--------------------------------------------------------------------------------