-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise: Introduction
793 lines (793 loc) · 24.6 KB
/
Exercise: Introduction
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
{
"cells": [
{
"cell_type": "markdown",
"id": "c064665b",
"metadata": {
"papermill": {
"duration": 0.007191,
"end_time": "2024-06-16T15:21:17.301647",
"exception": false,
"start_time": "2024-06-16T15:21:17.294456",
"status": "completed"
},
"tags": []
},
"source": [
"**This notebook is an exercise in the [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/introduction).**\n",
"\n",
"---\n"
]
},
{
"cell_type": "markdown",
"id": "9e162a23",
"metadata": {
"papermill": {
"duration": 0.006558,
"end_time": "2024-06-16T15:21:17.315368",
"exception": false,
"start_time": "2024-06-16T15:21:17.308810",
"status": "completed"
},
"tags": []
},
"source": [
"As a warm-up, you'll review some machine learning fundamentals and submit your initial results to a Kaggle competition.\n",
"\n",
"# Setup\n",
"\n",
"The questions below will give you feedback on your work. Run the following cell to set up the feedback system."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "0620644c",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:17.330964Z",
"iopub.status.busy": "2024-06-16T15:21:17.330548Z",
"iopub.status.idle": "2024-06-16T15:21:20.491616Z",
"shell.execute_reply": "2024-06-16T15:21:20.490114Z"
},
"papermill": {
"duration": 3.172346,
"end_time": "2024-06-16T15:21:20.494435",
"exception": false,
"start_time": "2024-06-16T15:21:17.322089",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Setup Complete\n"
]
}
],
"source": [
"# Set up code checking\n",
"import os\n",
"if not os.path.exists(\"../input/train.csv\"):\n",
" os.symlink(\"../input/home-data-for-ml-course/train.csv\", \"../input/train.csv\") \n",
" os.symlink(\"../input/home-data-for-ml-course/test.csv\", \"../input/test.csv\") \n",
"from learntools.core import binder\n",
"binder.bind(globals())\n",
"from learntools.ml_intermediate.ex1 import *\n",
"print(\"Setup Complete\")"
]
},
{
"cell_type": "markdown",
"id": "eef73221",
"metadata": {
"papermill": {
"duration": 0.006748,
"end_time": "2024-06-16T15:21:20.508193",
"exception": false,
"start_time": "2024-06-16T15:21:20.501445",
"status": "completed"
},
"tags": []
},
"source": [
"You will work with data from the [Housing Prices Competition for Kaggle Learn Users](https://www.kaggle.com/c/home-data-for-ml-course) to predict home prices in Iowa using 79 explanatory variables describing (almost) every aspect of the homes. \n",
"\n",
"![Ames Housing dataset image](https://storage.googleapis.com/kaggle-media/learn/images/lTJVG4e.png)\n",
"\n",
"Run the next code cell without changes to load the training and validation features in `X_train` and `X_valid`, along with the prediction targets in `y_train` and `y_valid`. The test features are loaded in `X_test`. (_If you need to review **features** and **prediction targets**, please check out [this short tutorial](https://www.kaggle.com/dansbecker/your-first-machine-learning-model). To read about model **validation**, look [here](https://www.kaggle.com/dansbecker/model-validation). Alternatively, if you'd prefer to look through a full course to review all of these topics, start [here](https://www.kaggle.com/learn/machine-learning).)_"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c42abd6b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:20.524221Z",
"iopub.status.busy": "2024-06-16T15:21:20.523668Z",
"iopub.status.idle": "2024-06-16T15:21:20.641284Z",
"shell.execute_reply": "2024-06-16T15:21:20.640077Z"
},
"papermill": {
"duration": 0.128899,
"end_time": "2024-06-16T15:21:20.644163",
"exception": false,
"start_time": "2024-06-16T15:21:20.515264",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"import pandas as pd\n",
"from sklearn.model_selection import train_test_split\n",
"\n",
"# Read the data\n",
"X_full = pd.read_csv('../input/train.csv', index_col='Id')\n",
"X_test_full = pd.read_csv('../input/test.csv', index_col='Id')\n",
"\n",
"# Obtain target and predictors\n",
"y = X_full.SalePrice\n",
"features = ['LotArea', 'YearBuilt', '1stFlrSF', '2ndFlrSF', 'FullBath', 'BedroomAbvGr', 'TotRmsAbvGrd']\n",
"X = X_full[features].copy()\n",
"X_test = X_test_full[features].copy()\n",
"\n",
"# Break off validation set from training data\n",
"X_train, X_valid, y_train, y_valid = train_test_split(X, y, train_size=0.8, test_size=0.2,\n",
" random_state=0)"
]
},
{
"cell_type": "markdown",
"id": "7c489834",
"metadata": {
"papermill": {
"duration": 0.00656,
"end_time": "2024-06-16T15:21:20.657768",
"exception": false,
"start_time": "2024-06-16T15:21:20.651208",
"status": "completed"
},
"tags": []
},
"source": [
"Use the next cell to print the first several rows of the data. It's a nice way to get an overview of the data you will use in your price prediction model."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "aa405d66",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:20.673534Z",
"iopub.status.busy": "2024-06-16T15:21:20.673109Z",
"iopub.status.idle": "2024-06-16T15:21:20.691378Z",
"shell.execute_reply": "2024-06-16T15:21:20.690127Z"
},
"papermill": {
"duration": 0.029484,
"end_time": "2024-06-16T15:21:20.694196",
"exception": false,
"start_time": "2024-06-16T15:21:20.664712",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>LotArea</th>\n",
" <th>YearBuilt</th>\n",
" <th>1stFlrSF</th>\n",
" <th>2ndFlrSF</th>\n",
" <th>FullBath</th>\n",
" <th>BedroomAbvGr</th>\n",
" <th>TotRmsAbvGrd</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Id</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>619</th>\n",
" <td>11694</td>\n",
" <td>2007</td>\n",
" <td>1828</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>871</th>\n",
" <td>6600</td>\n",
" <td>1962</td>\n",
" <td>894</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>93</th>\n",
" <td>13360</td>\n",
" <td>1921</td>\n",
" <td>964</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>818</th>\n",
" <td>13265</td>\n",
" <td>2002</td>\n",
" <td>1689</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>303</th>\n",
" <td>13704</td>\n",
" <td>2001</td>\n",
" <td>1541</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" LotArea YearBuilt 1stFlrSF 2ndFlrSF FullBath BedroomAbvGr \\\n",
"Id \n",
"619 11694 2007 1828 0 2 3 \n",
"871 6600 1962 894 0 1 2 \n",
"93 13360 1921 964 0 1 2 \n",
"818 13265 2002 1689 0 2 3 \n",
"303 13704 2001 1541 0 2 3 \n",
"\n",
" TotRmsAbvGrd \n",
"Id \n",
"619 9 \n",
"871 5 \n",
"93 5 \n",
"818 7 \n",
"303 6 "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X_train.head()"
]
},
{
"cell_type": "markdown",
"id": "8d102fbd",
"metadata": {
"papermill": {
"duration": 0.007288,
"end_time": "2024-06-16T15:21:20.708849",
"exception": false,
"start_time": "2024-06-16T15:21:20.701561",
"status": "completed"
},
"tags": []
},
"source": [
"The next code cell defines five different random forest models. Run this code cell without changes. (_To review **random forests**, look [here](https://www.kaggle.com/dansbecker/random-forests)._)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "4c5e3541",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:20.725978Z",
"iopub.status.busy": "2024-06-16T15:21:20.724882Z",
"iopub.status.idle": "2024-06-16T15:21:20.732936Z",
"shell.execute_reply": "2024-06-16T15:21:20.731562Z"
},
"papermill": {
"duration": 0.019366,
"end_time": "2024-06-16T15:21:20.735535",
"exception": false,
"start_time": "2024-06-16T15:21:20.716169",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"from sklearn.ensemble import RandomForestRegressor\n",
"\n",
"# Define the models\n",
"model_1 = RandomForestRegressor(n_estimators=50, random_state=0)\n",
"model_2 = RandomForestRegressor(n_estimators=100, random_state=0)\n",
"model_3 = RandomForestRegressor(n_estimators=100, criterion='absolute_error', random_state=0)\n",
"model_4 = RandomForestRegressor(n_estimators=200, min_samples_split=20, random_state=0)\n",
"model_5 = RandomForestRegressor(n_estimators=100, max_depth=7, random_state=0)\n",
"\n",
"models = [model_1, model_2, model_3, model_4, model_5]"
]
},
{
"cell_type": "markdown",
"id": "6bce26fd",
"metadata": {
"papermill": {
"duration": 0.007052,
"end_time": "2024-06-16T15:21:20.749910",
"exception": false,
"start_time": "2024-06-16T15:21:20.742858",
"status": "completed"
},
"tags": []
},
"source": [
"To select the best model out of the five, we define a function `score_model()` below. This function returns the mean absolute error (MAE) from the validation set. Recall that the best model will obtain the lowest MAE. (_To review **mean absolute error**, look [here](https://www.kaggle.com/dansbecker/model-validation).)_\n",
"\n",
"Run the code cell without changes."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "94cdfab2",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:20.766744Z",
"iopub.status.busy": "2024-06-16T15:21:20.765903Z",
"iopub.status.idle": "2024-06-16T15:21:26.395919Z",
"shell.execute_reply": "2024-06-16T15:21:26.394215Z"
},
"papermill": {
"duration": 5.641578,
"end_time": "2024-06-16T15:21:26.398778",
"exception": false,
"start_time": "2024-06-16T15:21:20.757200",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model 1 MAE: 24015\n",
"Model 2 MAE: 23740\n",
"Model 3 MAE: 23528\n",
"Model 4 MAE: 23996\n",
"Model 5 MAE: 23706\n"
]
}
],
"source": [
"from sklearn.metrics import mean_absolute_error\n",
"\n",
"# Function for comparing different models\n",
"def score_model(model, X_t=X_train, X_v=X_valid, y_t=y_train, y_v=y_valid):\n",
" model.fit(X_t, y_t)\n",
" preds = model.predict(X_v)\n",
" return mean_absolute_error(y_v, preds)\n",
"\n",
"for i in range(0, len(models)):\n",
" mae = score_model(models[i])\n",
" print(\"Model %d MAE: %d\" % (i+1, mae))"
]
},
{
"cell_type": "markdown",
"id": "28c133af",
"metadata": {
"papermill": {
"duration": 0.007441,
"end_time": "2024-06-16T15:21:26.414536",
"exception": false,
"start_time": "2024-06-16T15:21:26.407095",
"status": "completed"
},
"tags": []
},
"source": [
"# Step 1: Evaluate several models\n",
"\n",
"Use the above results to fill in the line below. Which model is the best model? Your answer should be one of `model_1`, `model_2`, `model_3`, `model_4`, or `model_5`."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "f3c110a8",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:26.432247Z",
"iopub.status.busy": "2024-06-16T15:21:26.431734Z",
"iopub.status.idle": "2024-06-16T15:21:26.442876Z",
"shell.execute_reply": "2024-06-16T15:21:26.441801Z"
},
"papermill": {
"duration": 0.02349,
"end_time": "2024-06-16T15:21:26.445876",
"exception": false,
"start_time": "2024-06-16T15:21:26.422386",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"application/javascript": [
"parent.postMessage({\"jupyterEvent\": \"custom.exercise_interaction\", \"data\": {\"outcomeType\": 1, \"valueTowardsCompletion\": 0.5, \"interactionType\": 1, \"questionType\": 2, \"questionId\": \"1_BestModel\", \"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": [
"# Fill in the best model\n",
"best_model = model_3\n",
"\n",
"# Check your answer\n",
"step_1.check()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "4596b228",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:26.467980Z",
"iopub.status.busy": "2024-06-16T15:21:26.467474Z",
"iopub.status.idle": "2024-06-16T15:21:26.472812Z",
"shell.execute_reply": "2024-06-16T15:21:26.471566Z"
},
"papermill": {
"duration": 0.018403,
"end_time": "2024-06-16T15:21:26.475748",
"exception": false,
"start_time": "2024-06-16T15:21:26.457345",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# Lines below will give you a hint or solution code\n",
"#step_1.hint()\n",
"#step_1.solution()"
]
},
{
"cell_type": "markdown",
"id": "e30e582b",
"metadata": {
"papermill": {
"duration": 0.008047,
"end_time": "2024-06-16T15:21:26.492171",
"exception": false,
"start_time": "2024-06-16T15:21:26.484124",
"status": "completed"
},
"tags": []
},
"source": [
"# Step 2: Generate test predictions\n",
"\n",
"Great. You know how to evaluate what makes an accurate model. Now it's time to go through the modeling process and make predictions. In the line below, create a Random Forest model with the variable name `my_model`."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "f751fd0a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:26.510956Z",
"iopub.status.busy": "2024-06-16T15:21:26.510445Z",
"iopub.status.idle": "2024-06-16T15:21:26.521162Z",
"shell.execute_reply": "2024-06-16T15:21:26.519899Z"
},
"papermill": {
"duration": 0.023315,
"end_time": "2024-06-16T15:21:26.523781",
"exception": false,
"start_time": "2024-06-16T15:21:26.500466",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"application/javascript": [
"parent.postMessage({\"jupyterEvent\": \"custom.exercise_interaction\", \"data\": {\"outcomeType\": 1, \"valueTowardsCompletion\": 0.5, \"interactionType\": 1, \"questionType\": 2, \"questionId\": \"2_Predictions\", \"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": [
"# Define a model\n",
"my_model = best_model # Your code here\n",
"\n",
"# Check your answer\n",
"step_2.check()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "463284a5",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:26.545103Z",
"iopub.status.busy": "2024-06-16T15:21:26.543278Z",
"iopub.status.idle": "2024-06-16T15:21:26.549756Z",
"shell.execute_reply": "2024-06-16T15:21:26.548387Z"
},
"papermill": {
"duration": 0.019645,
"end_time": "2024-06-16T15:21:26.552794",
"exception": false,
"start_time": "2024-06-16T15:21:26.533149",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# Lines below will give you a hint or solution code\n",
"# step_2.hint()\n",
"# step_2.solution()"
]
},
{
"cell_type": "markdown",
"id": "5a586175",
"metadata": {
"papermill": {
"duration": 0.008381,
"end_time": "2024-06-16T15:21:26.569918",
"exception": false,
"start_time": "2024-06-16T15:21:26.561537",
"status": "completed"
},
"tags": []
},
"source": [
"Run the next code cell without changes. The code fits the model to the training and validation data, and then generates test predictions that are saved to a CSV file. These test predictions can be submitted directly to the competition!"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "21e42e0b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-16T15:21:26.589524Z",
"iopub.status.busy": "2024-06-16T15:21:26.588978Z",
"iopub.status.idle": "2024-06-16T15:21:31.020406Z",
"shell.execute_reply": "2024-06-16T15:21:31.019102Z"
},
"papermill": {
"duration": 4.445221,
"end_time": "2024-06-16T15:21:31.023777",
"exception": false,
"start_time": "2024-06-16T15:21:26.578556",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"# Fit the model to the training data\n",
"my_model.fit(X, y)\n",
"\n",
"# Generate test predictions\n",
"preds_test = my_model.predict(X_test)\n",
"\n",
"# Save predictions in format used for competition scoring\n",
"output = pd.DataFrame({'Id': X_test.index,\n",
" 'SalePrice': preds_test})\n",
"output.to_csv('submission.csv', index=False)"
]
},
{
"cell_type": "markdown",
"id": "4fc04198",
"metadata": {
"papermill": {
"duration": 0.008237,
"end_time": "2024-06-16T15:21:31.041348",
"exception": false,
"start_time": "2024-06-16T15:21:31.033111",
"status": "completed"
},
"tags": []
},
"source": [
"# Submit your results\n",
"\n",
"Once you have successfully completed Step 2, you're ready to submit your results to the leaderboard! First, you'll need to join the competition if you haven't already. So open a new window by clicking on [this link](https://www.kaggle.com/c/home-data-for-ml-course). Then click on the **Join Competition** button. _(If you see a \"Submit Predictions\" button instead of a \"Join Competition\" button, you have already joined the competition, and don't need to do so again.)_\n",
"\n",
"Next, follow the instructions below:\n",
"1. Begin by clicking on the **Save Version** button in the top right corner of the window. This will generate a pop-up window. \n",
"2. Ensure that the **Save and Run All** option is selected, and then click on the **Save** button.\n",
"3. This generates a window in the bottom left corner of the notebook. After it has finished running, click on the number to the right of the **Save Version** button. This pulls up a list of versions on the right of the screen. Click on the ellipsis **(...)** to the right of the most recent version, and select **Open in Viewer**. This brings you into view mode of the same page. You will need to scroll down to get back to these instructions.\n",
"4. Click on the **Data** tab near the top of the screen. Then, click on the file you would like to submit, and click on the **Submit** button to submit your results to the leaderboard.\n",
"\n",
"You have now successfully submitted to the competition!\n",
"\n",
"If you want to keep working to improve your performance, select the **Edit** button in the top right of the screen. Then you can change your code and repeat the process. There's a lot of room to improve, and you will climb up the leaderboard as you work.\n"
]
},
{
"cell_type": "markdown",
"id": "4f91291b",
"metadata": {
"papermill": {
"duration": 0.008684,
"end_time": "2024-06-16T15:21:31.058992",
"exception": false,
"start_time": "2024-06-16T15:21:31.050308",
"status": "completed"
},
"tags": []
},
"source": [
"# Keep going\n",
"\n",
"You've made your first model. But how can you quickly make it better?\n",
"\n",
"Learn how to improve your competition results by incorporating columns with **[missing values](https://www.kaggle.com/alexisbcook/missing-values)**."
]
},
{
"cell_type": "markdown",
"id": "67fe7d2d",
"metadata": {
"papermill": {
"duration": 0.008116,
"end_time": "2024-06-16T15:21:31.075869",
"exception": false,
"start_time": "2024-06-16T15:21:31.067753",
"status": "completed"
},
"tags": []
},
"source": [
"---\n",
"\n",
"\n",
"\n",
"\n",
"*Have questions or comments? Visit the [course discussion forum](https://www.kaggle.com/learn/intermediate-machine-learning/discussion) to chat with other learners.*"
]
}
],
"metadata": {
"kaggle": {
"accelerator": "none",
"dataSources": [
{
"databundleVersionId": 111096,
"sourceId": 10211,
"sourceType": "competition"
}
],
"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": 17.709667,
"end_time": "2024-06-16T15:21:31.707411",
"environment_variables": {},
"exception": null,
"input_path": "__notebook__.ipynb",
"output_path": "__notebook__.ipynb",
"parameters": {},
"start_time": "2024-06-16T15:21:13.997744",
"version": "2.5.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}