├── README.md
├── LICENSE
└── 3rd_place_solution_for_the__UmojaHack_3_Hotspots__zindi_hackathon.ipynb
/README.md:
--------------------------------------------------------------------------------
1 | # [3rd place](https://zindi.africa/hackathons/umojahack-3-hotspots/leaderboard) solution for the [UmojaHack-3-Hotspots](https://zindi.africa/hackathons/umojahack-3-hotspots) zindi hackathon
2 |
3 | ## Context
4 | Each year, thousands of fires blaze across the African continent. Some are natural occurrences, part of a ‘fire cycle’ that can actually benefit some dryland ecosystems. Many are started intentionally, used to clear land or to prepare fields for planting. And some are wildfires, which can rage over large areas and cause huge amounts of damage. Whatever the cause, fires pour vast amounts of CO2 into the atmosphere, along with smoke that degrades air quality for those living downwind.
5 |
6 | Figuring out the dynamics that influence where and when these fires will occur can help us to better understand their effects. And predicting how these dynamics will play out in the future, under different climatic conditions, could prove extremely useful. For this challenge, the goal is to do exactly that. We’ve aggregated data on burned areas across the whole of the DRC for each month since 1 April 2000. You’ll be given the burn area data up to the end of 2013, along with some additional information (such as rainfall, temperature, population density etc) that extends into the test period. The challenge is to build a model capable of predicting the burned area in different locations over the 2014 to 2016 test period based on only this information.
7 |
8 | ## Evaluation
9 | The error metric for this competition was the Root Mean Squared Error.
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/3rd_place_solution_for_the__UmojaHack_3_Hotspots__zindi_hackathon.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "nbformat": 4,
3 | "nbformat_minor": 0,
4 | "metadata": {
5 | "colab": {
6 | "name": "3rd_place_solution_for_the__UmojaHack #3: Hotspots__zindi_hackathon.ipynb",
7 | "provenance": [],
8 | "collapsed_sections": [],
9 | "machine_shape": "hm",
10 | "include_colab_link": true
11 | },
12 | "kernelspec": {
13 | "name": "python3",
14 | "display_name": "Python 3"
15 | }
16 | },
17 | "cells": [
18 | {
19 | "cell_type": "markdown",
20 | "metadata": {
21 | "id": "view-in-github",
22 | "colab_type": "text"
23 | },
24 | "source": [
25 | "
"
26 | ]
27 | },
28 | {
29 | "cell_type": "markdown",
30 | "metadata": {
31 | "id": "RCnY4dqlMI-L",
32 | "colab_type": "text"
33 | },
34 | "source": [
35 | "### Installing necessary library"
36 | ]
37 | },
38 | {
39 | "cell_type": "code",
40 | "metadata": {
41 | "id": "pk5WiopT9oJw",
42 | "colab_type": "code",
43 | "outputId": "9abc8a0e-c231-4b42-f51d-4a42e24842ee",
44 | "colab": {
45 | "base_uri": "https://localhost:8080/",
46 | "height": 263
47 | }
48 | },
49 | "source": [
50 | "# Installing catboost\n",
51 | "!pip install catboost"
52 | ],
53 | "execution_count": 12,
54 | "outputs": [
55 | {
56 | "output_type": "stream",
57 | "text": [
58 | "Requirement already satisfied: catboost in /usr/local/lib/python3.6/dist-packages (0.22)\n",
59 | "Requirement already satisfied: pandas>=0.24.0 in /usr/local/lib/python3.6/dist-packages (from catboost) (1.0.3)\n",
60 | "Requirement already satisfied: plotly in /usr/local/lib/python3.6/dist-packages (from catboost) (4.4.1)\n",
61 | "Requirement already satisfied: graphviz in /usr/local/lib/python3.6/dist-packages (from catboost) (0.10.1)\n",
62 | "Requirement already satisfied: numpy>=1.16.0 in /usr/local/lib/python3.6/dist-packages (from catboost) (1.18.2)\n",
63 | "Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from catboost) (1.12.0)\n",
64 | "Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from catboost) (3.2.1)\n",
65 | "Requirement already satisfied: scipy in /usr/local/lib/python3.6/dist-packages (from catboost) (1.4.1)\n",
66 | "Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.24.0->catboost) (2018.9)\n",
67 | "Requirement already satisfied: python-dateutil>=2.6.1 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.24.0->catboost) (2.8.1)\n",
68 | "Requirement already satisfied: retrying>=1.3.3 in /usr/local/lib/python3.6/dist-packages (from plotly->catboost) (1.3.3)\n",
69 | "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->catboost) (1.2.0)\n",
70 | "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->catboost) (0.10.0)\n",
71 | "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->catboost) (2.4.6)\n"
72 | ],
73 | "name": "stdout"
74 | }
75 | ]
76 | },
77 | {
78 | "cell_type": "markdown",
79 | "metadata": {
80 | "id": "4ywx99etMQv1",
81 | "colab_type": "text"
82 | },
83 | "source": [
84 | "### Loading libraries"
85 | ]
86 | },
87 | {
88 | "cell_type": "code",
89 | "metadata": {
90 | "id": "jVXG4QlTuVYr",
91 | "colab_type": "code",
92 | "colab": {}
93 | },
94 | "source": [
95 | "# Importing necessary libraries\n",
96 | "import pandas as pd\n",
97 | "import numpy as np\n",
98 | "import datetime as dt\n",
99 | "from catboost import CatBoostRegressor, CatBoostClassifier\n",
100 | "import re\n",
101 | "from fastai.tabular import *\n",
102 | "import warnings\n",
103 | "warnings.filterwarnings('ignore')"
104 | ],
105 | "execution_count": 0,
106 | "outputs": []
107 | },
108 | {
109 | "cell_type": "markdown",
110 | "metadata": {
111 | "id": "H-FKVO4VigUE",
112 | "colab_type": "text"
113 | },
114 | "source": [
115 | "### Mounting colab drive"
116 | ]
117 | },
118 | {
119 | "cell_type": "code",
120 | "metadata": {
121 | "id": "agGrUcYwQ7on",
122 | "colab_type": "code",
123 | "outputId": "f86304c9-8482-4093-be2e-8af5763f2441",
124 | "colab": {
125 | "base_uri": "https://localhost:8080/",
126 | "height": 34
127 | }
128 | },
129 | "source": [
130 | "from google.colab import drive\n",
131 | "drive.mount('/content/drive')"
132 | ],
133 | "execution_count": 14,
134 | "outputs": [
135 | {
136 | "output_type": "stream",
137 | "text": [
138 | "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
139 | ],
140 | "name": "stdout"
141 | }
142 | ]
143 | },
144 | {
145 | "cell_type": "markdown",
146 | "metadata": {
147 | "id": "BSgbfDNDiMpy",
148 | "colab_type": "text"
149 | },
150 | "source": [
151 | "### Loading data"
152 | ]
153 | },
154 | {
155 | "cell_type": "code",
156 | "metadata": {
157 | "id": "jXhE5wI_iQEk",
158 | "colab_type": "code",
159 | "colab": {}
160 | },
161 | "source": [
162 | "# Loading files\n",
163 | "train = pd.read_csv('/content/drive/My Drive/Hacck/train.csv', parse_dates=['date'])\n",
164 | "test = pd.read_csv('/content/drive/My Drive/Hacck/test.csv', parse_dates=['date'])\n",
165 | "ss = pd.read_csv('/content/drive/My Drive/Hacck/SampleSubmission.csv')"
166 | ],
167 | "execution_count": 0,
168 | "outputs": []
169 | },
170 | {
171 | "cell_type": "markdown",
172 | "metadata": {
173 | "id": "F56vGuvKMYrl",
174 | "colab_type": "text"
175 | },
176 | "source": [
177 | "### Feature engineering functions"
178 | ]
179 | },
180 | {
181 | "cell_type": "code",
182 | "metadata": {
183 | "id": "P06uypRiUW4V",
184 | "colab_type": "code",
185 | "colab": {}
186 | },
187 | "source": [
188 | "# Function to calculate bearing distance given latitude and longitude coordinates\n",
189 | "def bearing_array(lat, lng):\n",
190 | " AVG_EARTH_RADIUS = 6371 # in km\n",
191 | " lng_delta_rad = np.radians(lat - lng)\n",
192 | " lat, lng = map(np.radians, (lat, lng))\n",
193 | " y = np.sin(lng_delta_rad) * np.cos(lat)\n",
194 | " x = np.cos(lat) * np.sin(lat) - np.sin(lng) * np.cos(lng) * np.cos(lng_delta_rad)\n",
195 | " return np.degrees(np.arctan2(y, x))\n",
196 | "\n",
197 | "# Function to calculate manhattan distance given latitude and longitude coordinates\n",
198 | "def manhattan_distance(lat, lon):\n",
199 | " a = np.abs(lat -lon)\n",
200 | " return a\n",
201 | "\n",
202 | "# Function to add date features\n",
203 | "def add_datepart(df, fldname, drop=True):\n",
204 | " fld = df[fldname]\n",
205 | " if not np.issubdtype(fld.dtype, np.datetime64):\n",
206 | " df[fldname] = fld = pd.to_datetime(fld, infer_datetime_format=True)\n",
207 | " targ_pre = re.sub('[Dd]ate$', '', fldname)\n",
208 | " for n in ('Year', 'Month', 'Week', 'Day', 'Dayofweek', 'Dayofyear',\n",
209 | " 'Is_month_end', 'Is_month_start', 'Is_quarter_end', 'Is_quarter_start', 'Is_year_end', 'Is_year_start'):\n",
210 | " df[targ_pre+n] = getattr(fld.dt,n.lower())\n",
211 | " df[targ_pre+'Elapsed'] = fld.astype(np.int64) // 10**9\n",
212 | " if drop: df.drop(fldname, axis=1, inplace=True)"
213 | ],
214 | "execution_count": 0,
215 | "outputs": []
216 | },
217 | {
218 | "cell_type": "markdown",
219 | "metadata": {
220 | "id": "-rMoXx17Mr2p",
221 | "colab_type": "text"
222 | },
223 | "source": [
224 | "### Combining training and test data for efficiency"
225 | ]
226 | },
227 | {
228 | "cell_type": "code",
229 | "metadata": {
230 | "id": "K1RgYbXivB-d",
231 | "colab_type": "code",
232 | "colab": {}
233 | },
234 | "source": [
235 | "# Extracting the target variable\n",
236 | "target = train.burn_area\n",
237 | "\n",
238 | "# Creating a separator column\n",
239 | "train['separator'] = 0\n",
240 | "test['separator'] = 1\n",
241 | "\n",
242 | "# Aligning the train and test sets\n",
243 | "train, test = train.align(test, join = 'inner', axis = 1)\n",
244 | "\n",
245 | "# Combining the train and test set for efficiency in generating features\n",
246 | "comb = pd.concat([train, test])"
247 | ],
248 | "execution_count": 0,
249 | "outputs": []
250 | },
251 | {
252 | "cell_type": "markdown",
253 | "metadata": {
254 | "id": "Buck_ZU0Mv-o",
255 | "colab_type": "text"
256 | },
257 | "source": [
258 | "### Feature Engineering"
259 | ]
260 | },
261 | {
262 | "cell_type": "code",
263 | "metadata": {
264 | "id": "5INlZ-WzT9OF",
265 | "colab_type": "code",
266 | "colab": {}
267 | },
268 | "source": [
269 | "# Adding date features\n",
270 | "add_datepart(comb, 'date', False)\n",
271 | "\n",
272 | "# Adding cyclic date features\n",
273 | "add_cyclic_datepart(comb, 'date')\n",
274 | "\n",
275 | "# Adding the manhattan distance column\n",
276 | "comb['manhat_dist'] = manhattan_distance(comb.lon.values, comb.lat.values)\n",
277 | "\n",
278 | "# Adding the bearing distance column\n",
279 | "comb['bearing_dist'] = bearing_array(comb.lat.values, comb.lon.values)\n",
280 | "\n",
281 | "# Combining year and week to form a new feature\n",
282 | "comb['woy'] = comb.Year*100+comb.Week"
283 | ],
284 | "execution_count": 0,
285 | "outputs": []
286 | },
287 | {
288 | "cell_type": "markdown",
289 | "metadata": {
290 | "id": "XoibCQADMz3y",
291 | "colab_type": "text"
292 | },
293 | "source": [
294 | "### Separating training and test data from the combined dataframe"
295 | ]
296 | },
297 | {
298 | "cell_type": "code",
299 | "metadata": {
300 | "id": "OHmWgeo4T9JX",
301 | "colab_type": "code",
302 | "colab": {}
303 | },
304 | "source": [
305 | "# Separating the train and test set from the combined dataframe\n",
306 | "train = comb[comb.separator == 0]\n",
307 | "test = comb[comb.separator == 1]\n",
308 | "\n",
309 | "# Dropping the separator column as it has served its purpose\n",
310 | "train.drop('separator', axis = 1, inplace = True)\n",
311 | "test.drop('separator', axis = 1, inplace = True)"
312 | ],
313 | "execution_count": 0,
314 | "outputs": []
315 | },
316 | {
317 | "cell_type": "markdown",
318 | "metadata": {
319 | "id": "kCKjpvyBM66B",
320 | "colab_type": "text"
321 | },
322 | "source": [
323 | "### Engineering a 'burnt' feature"
324 | ]
325 | },
326 | {
327 | "cell_type": "code",
328 | "metadata": {
329 | "id": "uBToLboBT9Gc",
330 | "colab_type": "code",
331 | "colab": {}
332 | },
333 | "source": [
334 | "# Creating alist to store values of whether a location was burnt or not\n",
335 | "burnt = []\n",
336 | "for i in train.burn_area:\n",
337 | " if i <= 0:\n",
338 | " burnt.append(0)\n",
339 | " else:\n",
340 | " burnt.append(1)\n",
341 | "\n",
342 | "# Separating predictor variables and dependant variable from other variables\n",
343 | "X = train.drop(['ID', 'area', 'burn_area'], axis = 1)\n",
344 | "y = burnt\n",
345 | "\n",
346 | "# Selecting relevant variables in the test dataset\n",
347 | "tes = test.drop(['ID', 'area', 'burn_area'], axis = 1)\n",
348 | "\n",
349 | "# Training a model to classify whether a region was burnt or not\n",
350 | "catt = CatBoostClassifier(verbose = False)\n",
351 | "catt.fit(X, y)\n",
352 | "\n",
353 | "# Making predictions\n",
354 | "predds = catt.predict(tes)\n",
355 | "\n",
356 | "# Creating burnt columns from the predictions\n",
357 | "train['burnt'] = burnt\n",
358 | "test['burnt'] = predds"
359 | ],
360 | "execution_count": 0,
361 | "outputs": []
362 | },
363 | {
364 | "cell_type": "markdown",
365 | "metadata": {
366 | "id": "5gzcSiZVkGyc",
367 | "colab_type": "text"
368 | },
369 | "source": [
370 | "### Previewing a sample of the engineered dataframe"
371 | ]
372 | },
373 | {
374 | "cell_type": "code",
375 | "metadata": {
376 | "id": "X0fL84jskPEF",
377 | "colab_type": "code",
378 | "outputId": "30faccf0-b254-45db-c490-e7ec5dc050e5",
379 | "colab": {
380 | "base_uri": "https://localhost:8080/",
381 | "height": 531
382 | }
383 | },
384 | "source": [
385 | "# Sampling 10 observations of the training set\n",
386 | "train.sample(10)"
387 | ],
388 | "execution_count": 44,
389 | "outputs": [
390 | {
391 | "output_type": "execute_result",
392 | "data": {
393 | "text/html": [
394 | "
\n",
395 | "\n",
408 | "
\n",
409 | " \n",
410 | " \n",
411 | " | \n",
412 | " ID | \n",
413 | " area | \n",
414 | " lat | \n",
415 | " lon | \n",
416 | " burn_area | \n",
417 | " climate_aet | \n",
418 | " climate_def | \n",
419 | " climate_pdsi | \n",
420 | " climate_pet | \n",
421 | " climate_pr | \n",
422 | " climate_ro | \n",
423 | " climate_soil | \n",
424 | " climate_srad | \n",
425 | " climate_swe | \n",
426 | " climate_tmmn | \n",
427 | " climate_tmmx | \n",
428 | " climate_vap | \n",
429 | " climate_vpd | \n",
430 | " climate_vs | \n",
431 | " elevation | \n",
432 | " landcover_0 | \n",
433 | " landcover_1 | \n",
434 | " landcover_2 | \n",
435 | " landcover_3 | \n",
436 | " landcover_4 | \n",
437 | " landcover_5 | \n",
438 | " landcover_6 | \n",
439 | " landcover_7 | \n",
440 | " landcover_8 | \n",
441 | " population_density | \n",
442 | " precipitation | \n",
443 | " Year | \n",
444 | " Month | \n",
445 | " Week | \n",
446 | " Day | \n",
447 | " Dayofweek | \n",
448 | " Dayofyear | \n",
449 | " Is_month_end | \n",
450 | " Is_month_start | \n",
451 | " Is_quarter_end | \n",
452 | " Is_quarter_start | \n",
453 | " Is_year_end | \n",
454 | " Is_year_start | \n",
455 | " Elapsed | \n",
456 | " weekday_cos | \n",
457 | " weekday_sin | \n",
458 | " day_month_cos | \n",
459 | " day_month_sin | \n",
460 | " month_year_cos | \n",
461 | " month_year_sin | \n",
462 | " day_year_cos | \n",
463 | " day_year_sin | \n",
464 | " manhat_dist | \n",
465 | " bearing_dist | \n",
466 | " woy | \n",
467 | " burnt | \n",
468 | "
\n",
469 | " \n",
470 | " \n",
471 | " \n",
472 | " | 28759 | \n",
473 | " 2012_2000-11-01 | \n",
474 | " 2012 | \n",
475 | " 17.825 | \n",
476 | " -3.431 | \n",
477 | " 0.000000 | \n",
478 | " 1000.532194 | \n",
479 | " 0.000000 | \n",
480 | " 373.231075 | \n",
481 | " 1000.532194 | \n",
482 | " 286.776267 | \n",
483 | " 186.654471 | \n",
484 | " 1506.791912 | \n",
485 | " 1720.548682 | \n",
486 | " 0.0 | \n",
487 | " 214.944879 | \n",
488 | " 306.964015 | \n",
489 | " 2601.136358 | \n",
490 | " 90.455771 | \n",
491 | " 101.566374 | \n",
492 | " 337.801381 | \n",
493 | " 0.001537 | \n",
494 | " 0.0 | \n",
495 | " 0.974958 | \n",
496 | " 0.0 | \n",
497 | " 0.002152 | \n",
498 | " 0.0 | \n",
499 | " 0.021354 | \n",
500 | " 0.0 | \n",
501 | " 0.000000 | \n",
502 | " 7.584947 | \n",
503 | " 0.323575 | \n",
504 | " 2000 | \n",
505 | " 11 | \n",
506 | " 44 | \n",
507 | " 1 | \n",
508 | " 2 | \n",
509 | " 306 | \n",
510 | " False | \n",
511 | " True | \n",
512 | " False | \n",
513 | " False | \n",
514 | " False | \n",
515 | " False | \n",
516 | " 973036800 | \n",
517 | " -0.222521 | \n",
518 | " 0.974928 | \n",
519 | " 1.0 | \n",
520 | " 0.0 | \n",
521 | " 5.000000e-01 | \n",
522 | " -0.866025 | \n",
523 | " 0.500000 | \n",
524 | " -0.866025 | \n",
525 | " 21.256 | \n",
526 | " 44.837866 | \n",
527 | " 200044 | \n",
528 | " 0 | \n",
529 | "
\n",
530 | " \n",
531 | " | 87245 | \n",
532 | " 3183_2002-03-01 | \n",
533 | " 3183 | \n",
534 | " 27.708 | \n",
535 | " -7.323 | \n",
536 | " 0.000000 | \n",
537 | " 938.647573 | \n",
538 | " 0.000000 | \n",
539 | " -204.079089 | \n",
540 | " 938.647573 | \n",
541 | " 197.617256 | \n",
542 | " 76.971001 | \n",
543 | " 2020.200719 | \n",
544 | " 1393.772558 | \n",
545 | " 0.0 | \n",
546 | " 193.696705 | \n",
547 | " 309.123907 | \n",
548 | " 2445.954823 | \n",
549 | " 92.927382 | \n",
550 | " 146.557220 | \n",
551 | " 659.603319 | \n",
552 | " 0.000000 | \n",
553 | " 0.0 | \n",
554 | " 0.036270 | \n",
555 | " 0.0 | \n",
556 | " 0.963730 | \n",
557 | " 0.0 | \n",
558 | " 0.000000 | \n",
559 | " 0.0 | \n",
560 | " 0.000000 | \n",
561 | " 12.758791 | \n",
562 | " 0.276120 | \n",
563 | " 2002 | \n",
564 | " 3 | \n",
565 | " 9 | \n",
566 | " 1 | \n",
567 | " 4 | \n",
568 | " 60 | \n",
569 | " False | \n",
570 | " True | \n",
571 | " False | \n",
572 | " False | \n",
573 | " False | \n",
574 | " False | \n",
575 | " 1014940800 | \n",
576 | " -0.900969 | \n",
577 | " -0.433884 | \n",
578 | " 1.0 | \n",
579 | " 0.0 | \n",
580 | " 5.000000e-01 | \n",
581 | " 0.866025 | \n",
582 | " 0.527078 | \n",
583 | " 0.849817 | \n",
584 | " 35.031 | \n",
585 | " 44.609663 | \n",
586 | " 200209 | \n",
587 | " 0 | \n",
588 | "
\n",
589 | " \n",
590 | " | 68117 | \n",
591 | " 3160_2001-10-01 | \n",
592 | " 3160 | \n",
593 | " 22.581 | \n",
594 | " -7.441 | \n",
595 | " 0.000000 | \n",
596 | " 365.512091 | \n",
597 | " 910.111376 | \n",
598 | " -938.289458 | \n",
599 | " 1275.602859 | \n",
600 | " 35.891959 | \n",
601 | " 2.000000 | \n",
602 | " 169.235021 | \n",
603 | " 2122.197141 | \n",
604 | " 0.0 | \n",
605 | " 181.276831 | \n",
606 | " 301.168434 | \n",
607 | " 2255.476712 | \n",
608 | " 93.552591 | \n",
609 | " 198.565217 | \n",
610 | " 853.864501 | \n",
611 | " 0.000000 | \n",
612 | " 0.0 | \n",
613 | " 0.717625 | \n",
614 | " 0.0 | \n",
615 | " 0.281146 | \n",
616 | " 0.0 | \n",
617 | " 0.000000 | \n",
618 | " 0.0 | \n",
619 | " 0.001230 | \n",
620 | " 33.801115 | \n",
621 | " 0.284258 | \n",
622 | " 2001 | \n",
623 | " 10 | \n",
624 | " 40 | \n",
625 | " 1 | \n",
626 | " 0 | \n",
627 | " 274 | \n",
628 | " False | \n",
629 | " True | \n",
630 | " False | \n",
631 | " True | \n",
632 | " False | \n",
633 | " False | \n",
634 | " 1001894400 | \n",
635 | " 1.000000 | \n",
636 | " 0.000000 | \n",
637 | " 1.0 | \n",
638 | " 0.0 | \n",
639 | " -1.836970e-16 | \n",
640 | " -1.000000 | \n",
641 | " -0.012910 | \n",
642 | " -0.999917 | \n",
643 | " 30.022 | \n",
644 | " 44.767693 | \n",
645 | " 200140 | \n",
646 | " 0 | \n",
647 | "
\n",
648 | " \n",
649 | " | 342446 | \n",
650 | " 2377_2007-10-01 | \n",
651 | " 2377 | \n",
652 | " 13.322 | \n",
653 | " -4.790 | \n",
654 | " 0.000000 | \n",
655 | " 710.580766 | \n",
656 | " 0.000000 | \n",
657 | " 429.945474 | \n",
658 | " 710.580766 | \n",
659 | " 163.744343 | \n",
660 | " 8.000000 | \n",
661 | " 2382.501204 | \n",
662 | " 927.464492 | \n",
663 | " 0.0 | \n",
664 | " 205.633004 | \n",
665 | " 286.233028 | \n",
666 | " 2319.494945 | \n",
667 | " 86.458835 | \n",
668 | " 129.679104 | \n",
669 | " 491.277387 | \n",
670 | " 0.000000 | \n",
671 | " 0.0 | \n",
672 | " 0.995168 | \n",
673 | " 0.0 | \n",
674 | " 0.002459 | \n",
675 | " 0.0 | \n",
676 | " 0.002372 | \n",
677 | " 0.0 | \n",
678 | " 0.000000 | \n",
679 | " 49.783539 | \n",
680 | " 0.366944 | \n",
681 | " 2007 | \n",
682 | " 10 | \n",
683 | " 40 | \n",
684 | " 1 | \n",
685 | " 0 | \n",
686 | " 274 | \n",
687 | " False | \n",
688 | " True | \n",
689 | " False | \n",
690 | " True | \n",
691 | " False | \n",
692 | " False | \n",
693 | " 1191196800 | \n",
694 | " 1.000000 | \n",
695 | " 0.000000 | \n",
696 | " 1.0 | \n",
697 | " 0.0 | \n",
698 | " -1.836970e-16 | \n",
699 | " -1.000000 | \n",
700 | " -0.012910 | \n",
701 | " -0.999917 | \n",
702 | " 18.112 | \n",
703 | " 44.924152 | \n",
704 | " 200740 | \n",
705 | " 0 | \n",
706 | "
\n",
707 | " \n",
708 | " | 105174 | \n",
709 | " 2007_2002-08-01 | \n",
710 | " 2007 | \n",
711 | " 16.701 | \n",
712 | " -3.434 | \n",
713 | " 0.025380 | \n",
714 | " 556.525153 | \n",
715 | " 484.062432 | \n",
716 | " -190.973586 | \n",
717 | " 1040.538720 | \n",
718 | " 20.943571 | \n",
719 | " 1.000000 | \n",
720 | " 879.999880 | \n",
721 | " 1723.680634 | \n",
722 | " 0.0 | \n",
723 | " 195.149238 | \n",
724 | " 306.957498 | \n",
725 | " 2285.321767 | \n",
726 | " 107.443751 | \n",
727 | " 119.237003 | \n",
728 | " 416.683707 | \n",
729 | " 0.000000 | \n",
730 | " 0.0 | \n",
731 | " 1.000000 | \n",
732 | " 0.0 | \n",
733 | " 0.000000 | \n",
734 | " 0.0 | \n",
735 | " 0.000000 | \n",
736 | " 0.0 | \n",
737 | " 0.000000 | \n",
738 | " 6.115756 | \n",
739 | " 0.169740 | \n",
740 | " 2002 | \n",
741 | " 8 | \n",
742 | " 31 | \n",
743 | " 1 | \n",
744 | " 3 | \n",
745 | " 213 | \n",
746 | " False | \n",
747 | " True | \n",
748 | " False | \n",
749 | " False | \n",
750 | " False | \n",
751 | " False | \n",
752 | " 1028160000 | \n",
753 | " -0.900969 | \n",
754 | " 0.433884 | \n",
755 | " 1.0 | \n",
756 | " 0.0 | \n",
757 | " -8.660254e-01 | \n",
758 | " -0.500000 | \n",
759 | " -0.873807 | \n",
760 | " -0.486273 | \n",
761 | " 20.135 | \n",
762 | " 44.854464 | \n",
763 | " 200231 | \n",
764 | " 1 | \n",
765 | "
\n",
766 | " \n",
767 | " | 99173 | \n",
768 | " 3648_2002-06-01 | \n",
769 | " 3648 | \n",
770 | " 23.326 | \n",
771 | " -10.561 | \n",
772 | " 0.027823 | \n",
773 | " 548.980169 | \n",
774 | " 602.706329 | \n",
775 | " -408.085144 | \n",
776 | " 1151.683292 | \n",
777 | " 0.000000 | \n",
778 | " 0.000000 | \n",
779 | " 1069.828049 | \n",
780 | " 1975.717729 | \n",
781 | " 0.0 | \n",
782 | " 100.137751 | \n",
783 | " 299.095594 | \n",
784 | " 1212.673317 | \n",
785 | " 152.483434 | \n",
786 | " 193.445553 | \n",
787 | " 1046.815181 | \n",
788 | " 0.000000 | \n",
789 | " 0.0 | \n",
790 | " 0.472876 | \n",
791 | " 0.0 | \n",
792 | " 0.527124 | \n",
793 | " 0.0 | \n",
794 | " 0.000000 | \n",
795 | " 0.0 | \n",
796 | " 0.000000 | \n",
797 | " 10.945428 | \n",
798 | " 0.000043 | \n",
799 | " 2002 | \n",
800 | " 6 | \n",
801 | " 22 | \n",
802 | " 1 | \n",
803 | " 5 | \n",
804 | " 152 | \n",
805 | " False | \n",
806 | " True | \n",
807 | " False | \n",
808 | " False | \n",
809 | " False | \n",
810 | " False | \n",
811 | " 1022889600 | \n",
812 | " -0.222521 | \n",
813 | " -0.974928 | \n",
814 | " 1.0 | \n",
815 | " 0.0 | \n",
816 | " -8.660254e-01 | \n",
817 | " 0.500000 | \n",
818 | " -0.856551 | \n",
819 | " 0.516062 | \n",
820 | " 33.887 | \n",
821 | " 44.933746 | \n",
822 | " 200222 | \n",
823 | " 1 | \n",
824 | "
\n",
825 | " \n",
826 | " | 45740 | \n",
827 | " 3709_2001-03-01 | \n",
828 | " 3709 | \n",
829 | " 25.145 | \n",
830 | " -10.953 | \n",
831 | " 0.000000 | \n",
832 | " 853.468491 | \n",
833 | " 0.000000 | \n",
834 | " -255.168680 | \n",
835 | " 853.468491 | \n",
836 | " 263.485312 | \n",
837 | " 178.133381 | \n",
838 | " 2308.324212 | \n",
839 | " 1472.980810 | \n",
840 | " 0.0 | \n",
841 | " 168.122957 | \n",
842 | " 251.439588 | \n",
843 | " 2032.385691 | \n",
844 | " 53.228263 | \n",
845 | " 142.323502 | \n",
846 | " 1330.688083 | \n",
847 | " 0.000000 | \n",
848 | " 0.0 | \n",
849 | " 0.425422 | \n",
850 | " 0.0 | \n",
851 | " 0.573042 | \n",
852 | " 0.0 | \n",
853 | " 0.000307 | \n",
854 | " 0.0 | \n",
855 | " 0.001229 | \n",
856 | " 8.130839 | \n",
857 | " 0.272880 | \n",
858 | " 2001 | \n",
859 | " 3 | \n",
860 | " 9 | \n",
861 | " 1 | \n",
862 | " 3 | \n",
863 | " 60 | \n",
864 | " False | \n",
865 | " True | \n",
866 | " False | \n",
867 | " False | \n",
868 | " False | \n",
869 | " False | \n",
870 | " 983404800 | \n",
871 | " -0.900969 | \n",
872 | " 0.433884 | \n",
873 | " 1.0 | \n",
874 | " 0.0 | \n",
875 | " 5.000000e-01 | \n",
876 | " 0.866025 | \n",
877 | " 0.527078 | \n",
878 | " 0.849817 | \n",
879 | " 36.098 | \n",
880 | " 44.890821 | \n",
881 | " 200109 | \n",
882 | " 0 | \n",
883 | "
\n",
884 | " \n",
885 | " | 287166 | \n",
886 | " 591_2006-08-01 | \n",
887 | " 591 | \n",
888 | " 30.232 | \n",
889 | " 2.359 | \n",
890 | " 0.000000 | \n",
891 | " 924.229044 | \n",
892 | " 0.000000 | \n",
893 | " 379.529610 | \n",
894 | " 924.229044 | \n",
895 | " 338.272344 | \n",
896 | " 207.061995 | \n",
897 | " 1350.884091 | \n",
898 | " 1660.196357 | \n",
899 | " 0.0 | \n",
900 | " 165.534073 | \n",
901 | " 262.976360 | \n",
902 | " 2171.331926 | \n",
903 | " 49.037631 | \n",
904 | " 165.550115 | \n",
905 | " 1305.151540 | \n",
906 | " 0.000000 | \n",
907 | " 0.0 | \n",
908 | " 0.994325 | \n",
909 | " 0.0 | \n",
910 | " 0.005367 | \n",
911 | " 0.0 | \n",
912 | " 0.000307 | \n",
913 | " 0.0 | \n",
914 | " 0.000000 | \n",
915 | " 171.425368 | \n",
916 | " 0.204666 | \n",
917 | " 2006 | \n",
918 | " 8 | \n",
919 | " 31 | \n",
920 | " 1 | \n",
921 | " 1 | \n",
922 | " 213 | \n",
923 | " False | \n",
924 | " True | \n",
925 | " False | \n",
926 | " False | \n",
927 | " False | \n",
928 | " False | \n",
929 | " 1154390400 | \n",
930 | " 0.623490 | \n",
931 | " 0.781831 | \n",
932 | " 1.0 | \n",
933 | " 0.0 | \n",
934 | " -8.660254e-01 | \n",
935 | " -0.500000 | \n",
936 | " -0.873807 | \n",
937 | " -0.486273 | \n",
938 | " 27.873 | \n",
939 | " 45.375505 | \n",
940 | " 200631 | \n",
941 | " 0 | \n",
942 | "
\n",
943 | " \n",
944 | " | 616475 | \n",
945 | " 1294_2013-10-01 | \n",
946 | " 1294 | \n",
947 | " 24.296 | \n",
948 | " -0.488 | \n",
949 | " 0.000000 | \n",
950 | " 1133.284570 | \n",
951 | " 0.000000 | \n",
952 | " -824.516572 | \n",
953 | " 1133.284570 | \n",
954 | " 183.583101 | \n",
955 | " 70.250698 | \n",
956 | " 303.917688 | \n",
957 | " 1945.832706 | \n",
958 | " 0.0 | \n",
959 | " 201.917688 | \n",
960 | " 304.353891 | \n",
961 | " 2515.410222 | \n",
962 | " 85.810368 | \n",
963 | " 123.618186 | \n",
964 | " 429.312009 | \n",
965 | " 0.000000 | \n",
966 | " 0.0 | \n",
967 | " 0.999693 | \n",
968 | " 0.0 | \n",
969 | " 0.000000 | \n",
970 | " 0.0 | \n",
971 | " 0.000307 | \n",
972 | " 0.0 | \n",
973 | " 0.000000 | \n",
974 | " 8.754024 | \n",
975 | " 0.442307 | \n",
976 | " 2013 | \n",
977 | " 10 | \n",
978 | " 40 | \n",
979 | " 1 | \n",
980 | " 1 | \n",
981 | " 274 | \n",
982 | " False | \n",
983 | " True | \n",
984 | " False | \n",
985 | " True | \n",
986 | " False | \n",
987 | " False | \n",
988 | " 1380585600 | \n",
989 | " 0.623490 | \n",
990 | " 0.781831 | \n",
991 | " 1.0 | \n",
992 | " 0.0 | \n",
993 | " -1.836970e-16 | \n",
994 | " -1.000000 | \n",
995 | " -0.012910 | \n",
996 | " -0.999917 | \n",
997 | " 24.784 | \n",
998 | " 44.949753 | \n",
999 | " 201340 | \n",
1000 | " 0 | \n",
1001 | "
\n",
1002 | " \n",
1003 | " | 349711 | \n",
1004 | " 2000_2007-12-01 | \n",
1005 | " 2000 | \n",
1006 | " 28.280 | \n",
1007 | " -3.123 | \n",
1008 | " 0.000000 | \n",
1009 | " 1080.048072 | \n",
1010 | " 0.000000 | \n",
1011 | " 327.435542 | \n",
1012 | " 1080.048072 | \n",
1013 | " 345.964699 | \n",
1014 | " 237.997470 | \n",
1015 | " 1992.561807 | \n",
1016 | " 1668.507470 | \n",
1017 | " 0.0 | \n",
1018 | " 186.634940 | \n",
1019 | " 284.902410 | \n",
1020 | " 2004.229759 | \n",
1021 | " 103.445181 | \n",
1022 | " 171.248072 | \n",
1023 | " 1169.984508 | \n",
1024 | " 0.000000 | \n",
1025 | " 0.0 | \n",
1026 | " 0.983171 | \n",
1027 | " 0.0 | \n",
1028 | " 0.000000 | \n",
1029 | " 0.0 | \n",
1030 | " 0.016829 | \n",
1031 | " 0.0 | \n",
1032 | " 0.000000 | \n",
1033 | " 36.898173 | \n",
1034 | " 0.199186 | \n",
1035 | " 2007 | \n",
1036 | " 12 | \n",
1037 | " 48 | \n",
1038 | " 1 | \n",
1039 | " 5 | \n",
1040 | " 335 | \n",
1041 | " False | \n",
1042 | " True | \n",
1043 | " False | \n",
1044 | " False | \n",
1045 | " False | \n",
1046 | " False | \n",
1047 | " 1196467200 | \n",
1048 | " -0.222521 | \n",
1049 | " -0.974928 | \n",
1050 | " 1.0 | \n",
1051 | " 0.0 | \n",
1052 | " 8.660254e-01 | \n",
1053 | " -0.500000 | \n",
1054 | " 0.860961 | \n",
1055 | " -0.508671 | \n",
1056 | " 31.403 | \n",
1057 | " 44.701915 | \n",
1058 | " 200748 | \n",
1059 | " 0 | \n",
1060 | "
\n",
1061 | " \n",
1062 | "
\n",
1063 | "
"
1064 | ],
1065 | "text/plain": [
1066 | " ID area lat ... bearing_dist woy burnt\n",
1067 | "28759 2012_2000-11-01 2012 17.825 ... 44.837866 200044 0\n",
1068 | "87245 3183_2002-03-01 3183 27.708 ... 44.609663 200209 0\n",
1069 | "68117 3160_2001-10-01 3160 22.581 ... 44.767693 200140 0\n",
1070 | "342446 2377_2007-10-01 2377 13.322 ... 44.924152 200740 0\n",
1071 | "105174 2007_2002-08-01 2007 16.701 ... 44.854464 200231 1\n",
1072 | "99173 3648_2002-06-01 3648 23.326 ... 44.933746 200222 1\n",
1073 | "45740 3709_2001-03-01 3709 25.145 ... 44.890821 200109 0\n",
1074 | "287166 591_2006-08-01 591 30.232 ... 45.375505 200631 0\n",
1075 | "616475 1294_2013-10-01 1294 24.296 ... 44.949753 201340 0\n",
1076 | "349711 2000_2007-12-01 2000 28.280 ... 44.701915 200748 0\n",
1077 | "\n",
1078 | "[10 rows x 56 columns]"
1079 | ]
1080 | },
1081 | "metadata": {
1082 | "tags": []
1083 | },
1084 | "execution_count": 44
1085 | }
1086 | ]
1087 | },
1088 | {
1089 | "cell_type": "code",
1090 | "metadata": {
1091 | "id": "uo5hE9IM8vQV",
1092 | "colab_type": "code",
1093 | "colab": {
1094 | "base_uri": "https://localhost:8080/",
1095 | "height": 531
1096 | },
1097 | "outputId": "7ef10525-1359-4f3e-e791-84be9e2bbe0f"
1098 | },
1099 | "source": [
1100 | "# Sampling 10 observations of the test set\n",
1101 | "test.sample(10)"
1102 | ],
1103 | "execution_count": 45,
1104 | "outputs": [
1105 | {
1106 | "output_type": "execute_result",
1107 | "data": {
1108 | "text/html": [
1109 | "\n",
1110 | "\n",
1123 | "
\n",
1124 | " \n",
1125 | " \n",
1126 | " | \n",
1127 | " ID | \n",
1128 | " area | \n",
1129 | " lat | \n",
1130 | " lon | \n",
1131 | " burn_area | \n",
1132 | " climate_aet | \n",
1133 | " climate_def | \n",
1134 | " climate_pdsi | \n",
1135 | " climate_pet | \n",
1136 | " climate_pr | \n",
1137 | " climate_ro | \n",
1138 | " climate_soil | \n",
1139 | " climate_srad | \n",
1140 | " climate_swe | \n",
1141 | " climate_tmmn | \n",
1142 | " climate_tmmx | \n",
1143 | " climate_vap | \n",
1144 | " climate_vpd | \n",
1145 | " climate_vs | \n",
1146 | " elevation | \n",
1147 | " landcover_0 | \n",
1148 | " landcover_1 | \n",
1149 | " landcover_2 | \n",
1150 | " landcover_3 | \n",
1151 | " landcover_4 | \n",
1152 | " landcover_5 | \n",
1153 | " landcover_6 | \n",
1154 | " landcover_7 | \n",
1155 | " landcover_8 | \n",
1156 | " population_density | \n",
1157 | " precipitation | \n",
1158 | " Year | \n",
1159 | " Month | \n",
1160 | " Week | \n",
1161 | " Day | \n",
1162 | " Dayofweek | \n",
1163 | " Dayofyear | \n",
1164 | " Is_month_end | \n",
1165 | " Is_month_start | \n",
1166 | " Is_quarter_end | \n",
1167 | " Is_quarter_start | \n",
1168 | " Is_year_end | \n",
1169 | " Is_year_start | \n",
1170 | " Elapsed | \n",
1171 | " weekday_cos | \n",
1172 | " weekday_sin | \n",
1173 | " day_month_cos | \n",
1174 | " day_month_sin | \n",
1175 | " month_year_cos | \n",
1176 | " month_year_sin | \n",
1177 | " day_year_cos | \n",
1178 | " day_year_sin | \n",
1179 | " manhat_dist | \n",
1180 | " bearing_dist | \n",
1181 | " woy | \n",
1182 | " burnt | \n",
1183 | "
\n",
1184 | " \n",
1185 | " \n",
1186 | " \n",
1187 | " | 38572 | \n",
1188 | " 362_2014-11-01 | \n",
1189 | " 362 | \n",
1190 | " 29.156 | \n",
1191 | " 3.248 | \n",
1192 | " 0.0 | \n",
1193 | " 1038.699650 | \n",
1194 | " 281.743092 | \n",
1195 | " -864.319657 | \n",
1196 | " 1320.316761 | \n",
1197 | " 61.383613 | \n",
1198 | " 3.000000 | \n",
1199 | " 808.848799 | \n",
1200 | " 2332.032098 | \n",
1201 | " 0.0 | \n",
1202 | " 191.143116 | \n",
1203 | " 312.021117 | \n",
1204 | " 2029.852540 | \n",
1205 | " 136.405213 | \n",
1206 | " 149.641607 | \n",
1207 | " 858.210873 | \n",
1208 | " 0.000000 | \n",
1209 | " 0.0 | \n",
1210 | " 0.927537 | \n",
1211 | " 0.0 | \n",
1212 | " 0.063680 | \n",
1213 | " 0.000000 | \n",
1214 | " 0.008783 | \n",
1215 | " 0.000000 | \n",
1216 | " 0.000000 | \n",
1217 | " 16.238297 | \n",
1218 | " 0.061934 | \n",
1219 | " 2014 | \n",
1220 | " 11 | \n",
1221 | " 44 | \n",
1222 | " 1 | \n",
1223 | " 5 | \n",
1224 | " 305 | \n",
1225 | " False | \n",
1226 | " True | \n",
1227 | " False | \n",
1228 | " False | \n",
1229 | " False | \n",
1230 | " False | \n",
1231 | " 1414800000 | \n",
1232 | " -0.222521 | \n",
1233 | " -0.974928 | \n",
1234 | " 1.0 | \n",
1235 | " 0.0 | \n",
1236 | " 5.000000e-01 | \n",
1237 | " -0.866025 | \n",
1238 | " 0.497513 | \n",
1239 | " -0.867456 | \n",
1240 | " 25.908 | \n",
1241 | " 45.529515 | \n",
1242 | " 201444 | \n",
1243 | " 1 | \n",
1244 | "
\n",
1245 | " \n",
1246 | " | 92420 | \n",
1247 | " 716_2016-01-01 | \n",
1248 | " 716 | \n",
1249 | " 19.168 | \n",
1250 | " 1.762 | \n",
1251 | " 0.0 | \n",
1252 | " 233.252867 | \n",
1253 | " 1172.825468 | \n",
1254 | " -664.632951 | \n",
1255 | " 1406.154737 | \n",
1256 | " 13.599034 | \n",
1257 | " 1.000000 | \n",
1258 | " 234.130235 | \n",
1259 | " 2552.994931 | \n",
1260 | " 0.0 | \n",
1261 | " 201.043693 | \n",
1262 | " 316.058660 | \n",
1263 | " 2221.202052 | \n",
1264 | " 129.725287 | \n",
1265 | " 112.664454 | \n",
1266 | " 340.184166 | \n",
1267 | " 0.006589 | \n",
1268 | " 0.0 | \n",
1269 | " 0.972644 | \n",
1270 | " 0.0 | \n",
1271 | " 0.000000 | \n",
1272 | " 0.000000 | \n",
1273 | " 0.020766 | \n",
1274 | " 0.000000 | \n",
1275 | " 0.000000 | \n",
1276 | " 14.089761 | \n",
1277 | " 0.006290 | \n",
1278 | " 2016 | \n",
1279 | " 1 | \n",
1280 | " 53 | \n",
1281 | " 1 | \n",
1282 | " 4 | \n",
1283 | " 1 | \n",
1284 | " False | \n",
1285 | " True | \n",
1286 | " False | \n",
1287 | " True | \n",
1288 | " False | \n",
1289 | " True | \n",
1290 | " 1451606400 | \n",
1291 | " -0.900969 | \n",
1292 | " -0.433884 | \n",
1293 | " 1.0 | \n",
1294 | " 0.0 | \n",
1295 | " 1.000000e+00 | \n",
1296 | " 0.000000 | \n",
1297 | " 1.000000 | \n",
1298 | " 0.000000 | \n",
1299 | " 17.406 | \n",
1300 | " 45.177606 | \n",
1301 | " 201653 | \n",
1302 | " 0 | \n",
1303 | "
\n",
1304 | " \n",
1305 | " | 39454 | \n",
1306 | " 1244_2014-11-01 | \n",
1307 | " 1244 | \n",
1308 | " 25.181 | \n",
1309 | " -0.264 | \n",
1310 | " 0.0 | \n",
1311 | " 1091.275280 | \n",
1312 | " 0.000000 | \n",
1313 | " -949.181150 | \n",
1314 | " 1091.275280 | \n",
1315 | " 158.384476 | \n",
1316 | " 49.228275 | \n",
1317 | " 410.498132 | \n",
1318 | " 2060.172713 | \n",
1319 | " 0.0 | \n",
1320 | " 190.599012 | \n",
1321 | " 294.725443 | \n",
1322 | " 2499.414367 | \n",
1323 | " 67.790647 | \n",
1324 | " 120.061589 | \n",
1325 | " 452.107433 | \n",
1326 | " 0.000000 | \n",
1327 | " 0.0 | \n",
1328 | " 1.000000 | \n",
1329 | " 0.0 | \n",
1330 | " 0.000000 | \n",
1331 | " 0.000000 | \n",
1332 | " 0.000000 | \n",
1333 | " 0.000000 | \n",
1334 | " 0.000000 | \n",
1335 | " 6.462664 | \n",
1336 | " 0.360877 | \n",
1337 | " 2014 | \n",
1338 | " 11 | \n",
1339 | " 44 | \n",
1340 | " 1 | \n",
1341 | " 5 | \n",
1342 | " 305 | \n",
1343 | " False | \n",
1344 | " True | \n",
1345 | " False | \n",
1346 | " False | \n",
1347 | " False | \n",
1348 | " False | \n",
1349 | " 1414800000 | \n",
1350 | " -0.222521 | \n",
1351 | " -0.974928 | \n",
1352 | " 1.0 | \n",
1353 | " 0.0 | \n",
1354 | " 5.000000e-01 | \n",
1355 | " -0.866025 | \n",
1356 | " 0.497513 | \n",
1357 | " -0.867456 | \n",
1358 | " 25.445 | \n",
1359 | " 44.971189 | \n",
1360 | " 201444 | \n",
1361 | " 0 | \n",
1362 | "
\n",
1363 | " \n",
1364 | " | 95228 | \n",
1365 | " 3524_2016-01-01 | \n",
1366 | " 3524 | \n",
1367 | " 27.329 | \n",
1368 | " -9.324 | \n",
1369 | " 0.0 | \n",
1370 | " 911.084256 | \n",
1371 | " 0.000000 | \n",
1372 | " -337.548495 | \n",
1373 | " 911.084256 | \n",
1374 | " 160.458884 | \n",
1375 | " 67.582411 | \n",
1376 | " 1928.076996 | \n",
1377 | " 1290.778412 | \n",
1378 | " 0.0 | \n",
1379 | " 195.228371 | \n",
1380 | " 295.970011 | \n",
1381 | " 2353.894442 | \n",
1382 | " 86.868380 | \n",
1383 | " 171.688326 | \n",
1384 | " 950.956063 | \n",
1385 | " 0.000000 | \n",
1386 | " 0.0 | \n",
1387 | " 0.005421 | \n",
1388 | " 0.0 | \n",
1389 | " 0.983745 | \n",
1390 | " 0.000615 | \n",
1391 | " 0.004994 | \n",
1392 | " 0.000000 | \n",
1393 | " 0.005225 | \n",
1394 | " 16.126879 | \n",
1395 | " 0.231482 | \n",
1396 | " 2016 | \n",
1397 | " 1 | \n",
1398 | " 53 | \n",
1399 | " 1 | \n",
1400 | " 4 | \n",
1401 | " 1 | \n",
1402 | " False | \n",
1403 | " True | \n",
1404 | " False | \n",
1405 | " True | \n",
1406 | " False | \n",
1407 | " True | \n",
1408 | " 1451606400 | \n",
1409 | " -0.900969 | \n",
1410 | " -0.433884 | \n",
1411 | " 1.0 | \n",
1412 | " 0.0 | \n",
1413 | " 1.000000e+00 | \n",
1414 | " 0.000000 | \n",
1415 | " 1.000000 | \n",
1416 | " 0.000000 | \n",
1417 | " 36.653 | \n",
1418 | " 44.689274 | \n",
1419 | " 201653 | \n",
1420 | " 0 | \n",
1421 | "
\n",
1422 | " \n",
1423 | " | 129176 | \n",
1424 | " 3083_2016-10-01 | \n",
1425 | " 3083 | \n",
1426 | " 28.137 | \n",
1427 | " -6.870 | \n",
1428 | " 0.0 | \n",
1429 | " 666.955944 | \n",
1430 | " 842.336406 | \n",
1431 | " -337.514665 | \n",
1432 | " 1509.407279 | \n",
1433 | " 65.380462 | \n",
1434 | " 3.004310 | \n",
1435 | " 259.617024 | \n",
1436 | " 2412.241111 | \n",
1437 | " 0.0 | \n",
1438 | " 198.876811 | \n",
1439 | " 315.750389 | \n",
1440 | " 2178.958578 | \n",
1441 | " 131.914881 | \n",
1442 | " 212.128337 | \n",
1443 | " 688.965307 | \n",
1444 | " 0.000000 | \n",
1445 | " 0.0 | \n",
1446 | " 0.640213 | \n",
1447 | " 0.0 | \n",
1448 | " 0.354672 | \n",
1449 | " 0.000000 | \n",
1450 | " 0.005114 | \n",
1451 | " 0.000000 | \n",
1452 | " 0.000000 | \n",
1453 | " 26.678158 | \n",
1454 | " 0.169762 | \n",
1455 | " 2016 | \n",
1456 | " 10 | \n",
1457 | " 39 | \n",
1458 | " 1 | \n",
1459 | " 5 | \n",
1460 | " 275 | \n",
1461 | " False | \n",
1462 | " True | \n",
1463 | " False | \n",
1464 | " True | \n",
1465 | " False | \n",
1466 | " False | \n",
1467 | " 1475280000 | \n",
1468 | " -0.222521 | \n",
1469 | " -0.974928 | \n",
1470 | " 1.0 | \n",
1471 | " 0.0 | \n",
1472 | " -1.836970e-16 | \n",
1473 | " -1.000000 | \n",
1474 | " -0.008583 | \n",
1475 | " -0.999963 | \n",
1476 | " 35.007 | \n",
1477 | " 44.592756 | \n",
1478 | " 201639 | \n",
1479 | " 0 | \n",
1480 | "
\n",
1481 | " \n",
1482 | " | 80661 | \n",
1483 | " 420_2015-10-01 | \n",
1484 | " 420 | \n",
1485 | " 29.806 | \n",
1486 | " 3.020 | \n",
1487 | " 0.0 | \n",
1488 | " 1138.829307 | \n",
1489 | " 0.000000 | \n",
1490 | " -820.567528 | \n",
1491 | " 1138.829307 | \n",
1492 | " 181.858541 | \n",
1493 | " 45.805267 | \n",
1494 | " 1405.354796 | \n",
1495 | " 1923.504470 | \n",
1496 | " 0.0 | \n",
1497 | " 191.404566 | \n",
1498 | " 289.983692 | \n",
1499 | " 2182.726746 | \n",
1500 | " 94.096521 | \n",
1501 | " 148.560522 | \n",
1502 | " 955.121693 | \n",
1503 | " 0.000000 | \n",
1504 | " 0.0 | \n",
1505 | " 0.967142 | \n",
1506 | " 0.0 | \n",
1507 | " 0.031184 | \n",
1508 | " 0.000000 | \n",
1509 | " 0.001674 | \n",
1510 | " 0.000000 | \n",
1511 | " 0.000000 | \n",
1512 | " 27.850112 | \n",
1513 | " 0.356360 | \n",
1514 | " 2015 | \n",
1515 | " 10 | \n",
1516 | " 40 | \n",
1517 | " 1 | \n",
1518 | " 3 | \n",
1519 | " 274 | \n",
1520 | " False | \n",
1521 | " True | \n",
1522 | " False | \n",
1523 | " True | \n",
1524 | " False | \n",
1525 | " False | \n",
1526 | " 1443657600 | \n",
1527 | " -0.900969 | \n",
1528 | " 0.433884 | \n",
1529 | " 1.0 | \n",
1530 | " 0.0 | \n",
1531 | " -1.836970e-16 | \n",
1532 | " -1.000000 | \n",
1533 | " -0.012910 | \n",
1534 | " -0.999917 | \n",
1535 | " 26.786 | \n",
1536 | " 45.495025 | \n",
1537 | " 201540 | \n",
1538 | " 0 | \n",
1539 | "
\n",
1540 | " \n",
1541 | " | 43111 | \n",
1542 | " 1080_2014-12-01 | \n",
1543 | " 1080 | \n",
1544 | " 25.181 | \n",
1545 | " 0.403 | \n",
1546 | " 0.0 | \n",
1547 | " 962.847435 | \n",
1548 | " 146.094870 | \n",
1549 | " -889.808570 | \n",
1550 | " 1108.977308 | \n",
1551 | " 74.926011 | \n",
1552 | " 3.943754 | \n",
1553 | " 324.968859 | \n",
1554 | " 2006.496681 | \n",
1555 | " 0.0 | \n",
1556 | " 198.290766 | \n",
1557 | " 296.870247 | \n",
1558 | " 2551.319131 | \n",
1559 | " 70.434158 | \n",
1560 | " 122.576705 | \n",
1561 | " 433.959832 | \n",
1562 | " 0.000307 | \n",
1563 | " 0.0 | \n",
1564 | " 0.907894 | \n",
1565 | " 0.0 | \n",
1566 | " 0.000000 | \n",
1567 | " 0.000000 | \n",
1568 | " 0.033989 | \n",
1569 | " 0.000615 | \n",
1570 | " 0.057195 | \n",
1571 | " 254.640710 | \n",
1572 | " 0.093797 | \n",
1573 | " 2014 | \n",
1574 | " 12 | \n",
1575 | " 49 | \n",
1576 | " 1 | \n",
1577 | " 0 | \n",
1578 | " 335 | \n",
1579 | " False | \n",
1580 | " True | \n",
1581 | " False | \n",
1582 | " False | \n",
1583 | " False | \n",
1584 | " False | \n",
1585 | " 1417392000 | \n",
1586 | " 1.000000 | \n",
1587 | " 0.000000 | \n",
1588 | " 1.0 | \n",
1589 | " 0.0 | \n",
1590 | " 8.660254e-01 | \n",
1591 | " -0.500000 | \n",
1592 | " 0.860961 | \n",
1593 | " -0.508671 | \n",
1594 | " 24.778 | \n",
1595 | " 45.046574 | \n",
1596 | " 201449 | \n",
1597 | " 0 | \n",
1598 | "
\n",
1599 | " \n",
1600 | " | 36157 | \n",
1601 | " 1768_2014-10-01 | \n",
1602 | " 1768 | \n",
1603 | " 27.832 | \n",
1604 | " -2.246 | \n",
1605 | " 0.0 | \n",
1606 | " 1201.229589 | \n",
1607 | " 0.000000 | \n",
1608 | " -920.402415 | \n",
1609 | " 1201.229589 | \n",
1610 | " 148.270169 | \n",
1611 | " 7.297947 | \n",
1612 | " 456.632005 | \n",
1613 | " 2213.503744 | \n",
1614 | " 0.0 | \n",
1615 | " 168.429710 | \n",
1616 | " 275.533575 | \n",
1617 | " 2111.988889 | \n",
1618 | " 70.433937 | \n",
1619 | " 157.438768 | \n",
1620 | " 824.433151 | \n",
1621 | " 0.000000 | \n",
1622 | " 0.0 | \n",
1623 | " 0.998156 | \n",
1624 | " 0.0 | \n",
1625 | " 0.000000 | \n",
1626 | " 0.000000 | \n",
1627 | " 0.001844 | \n",
1628 | " 0.000000 | \n",
1629 | " 0.000000 | \n",
1630 | " 13.358513 | \n",
1631 | " 0.408906 | \n",
1632 | " 2014 | \n",
1633 | " 10 | \n",
1634 | " 40 | \n",
1635 | " 1 | \n",
1636 | " 2 | \n",
1637 | " 274 | \n",
1638 | " False | \n",
1639 | " True | \n",
1640 | " False | \n",
1641 | " True | \n",
1642 | " False | \n",
1643 | " False | \n",
1644 | " 1412121600 | \n",
1645 | " -0.222521 | \n",
1646 | " 0.974928 | \n",
1647 | " 1.0 | \n",
1648 | " 0.0 | \n",
1649 | " -1.836970e-16 | \n",
1650 | " -1.000000 | \n",
1651 | " -0.012910 | \n",
1652 | " -0.999917 | \n",
1653 | " 30.078 | \n",
1654 | " 44.771034 | \n",
1655 | " 201440 | \n",
1656 | " 0 | \n",
1657 | "
\n",
1658 | " \n",
1659 | " | 27133 | \n",
1660 | " 386_2014-08-01 | \n",
1661 | " 386 | \n",
1662 | " 22.305 | \n",
1663 | " 3.099 | \n",
1664 | " 0.0 | \n",
1665 | " 1056.223737 | \n",
1666 | " 0.000000 | \n",
1667 | " -231.357375 | \n",
1668 | " 1056.223737 | \n",
1669 | " 183.432035 | \n",
1670 | " 77.779882 | \n",
1671 | " 1435.318176 | \n",
1672 | " 1936.600169 | \n",
1673 | " 0.0 | \n",
1674 | " 195.717284 | \n",
1675 | " 290.277530 | \n",
1676 | " 2512.217223 | \n",
1677 | " 64.715595 | \n",
1678 | " 88.144494 | \n",
1679 | " 485.957439 | \n",
1680 | " 0.000000 | \n",
1681 | " 0.0 | \n",
1682 | " 1.000000 | \n",
1683 | " 0.0 | \n",
1684 | " 0.000000 | \n",
1685 | " 0.000000 | \n",
1686 | " 0.000000 | \n",
1687 | " 0.000000 | \n",
1688 | " 0.000000 | \n",
1689 | " 17.333804 | \n",
1690 | " 0.455457 | \n",
1691 | " 2014 | \n",
1692 | " 8 | \n",
1693 | " 31 | \n",
1694 | " 1 | \n",
1695 | " 4 | \n",
1696 | " 213 | \n",
1697 | " False | \n",
1698 | " True | \n",
1699 | " False | \n",
1700 | " False | \n",
1701 | " False | \n",
1702 | " False | \n",
1703 | " 1406851200 | \n",
1704 | " -0.900969 | \n",
1705 | " -0.433884 | \n",
1706 | " 1.0 | \n",
1707 | " 0.0 | \n",
1708 | " -8.660254e-01 | \n",
1709 | " -0.500000 | \n",
1710 | " -0.873807 | \n",
1711 | " -0.486273 | \n",
1712 | " 19.206 | \n",
1713 | " 45.397155 | \n",
1714 | " 201431 | \n",
1715 | " 0 | \n",
1716 | "
\n",
1717 | " \n",
1718 | " | 10304 | \n",
1719 | " 2662_2014-03-01 | \n",
1720 | " 2662 | \n",
1721 | " 27.438 | \n",
1722 | " -5.342 | \n",
1723 | " 0.0 | \n",
1724 | " 1067.527677 | \n",
1725 | " 28.843442 | \n",
1726 | " -322.544765 | \n",
1727 | " 1096.196510 | \n",
1728 | " 108.001564 | \n",
1729 | " 5.110108 | \n",
1730 | " 2155.961372 | \n",
1731 | " 1812.626835 | \n",
1732 | " 0.0 | \n",
1733 | " 194.436703 | \n",
1734 | " 302.323105 | \n",
1735 | " 2460.190493 | \n",
1736 | " 83.453911 | \n",
1737 | " 146.839350 | \n",
1738 | " 667.256050 | \n",
1739 | " 0.000000 | \n",
1740 | " 0.0 | \n",
1741 | " 0.719324 | \n",
1742 | " 0.0 | \n",
1743 | " 0.276373 | \n",
1744 | " 0.000000 | \n",
1745 | " 0.001229 | \n",
1746 | " 0.000000 | \n",
1747 | " 0.003073 | \n",
1748 | " 48.898685 | \n",
1749 | " 0.143238 | \n",
1750 | " 2014 | \n",
1751 | " 3 | \n",
1752 | " 9 | \n",
1753 | " 1 | \n",
1754 | " 5 | \n",
1755 | " 60 | \n",
1756 | " False | \n",
1757 | " True | \n",
1758 | " False | \n",
1759 | " False | \n",
1760 | " False | \n",
1761 | " False | \n",
1762 | " 1393632000 | \n",
1763 | " -0.222521 | \n",
1764 | " -0.974928 | \n",
1765 | " 1.0 | \n",
1766 | " 0.0 | \n",
1767 | " 5.000000e-01 | \n",
1768 | " 0.866025 | \n",
1769 | " 0.527078 | \n",
1770 | " 0.849817 | \n",
1771 | " 32.780 | \n",
1772 | " 44.622249 | \n",
1773 | " 201409 | \n",
1774 | " 0 | \n",
1775 | "
\n",
1776 | " \n",
1777 | "
\n",
1778 | "
"
1779 | ],
1780 | "text/plain": [
1781 | " ID area lat ... bearing_dist woy burnt\n",
1782 | "38572 362_2014-11-01 362 29.156 ... 45.529515 201444 1\n",
1783 | "92420 716_2016-01-01 716 19.168 ... 45.177606 201653 0\n",
1784 | "39454 1244_2014-11-01 1244 25.181 ... 44.971189 201444 0\n",
1785 | "95228 3524_2016-01-01 3524 27.329 ... 44.689274 201653 0\n",
1786 | "129176 3083_2016-10-01 3083 28.137 ... 44.592756 201639 0\n",
1787 | "80661 420_2015-10-01 420 29.806 ... 45.495025 201540 0\n",
1788 | "43111 1080_2014-12-01 1080 25.181 ... 45.046574 201449 0\n",
1789 | "36157 1768_2014-10-01 1768 27.832 ... 44.771034 201440 0\n",
1790 | "27133 386_2014-08-01 386 22.305 ... 45.397155 201431 0\n",
1791 | "10304 2662_2014-03-01 2662 27.438 ... 44.622249 201409 0\n",
1792 | "\n",
1793 | "[10 rows x 56 columns]"
1794 | ]
1795 | },
1796 | "metadata": {
1797 | "tags": []
1798 | },
1799 | "execution_count": 45
1800 | }
1801 | ]
1802 | },
1803 | {
1804 | "cell_type": "code",
1805 | "metadata": {
1806 | "id": "0LYhEfWvLBpx",
1807 | "colab_type": "code",
1808 | "colab": {
1809 | "base_uri": "https://localhost:8080/",
1810 | "height": 34
1811 | },
1812 | "outputId": "2dc4c9bb-6781-4e8b-9a57-aa3c5e9565e0"
1813 | },
1814 | "source": [
1815 | "# Checking the shape of training and test sets\n",
1816 | "train.shape, test.shape"
1817 | ],
1818 | "execution_count": 46,
1819 | "outputs": [
1820 | {
1821 | "output_type": "execute_result",
1822 | "data": {
1823 | "text/plain": [
1824 | "((626644, 56), (137556, 56))"
1825 | ]
1826 | },
1827 | "metadata": {
1828 | "tags": []
1829 | },
1830 | "execution_count": 46
1831 | }
1832 | ]
1833 | },
1834 | {
1835 | "cell_type": "markdown",
1836 | "metadata": {
1837 | "id": "unM_Fu-1NQUp",
1838 | "colab_type": "text"
1839 | },
1840 | "source": [
1841 | "### Training and making predictions"
1842 | ]
1843 | },
1844 | {
1845 | "cell_type": "code",
1846 | "metadata": {
1847 | "id": "TgczfJ26ZNAg",
1848 | "colab_type": "code",
1849 | "colab": {}
1850 | },
1851 | "source": [
1852 | "X = train.drop(['ID', 'area', 'burn_area'], axis = 1)\n",
1853 | "y = train.burn_area\n",
1854 | "\n",
1855 | "tes = test.drop(['ID', 'area', 'burn_area'], axis = 1)\n",
1856 | "\n",
1857 | "predictions = []\n",
1858 | "for i in range(10):\n",
1859 | " # Training the model with different seeds\n",
1860 | " cat = CatBoostRegressor(verbose = False, depth = 9, iterations = 1500, random_seed = i)\n",
1861 | " cat.fit(X, y)\n",
1862 | "\n",
1863 | " # Making predictions\n",
1864 | " preds = cat.predict(tes)\n",
1865 | " predictions.append(preds)\n",
1866 | "\n",
1867 | "# Averaging the preictions\n",
1868 | "preds = np.mean(predictions, axis = 0)\n",
1869 | "\n",
1870 | "# Creating submission file\n",
1871 | "sub_df = pd.DataFrame({'ID': test.ID, 'Prediction': preds})\n",
1872 | "sub_df.to_csv('submission.csv', index = False)"
1873 | ],
1874 | "execution_count": 0,
1875 | "outputs": []
1876 | }
1877 | ]
1878 | }
--------------------------------------------------------------------------------