-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise: Your First Machine Learning Model
806 lines (806 loc) · 23.1 KB
/
Exercise: Your First Machine Learning Model
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
{
"cells": [
{
"cell_type": "markdown",
"id": "2838d96e",
"metadata": {
"papermill": {
"duration": 0.005367,
"end_time": "2024-06-05T14:25:31.846934",
"exception": false,
"start_time": "2024-06-05T14:25:31.841567",
"status": "completed"
},
"tags": []
},
"source": [
"**This notebook is an exercise in the [Introduction to Machine Learning](https://www.kaggle.com/learn/intro-to-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/dansbecker/your-first-machine-learning-model).**\n",
"\n",
"---\n"
]
},
{
"cell_type": "markdown",
"id": "69aa2e04",
"metadata": {
"papermill": {
"duration": 0.005248,
"end_time": "2024-06-05T14:25:31.857560",
"exception": false,
"start_time": "2024-06-05T14:25:31.852312",
"status": "completed"
},
"tags": []
},
"source": [
"## Recap\n",
"So far, you have loaded your data and reviewed it with the following code. Run this cell to set up your coding environment where the previous step left off."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e03a140f",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:31.870512Z",
"iopub.status.busy": "2024-06-05T14:25:31.870028Z",
"iopub.status.idle": "2024-06-05T14:25:34.661965Z",
"shell.execute_reply": "2024-06-05T14:25:34.660404Z"
},
"papermill": {
"duration": 2.801812,
"end_time": "2024-06-05T14:25:34.664961",
"exception": false,
"start_time": "2024-06-05T14:25:31.863149",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Setup Complete\n"
]
}
],
"source": [
"# Code you have previously used to load data\n",
"import pandas as pd\n",
"\n",
"# Path of the file to read\n",
"iowa_file_path = '../input/home-data-for-ml-course/train.csv'\n",
"\n",
"home_data = pd.read_csv(iowa_file_path)\n",
"\n",
"# Set up code checking\n",
"from learntools.core import binder\n",
"binder.bind(globals())\n",
"from learntools.machine_learning.ex3 import *\n",
"\n",
"print(\"Setup Complete\")"
]
},
{
"cell_type": "markdown",
"id": "8e8b5697",
"metadata": {
"papermill": {
"duration": 0.00794,
"end_time": "2024-06-05T14:25:34.679601",
"exception": false,
"start_time": "2024-06-05T14:25:34.671661",
"status": "completed"
},
"tags": []
},
"source": [
"# Exercises\n",
"\n",
"## Step 1: Specify Prediction Target\n",
"Select the target variable, which corresponds to the sales price. Save this to a new variable called `y`. You'll need to print a list of the columns to find the name of the column you need.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a13893f7",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:34.700147Z",
"iopub.status.busy": "2024-06-05T14:25:34.699636Z",
"iopub.status.idle": "2024-06-05T14:25:34.709375Z",
"shell.execute_reply": "2024-06-05T14:25:34.707727Z"
},
"papermill": {
"duration": 0.026891,
"end_time": "2024-06-05T14:25:34.712581",
"exception": false,
"start_time": "2024-06-05T14:25:34.685690",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Index(['Id', 'MSSubClass', 'MSZoning', 'LotFrontage', 'LotArea', 'Street',\n",
" 'Alley', 'LotShape', 'LandContour', 'Utilities', 'LotConfig',\n",
" 'LandSlope', 'Neighborhood', 'Condition1', 'Condition2', 'BldgType',\n",
" 'HouseStyle', 'OverallQual', 'OverallCond', 'YearBuilt', 'YearRemodAdd',\n",
" 'RoofStyle', 'RoofMatl', 'Exterior1st', 'Exterior2nd', 'MasVnrType',\n",
" 'MasVnrArea', 'ExterQual', 'ExterCond', 'Foundation', 'BsmtQual',\n",
" 'BsmtCond', 'BsmtExposure', 'BsmtFinType1', 'BsmtFinSF1',\n",
" 'BsmtFinType2', 'BsmtFinSF2', 'BsmtUnfSF', 'TotalBsmtSF', 'Heating',\n",
" 'HeatingQC', 'CentralAir', 'Electrical', '1stFlrSF', '2ndFlrSF',\n",
" 'LowQualFinSF', 'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath',\n",
" 'HalfBath', 'BedroomAbvGr', 'KitchenAbvGr', 'KitchenQual',\n",
" 'TotRmsAbvGrd', 'Functional', 'Fireplaces', 'FireplaceQu', 'GarageType',\n",
" 'GarageYrBlt', 'GarageFinish', 'GarageCars', 'GarageArea', 'GarageQual',\n",
" 'GarageCond', 'PavedDrive', 'WoodDeckSF', 'OpenPorchSF',\n",
" 'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'PoolQC',\n",
" 'Fence', 'MiscFeature', 'MiscVal', 'MoSold', 'YrSold', 'SaleType',\n",
" 'SaleCondition', 'SalePrice'],\n",
" dtype='object')\n"
]
}
],
"source": [
"# print the list of columns in the dataset to find the name of the prediction target\n",
"print(home_data.columns)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f0ca6ce7",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:34.727765Z",
"iopub.status.busy": "2024-06-05T14:25:34.727329Z",
"iopub.status.idle": "2024-06-05T14:25:34.745905Z",
"shell.execute_reply": "2024-06-05T14:25:34.744764Z"
},
"papermill": {
"duration": 0.027807,
"end_time": "2024-06-05T14:25:34.748291",
"exception": false,
"start_time": "2024-06-05T14:25:34.720484",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"application/javascript": [
"parent.postMessage({\"jupyterEvent\": \"custom.exercise_interaction\", \"data\": {\"outcomeType\": 1, \"valueTowardsCompletion\": 0.25, \"interactionType\": 1, \"questionType\": 2, \"questionId\": \"1_SetTarget\", \"learnToolsVersion\": \"0.3.4\", \"failureMessage\": \"\", \"exceptionClass\": \"\", \"trace\": \"\"}}, \"*\")"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"<span style=\"color:#33cc33\">Correct</span>"
],
"text/plain": [
"Correct"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"y = home_data.SalePrice\n",
"\n",
"# Check your answer\n",
"step_1.check()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8a30574e",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:34.763124Z",
"iopub.status.busy": "2024-06-05T14:25:34.762772Z",
"iopub.status.idle": "2024-06-05T14:25:34.767133Z",
"shell.execute_reply": "2024-06-05T14:25:34.766093Z"
},
"papermill": {
"duration": 0.015351,
"end_time": "2024-06-05T14:25:34.770143",
"exception": false,
"start_time": "2024-06-05T14:25:34.754792",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# The lines below will show you a hint or the solution.\n",
"# step_1.hint() \n",
"# step_1.solution()"
]
},
{
"cell_type": "markdown",
"id": "56c7d6f9",
"metadata": {
"papermill": {
"duration": 0.005353,
"end_time": "2024-06-05T14:25:34.781445",
"exception": false,
"start_time": "2024-06-05T14:25:34.776092",
"status": "completed"
},
"tags": []
},
"source": [
"## Step 2: Create X\n",
"Now you will create a DataFrame called `X` holding the predictive features.\n",
"\n",
"Since you want only some columns from the original data, you'll first create a list with the names of the columns you want in `X`.\n",
"\n",
"You'll use just the following columns in the list (you can copy and paste the whole list to save some typing, though you'll still need to add quotes):\n",
" * LotArea\n",
" * YearBuilt\n",
" * 1stFlrSF\n",
" * 2ndFlrSF\n",
" * FullBath\n",
" * BedroomAbvGr\n",
" * TotRmsAbvGrd\n",
"\n",
"After you've created that list of features, use it to create the DataFrame that you'll use to fit the model."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "28f900cc",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:34.796491Z",
"iopub.status.busy": "2024-06-05T14:25:34.796118Z",
"iopub.status.idle": "2024-06-05T14:25:34.809698Z",
"shell.execute_reply": "2024-06-05T14:25:34.808434Z"
},
"papermill": {
"duration": 0.02582,
"end_time": "2024-06-05T14:25:34.812885",
"exception": false,
"start_time": "2024-06-05T14:25:34.787065",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"application/javascript": [
"parent.postMessage({\"jupyterEvent\": \"custom.exercise_interaction\", \"data\": {\"outcomeType\": 1, \"valueTowardsCompletion\": 0.25, \"interactionType\": 1, \"questionType\": 2, \"questionId\": \"2_SelectPredictionData\", \"learnToolsVersion\": \"0.3.4\", \"failureMessage\": \"\", \"exceptionClass\": \"\", \"trace\": \"\"}}, \"*\")"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"<span style=\"color:#33cc33\">Correct</span>"
],
"text/plain": [
"Correct"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create the list of features below\n",
"feature_names = [ 'LotArea', 'YearBuilt', '1stFlrSF' , '2ndFlrSF', 'FullBath' , 'BedroomAbvGr', 'TotRmsAbvGrd']\n",
"\n",
"# Select data corresponding to features in feature_names\n",
"X = home_data[feature_names]\n",
"\n",
"# Check your answer\n",
"step_2.check()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "0edb908f",
"metadata": {
"collapsed": true,
"execution": {
"iopub.execute_input": "2024-06-05T14:25:34.828061Z",
"iopub.status.busy": "2024-06-05T14:25:34.827672Z",
"iopub.status.idle": "2024-06-05T14:25:34.833880Z",
"shell.execute_reply": "2024-06-05T14:25:34.831854Z"
},
"jupyter": {
"outputs_hidden": true
},
"papermill": {
"duration": 0.018494,
"end_time": "2024-06-05T14:25:34.838683",
"exception": false,
"start_time": "2024-06-05T14:25:34.820189",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# step_2.hint()\n",
"# step_2.solution()"
]
},
{
"cell_type": "markdown",
"id": "f1157957",
"metadata": {
"papermill": {
"duration": 0.005631,
"end_time": "2024-06-05T14:25:34.851282",
"exception": false,
"start_time": "2024-06-05T14:25:34.845651",
"status": "completed"
},
"tags": []
},
"source": [
"## Review Data\n",
"Before building a model, take a quick look at **X** to verify it looks sensible"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "f2c894be",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:34.867916Z",
"iopub.status.busy": "2024-06-05T14:25:34.867219Z",
"iopub.status.idle": "2024-06-05T14:25:34.980255Z",
"shell.execute_reply": "2024-06-05T14:25:34.978939Z"
},
"papermill": {
"duration": 0.12391,
"end_time": "2024-06-05T14:25:34.982917",
"exception": false,
"start_time": "2024-06-05T14:25:34.859007",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" LotArea YearBuilt 1stFlrSF 2ndFlrSF FullBath \\\n",
"count 1460.000000 1460.000000 1460.000000 1460.000000 1460.000000 \n",
"mean 10516.828082 1971.267808 1162.626712 346.992466 1.565068 \n",
"std 9981.264932 30.202904 386.587738 436.528436 0.550916 \n",
"min 1300.000000 1872.000000 334.000000 0.000000 0.000000 \n",
"25% 7553.500000 1954.000000 882.000000 0.000000 1.000000 \n",
"50% 9478.500000 1973.000000 1087.000000 0.000000 2.000000 \n",
"75% 11601.500000 2000.000000 1391.250000 728.000000 2.000000 \n",
"max 215245.000000 2010.000000 4692.000000 2065.000000 3.000000 \n",
"\n",
" BedroomAbvGr TotRmsAbvGrd \n",
"count 1460.000000 1460.000000 \n",
"mean 2.866438 6.517808 \n",
"std 0.815778 1.625393 \n",
"min 0.000000 2.000000 \n",
"25% 2.000000 5.000000 \n",
"50% 3.000000 6.000000 \n",
"75% 3.000000 7.000000 \n",
"max 8.000000 14.000000 \n",
" LotArea YearBuilt 1stFlrSF 2ndFlrSF FullBath BedroomAbvGr \\\n",
"0 8450 2003 856 854 2 3 \n",
"1 9600 1976 1262 0 2 3 \n",
"2 11250 2001 920 866 2 3 \n",
"3 9550 1915 961 756 1 3 \n",
"4 14260 2000 1145 1053 2 4 \n",
"\n",
" TotRmsAbvGrd \n",
"0 8 \n",
"1 6 \n",
"2 6 \n",
"3 7 \n",
"4 9 \n"
]
}
],
"source": [
"# Review data\n",
"# print description or statistics from X\n",
"print(X.describe())\n",
"\n",
"# print the top few lines\n",
"print(X.head())"
]
},
{
"cell_type": "markdown",
"id": "b3257d9a",
"metadata": {
"papermill": {
"duration": 0.0071,
"end_time": "2024-06-05T14:25:34.995903",
"exception": false,
"start_time": "2024-06-05T14:25:34.988803",
"status": "completed"
},
"tags": []
},
"source": [
"## Step 3: Specify and Fit Model\n",
"Create a `DecisionTreeRegressor` and save it iowa_model. Ensure you've done the relevant import from sklearn to run this command.\n",
"\n",
"Then fit the model you just created using the data in `X` and `y` that you saved above."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "779eee23",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:35.013908Z",
"iopub.status.busy": "2024-06-05T14:25:35.012172Z",
"iopub.status.idle": "2024-06-05T14:25:35.035030Z",
"shell.execute_reply": "2024-06-05T14:25:35.033902Z"
},
"papermill": {
"duration": 0.034419,
"end_time": "2024-06-05T14:25:35.037405",
"exception": false,
"start_time": "2024-06-05T14:25:35.002986",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"application/javascript": [
"parent.postMessage({\"jupyterEvent\": \"custom.exercise_interaction\", \"data\": {\"outcomeType\": 1, \"valueTowardsCompletion\": 0.25, \"interactionType\": 1, \"questionType\": 2, \"questionId\": \"3_CreateModel\", \"learnToolsVersion\": \"0.3.4\", \"failureMessage\": \"\", \"exceptionClass\": \"\", \"trace\": \"\"}}, \"*\")"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"<span style=\"color:#33cc33\">Correct</span>"
],
"text/plain": [
"Correct"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.tree import DecisionTreeRegressor\n",
"\n",
"#specify the model. \n",
"#For model reproducibility, set a numeric value for random_state when specifying the model\n",
"iowa_model = DecisionTreeRegressor(random_state=1)\n",
"\n",
"# Fit the model\n",
"iowa_model.fit(X, y)\n",
"\n",
"# Check your answer\n",
"step_3.check()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "03aad55a",
"metadata": {
"collapsed": true,
"execution": {
"iopub.execute_input": "2024-06-05T14:25:35.052542Z",
"iopub.status.busy": "2024-06-05T14:25:35.052138Z",
"iopub.status.idle": "2024-06-05T14:25:35.058052Z",
"shell.execute_reply": "2024-06-05T14:25:35.056156Z"
},
"jupyter": {
"outputs_hidden": true
},
"papermill": {
"duration": 0.016935,
"end_time": "2024-06-05T14:25:35.060655",
"exception": false,
"start_time": "2024-06-05T14:25:35.043720",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# step_3.hint()\n",
"# step_3.solution()"
]
},
{
"cell_type": "markdown",
"id": "6f343828",
"metadata": {
"papermill": {
"duration": 0.005968,
"end_time": "2024-06-05T14:25:35.072873",
"exception": false,
"start_time": "2024-06-05T14:25:35.066905",
"status": "completed"
},
"tags": []
},
"source": [
"## Step 4: Make Predictions\n",
"Make predictions with the model's `predict` command using `X` as the data. Save the results to a variable called `predictions`."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "35f6eff5",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:35.088339Z",
"iopub.status.busy": "2024-06-05T14:25:35.087970Z",
"iopub.status.idle": "2024-06-05T14:25:35.104611Z",
"shell.execute_reply": "2024-06-05T14:25:35.102910Z"
},
"papermill": {
"duration": 0.027838,
"end_time": "2024-06-05T14:25:35.107216",
"exception": false,
"start_time": "2024-06-05T14:25:35.079378",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[208500. 181500. 223500. ... 266500. 142125. 147500.]\n"
]
},
{
"data": {
"application/javascript": [
"parent.postMessage({\"jupyterEvent\": \"custom.exercise_interaction\", \"data\": {\"outcomeType\": 1, \"valueTowardsCompletion\": 0.25, \"interactionType\": 1, \"questionType\": 2, \"questionId\": \"4_MakePredictions\", \"learnToolsVersion\": \"0.3.4\", \"failureMessage\": \"\", \"exceptionClass\": \"\", \"trace\": \"\"}}, \"*\")"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/markdown": [
"<span style=\"color:#33cc33\">Correct</span>"
],
"text/plain": [
"Correct"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"predictions = iowa_model.predict(X)\n",
"print(predictions)\n",
"\n",
"# Check your answer\n",
"step_4.check()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "539c83ee",
"metadata": {
"collapsed": true,
"execution": {
"iopub.execute_input": "2024-06-05T14:25:35.127125Z",
"iopub.status.busy": "2024-06-05T14:25:35.126744Z",
"iopub.status.idle": "2024-06-05T14:25:35.132814Z",
"shell.execute_reply": "2024-06-05T14:25:35.131480Z"
},
"jupyter": {
"outputs_hidden": true
},
"papermill": {
"duration": 0.020585,
"end_time": "2024-06-05T14:25:35.135628",
"exception": false,
"start_time": "2024-06-05T14:25:35.115043",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# step_4.hint()\n",
"# step_4.solution()"
]
},
{
"cell_type": "markdown",
"id": "0817a331",
"metadata": {
"papermill": {
"duration": 0.006308,
"end_time": "2024-06-05T14:25:35.149228",
"exception": false,
"start_time": "2024-06-05T14:25:35.142920",
"status": "completed"
},
"tags": []
},
"source": [
"## Think About Your Results\n",
"\n",
"Use the `head` method to compare the top few predictions to the actual home values (in `y`) for those same homes. Anything surprising?\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8904e80a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-05T14:25:35.165451Z",
"iopub.status.busy": "2024-06-05T14:25:35.165051Z",
"iopub.status.idle": "2024-06-05T14:25:35.169858Z",
"shell.execute_reply": "2024-06-05T14:25:35.168611Z"
},
"papermill": {
"duration": 0.015641,
"end_time": "2024-06-05T14:25:35.172573",
"exception": false,
"start_time": "2024-06-05T14:25:35.156932",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# You can write code in this cell\n"
]
},
{
"cell_type": "markdown",
"id": "34a54d94",
"metadata": {
"papermill": {
"duration": 0.006601,
"end_time": "2024-06-05T14:25:35.188743",
"exception": false,
"start_time": "2024-06-05T14:25:35.182142",
"status": "completed"
},
"tags": []
},
"source": [
"It's natural to ask how accurate the model's predictions will be and how you can improve that. That will be you're next step.\n",
"\n",
"# Keep Going\n",
"\n",
"You are ready for **[Model Validation](https://www.kaggle.com/dansbecker/model-validation).**\n"
]
},
{
"cell_type": "markdown",
"id": "1505ba25",
"metadata": {
"papermill": {
"duration": 0.006451,
"end_time": "2024-06-05T14:25:35.205636",
"exception": false,
"start_time": "2024-06-05T14:25:35.199185",
"status": "completed"
},
"tags": []
},
"source": [
"---\n",
"\n",
"\n",
"\n",
"\n",
"*Have questions or comments? Visit the [course discussion forum](https://www.kaggle.com/learn/intro-to-machine-learning/discussion) to chat with other learners.*"
]
}
],
"metadata": {
"kaggle": {
"accelerator": "none",
"dataSources": [
{
"databundleVersionId": 111096,
"sourceId": 10211,
"sourceType": "competition"
},
{
"datasetId": 11167,
"sourceId": 15520,
"sourceType": "datasetVersion"
},
{
"datasetId": 2709,
"sourceId": 38454,
"sourceType": "datasetVersion"
}
],
"isGpuEnabled": false,
"isInternetEnabled": false,
"language": "python",
"sourceType": "notebook"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
},
"papermill": {
"default_parameters": {},
"duration": 7.075985,
"end_time": "2024-06-05T14:25:35.834533",
"environment_variables": {},
"exception": null,
"input_path": "__notebook__.ipynb",
"output_path": "__notebook__.ipynb",
"parameters": {},
"start_time": "2024-06-05T14:25:28.758548",
"version": "2.5.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}