├── 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 | "\"Open" 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 | " \n", 413 | " \n", 414 | " \n", 415 | " \n", 416 | " \n", 417 | " \n", 418 | " \n", 419 | " \n", 420 | " \n", 421 | " \n", 422 | " \n", 423 | " \n", 424 | " \n", 425 | " \n", 426 | " \n", 427 | " \n", 428 | " \n", 429 | " \n", 430 | " \n", 431 | " \n", 432 | " \n", 433 | " \n", 434 | " \n", 435 | " \n", 436 | " \n", 437 | " \n", 438 | " \n", 439 | " \n", 440 | " \n", 441 | " \n", 442 | " \n", 443 | " \n", 444 | " \n", 445 | " \n", 446 | " \n", 447 | " \n", 448 | " \n", 449 | " \n", 450 | " \n", 451 | " \n", 452 | " \n", 453 | " \n", 454 | " \n", 455 | " \n", 456 | " \n", 457 | " \n", 458 | " \n", 459 | " \n", 460 | " \n", 461 | " \n", 462 | " \n", 463 | " \n", 464 | " \n", 465 | " \n", 466 | " \n", 467 | " \n", 468 | " \n", 469 | " \n", 470 | " \n", 471 | " \n", 472 | " \n", 473 | " \n", 474 | " \n", 475 | " \n", 476 | " \n", 477 | " \n", 478 | " \n", 479 | " \n", 480 | " \n", 481 | " \n", 482 | " \n", 483 | " \n", 484 | " \n", 485 | " \n", 486 | " \n", 487 | " \n", 488 | " \n", 489 | " \n", 490 | " \n", 491 | " \n", 492 | " \n", 493 | " \n", 494 | " \n", 495 | " \n", 496 | " \n", 497 | " \n", 498 | " \n", 499 | " \n", 500 | " \n", 501 | " \n", 502 | " \n", 503 | " \n", 504 | " \n", 505 | " \n", 506 | " \n", 507 | " \n", 508 | " \n", 509 | " \n", 510 | " \n", 511 | " \n", 512 | " \n", 513 | " \n", 514 | " \n", 515 | " \n", 516 | " \n", 517 | " \n", 518 | " \n", 519 | " \n", 520 | " \n", 521 | " \n", 522 | " \n", 523 | " \n", 524 | " \n", 525 | " \n", 526 | " \n", 527 | " \n", 528 | " \n", 529 | " \n", 530 | " \n", 531 | " \n", 532 | " \n", 533 | " \n", 534 | " \n", 535 | " \n", 536 | " \n", 537 | " \n", 538 | " \n", 539 | " \n", 540 | " \n", 541 | " \n", 542 | " \n", 543 | " \n", 544 | " \n", 545 | " \n", 546 | " \n", 547 | " \n", 548 | " \n", 549 | " \n", 550 | " \n", 551 | " \n", 552 | " \n", 553 | " \n", 554 | " \n", 555 | " \n", 556 | " \n", 557 | " \n", 558 | " \n", 559 | " \n", 560 | " \n", 561 | " \n", 562 | " \n", 563 | " \n", 564 | " \n", 565 | " \n", 566 | " \n", 567 | " \n", 568 | " \n", 569 | " \n", 570 | " \n", 571 | " \n", 572 | " \n", 573 | " \n", 574 | " \n", 575 | " \n", 576 | " \n", 577 | " \n", 578 | " \n", 579 | " \n", 580 | " \n", 581 | " \n", 582 | " \n", 583 | " \n", 584 | " \n", 585 | " \n", 586 | " \n", 587 | " \n", 588 | " \n", 589 | " \n", 590 | " \n", 591 | " \n", 592 | " \n", 593 | " \n", 594 | " \n", 595 | " \n", 596 | " \n", 597 | " \n", 598 | " \n", 599 | " \n", 600 | " \n", 601 | " \n", 602 | " \n", 603 | " \n", 604 | " \n", 605 | " \n", 606 | " \n", 607 | " \n", 608 | " \n", 609 | " \n", 610 | " \n", 611 | " \n", 612 | " \n", 613 | " \n", 614 | " \n", 615 | " \n", 616 | " \n", 617 | " \n", 618 | " \n", 619 | " \n", 620 | " \n", 621 | " \n", 622 | " \n", 623 | " \n", 624 | " \n", 625 | " \n", 626 | " \n", 627 | " \n", 628 | " \n", 629 | " \n", 630 | " \n", 631 | " \n", 632 | " \n", 633 | " \n", 634 | " \n", 635 | " \n", 636 | " \n", 637 | " \n", 638 | " \n", 639 | " \n", 640 | " \n", 641 | " \n", 642 | " \n", 643 | " \n", 644 | " \n", 645 | " \n", 646 | " \n", 647 | " \n", 648 | " \n", 649 | " \n", 650 | " \n", 651 | " \n", 652 | " \n", 653 | " \n", 654 | " \n", 655 | " \n", 656 | " \n", 657 | " \n", 658 | " \n", 659 | " \n", 660 | " \n", 661 | " \n", 662 | " \n", 663 | " \n", 664 | " \n", 665 | " \n", 666 | " \n", 667 | " \n", 668 | " \n", 669 | " \n", 670 | " \n", 671 | " \n", 672 | " \n", 673 | " \n", 674 | " \n", 675 | " \n", 676 | " \n", 677 | " \n", 678 | " \n", 679 | " \n", 680 | " \n", 681 | " \n", 682 | " \n", 683 | " \n", 684 | " \n", 685 | " \n", 686 | " \n", 687 | " \n", 688 | " \n", 689 | " \n", 690 | " \n", 691 | " \n", 692 | " \n", 693 | " \n", 694 | " \n", 695 | " \n", 696 | " \n", 697 | " \n", 698 | " \n", 699 | " \n", 700 | " \n", 701 | " \n", 702 | " \n", 703 | " \n", 704 | " \n", 705 | " \n", 706 | " \n", 707 | " \n", 708 | " \n", 709 | " \n", 710 | " \n", 711 | " \n", 712 | " \n", 713 | " \n", 714 | " \n", 715 | " \n", 716 | " \n", 717 | " \n", 718 | " \n", 719 | " \n", 720 | " \n", 721 | " \n", 722 | " \n", 723 | " \n", 724 | " \n", 725 | " \n", 726 | " \n", 727 | " \n", 728 | " \n", 729 | " \n", 730 | " \n", 731 | " \n", 732 | " \n", 733 | " \n", 734 | " \n", 735 | " \n", 736 | " \n", 737 | " \n", 738 | " \n", 739 | " \n", 740 | " \n", 741 | " \n", 742 | " \n", 743 | " \n", 744 | " \n", 745 | " \n", 746 | " \n", 747 | " \n", 748 | " \n", 749 | " \n", 750 | " \n", 751 | " \n", 752 | " \n", 753 | " \n", 754 | " \n", 755 | " \n", 756 | " \n", 757 | " \n", 758 | " \n", 759 | " \n", 760 | " \n", 761 | " \n", 762 | " \n", 763 | " \n", 764 | " \n", 765 | " \n", 766 | " \n", 767 | " \n", 768 | " \n", 769 | " \n", 770 | " \n", 771 | " \n", 772 | " \n", 773 | " \n", 774 | " \n", 775 | " \n", 776 | " \n", 777 | " \n", 778 | " \n", 779 | " \n", 780 | " \n", 781 | " \n", 782 | " \n", 783 | " \n", 784 | " \n", 785 | " \n", 786 | " \n", 787 | " \n", 788 | " \n", 789 | " \n", 790 | " \n", 791 | " \n", 792 | " \n", 793 | " \n", 794 | " \n", 795 | " \n", 796 | " \n", 797 | " \n", 798 | " \n", 799 | " \n", 800 | " \n", 801 | " \n", 802 | " \n", 803 | " \n", 804 | " \n", 805 | " \n", 806 | " \n", 807 | " \n", 808 | " \n", 809 | " \n", 810 | " \n", 811 | " \n", 812 | " \n", 813 | " \n", 814 | " \n", 815 | " \n", 816 | " \n", 817 | " \n", 818 | " \n", 819 | " \n", 820 | " \n", 821 | " \n", 822 | " \n", 823 | " \n", 824 | " \n", 825 | " \n", 826 | " \n", 827 | " \n", 828 | " \n", 829 | " \n", 830 | " \n", 831 | " \n", 832 | " \n", 833 | " \n", 834 | " \n", 835 | " \n", 836 | " \n", 837 | " \n", 838 | " \n", 839 | " \n", 840 | " \n", 841 | " \n", 842 | " \n", 843 | " \n", 844 | " \n", 845 | " \n", 846 | " \n", 847 | " \n", 848 | " \n", 849 | " \n", 850 | " \n", 851 | " \n", 852 | " \n", 853 | " \n", 854 | " \n", 855 | " \n", 856 | " \n", 857 | " \n", 858 | " \n", 859 | " \n", 860 | " \n", 861 | " \n", 862 | " \n", 863 | " \n", 864 | " \n", 865 | " \n", 866 | " \n", 867 | " \n", 868 | " \n", 869 | " \n", 870 | " \n", 871 | " \n", 872 | " \n", 873 | " \n", 874 | " \n", 875 | " \n", 876 | " \n", 877 | " \n", 878 | " \n", 879 | " \n", 880 | " \n", 881 | " \n", 882 | " \n", 883 | " \n", 884 | " \n", 885 | " \n", 886 | " \n", 887 | " \n", 888 | " \n", 889 | " \n", 890 | " \n", 891 | " \n", 892 | " \n", 893 | " \n", 894 | " \n", 895 | " \n", 896 | " \n", 897 | " \n", 898 | " \n", 899 | " \n", 900 | " \n", 901 | " \n", 902 | " \n", 903 | " \n", 904 | " \n", 905 | " \n", 906 | " \n", 907 | " \n", 908 | " \n", 909 | " \n", 910 | " \n", 911 | " \n", 912 | " \n", 913 | " \n", 914 | " \n", 915 | " \n", 916 | " \n", 917 | " \n", 918 | " \n", 919 | " \n", 920 | " \n", 921 | " \n", 922 | " \n", 923 | " \n", 924 | " \n", 925 | " \n", 926 | " \n", 927 | " \n", 928 | " \n", 929 | " \n", 930 | " \n", 931 | " \n", 932 | " \n", 933 | " \n", 934 | " \n", 935 | " \n", 936 | " \n", 937 | " \n", 938 | " \n", 939 | " \n", 940 | " \n", 941 | " \n", 942 | " \n", 943 | " \n", 944 | " \n", 945 | " \n", 946 | " \n", 947 | " \n", 948 | " \n", 949 | " \n", 950 | " \n", 951 | " \n", 952 | " \n", 953 | " \n", 954 | " \n", 955 | " \n", 956 | " \n", 957 | " \n", 958 | " \n", 959 | " \n", 960 | " \n", 961 | " \n", 962 | " \n", 963 | " \n", 964 | " \n", 965 | " \n", 966 | " \n", 967 | " \n", 968 | " \n", 969 | " \n", 970 | " \n", 971 | " \n", 972 | " \n", 973 | " \n", 974 | " \n", 975 | " \n", 976 | " \n", 977 | " \n", 978 | " \n", 979 | " \n", 980 | " \n", 981 | " \n", 982 | " \n", 983 | " \n", 984 | " \n", 985 | " \n", 986 | " \n", 987 | " \n", 988 | " \n", 989 | " \n", 990 | " \n", 991 | " \n", 992 | " \n", 993 | " \n", 994 | " \n", 995 | " \n", 996 | " \n", 997 | " \n", 998 | " \n", 999 | " \n", 1000 | " \n", 1001 | " \n", 1002 | " \n", 1003 | " \n", 1004 | " \n", 1005 | " \n", 1006 | " \n", 1007 | " \n", 1008 | " \n", 1009 | " \n", 1010 | " \n", 1011 | " \n", 1012 | " \n", 1013 | " \n", 1014 | " \n", 1015 | " \n", 1016 | " \n", 1017 | " \n", 1018 | " \n", 1019 | " \n", 1020 | " \n", 1021 | " \n", 1022 | " \n", 1023 | " \n", 1024 | " \n", 1025 | " \n", 1026 | " \n", 1027 | " \n", 1028 | " \n", 1029 | " \n", 1030 | " \n", 1031 | " \n", 1032 | " \n", 1033 | " \n", 1034 | " \n", 1035 | " \n", 1036 | " \n", 1037 | " \n", 1038 | " \n", 1039 | " \n", 1040 | " \n", 1041 | " \n", 1042 | " \n", 1043 | " \n", 1044 | " \n", 1045 | " \n", 1046 | " \n", 1047 | " \n", 1048 | " \n", 1049 | " \n", 1050 | " \n", 1051 | " \n", 1052 | " \n", 1053 | " \n", 1054 | " \n", 1055 | " \n", 1056 | " \n", 1057 | " \n", 1058 | " \n", 1059 | " \n", 1060 | " \n", 1061 | " \n", 1062 | "
IDarealatlonburn_areaclimate_aetclimate_defclimate_pdsiclimate_petclimate_prclimate_roclimate_soilclimate_sradclimate_sweclimate_tmmnclimate_tmmxclimate_vapclimate_vpdclimate_vselevationlandcover_0landcover_1landcover_2landcover_3landcover_4landcover_5landcover_6landcover_7landcover_8population_densityprecipitationYearMonthWeekDayDayofweekDayofyearIs_month_endIs_month_startIs_quarter_endIs_quarter_startIs_year_endIs_year_startElapsedweekday_cosweekday_sinday_month_cosday_month_sinmonth_year_cosmonth_year_sinday_year_cosday_year_sinmanhat_distbearing_distwoyburnt
287592012_2000-11-01201217.825-3.4310.0000001000.5321940.000000373.2310751000.532194286.776267186.6544711506.7919121720.5486820.0214.944879306.9640152601.13635890.455771101.566374337.8013810.0015370.00.9749580.00.0021520.00.0213540.00.0000007.5849470.3235752000114412306FalseTrueFalseFalseFalseFalse973036800-0.2225210.9749281.00.05.000000e-01-0.8660250.500000-0.86602521.25644.8378662000440
872453183_2002-03-01318327.708-7.3230.000000938.6475730.000000-204.079089938.647573197.61725676.9710012020.2007191393.7725580.0193.696705309.1239072445.95482392.927382146.557220659.6033190.0000000.00.0362700.00.9637300.00.0000000.00.00000012.7587910.2761202002391460FalseTrueFalseFalseFalseFalse1014940800-0.900969-0.4338841.00.05.000000e-010.8660250.5270780.84981735.03144.6096632002090
681173160_2001-10-01316022.581-7.4410.000000365.512091910.111376-938.2894581275.60285935.8919592.000000169.2350212122.1971410.0181.276831301.1684342255.47671293.552591198.565217853.8645010.0000000.00.7176250.00.2811460.00.0000000.00.00123033.8011150.2842582001104010274FalseTrueFalseTrueFalseFalse10018944001.0000000.0000001.00.0-1.836970e-16-1.000000-0.012910-0.99991730.02244.7676932001400
3424462377_2007-10-01237713.322-4.7900.000000710.5807660.000000429.945474710.580766163.7443438.0000002382.501204927.4644920.0205.633004286.2330282319.49494586.458835129.679104491.2773870.0000000.00.9951680.00.0024590.00.0023720.00.00000049.7835390.3669442007104010274FalseTrueFalseTrueFalseFalse11911968001.0000000.0000001.00.0-1.836970e-16-1.000000-0.012910-0.99991718.11244.9241522007400
1051742007_2002-08-01200716.701-3.4340.025380556.525153484.062432-190.9735861040.53872020.9435711.000000879.9998801723.6806340.0195.149238306.9574982285.321767107.443751119.237003416.6837070.0000000.01.0000000.00.0000000.00.0000000.00.0000006.1157560.169740200283113213FalseTrueFalseFalseFalseFalse1028160000-0.9009690.4338841.00.0-8.660254e-01-0.500000-0.873807-0.48627320.13544.8544642002311
991733648_2002-06-01364823.326-10.5610.027823548.980169602.706329-408.0851441151.6832920.0000000.0000001069.8280491975.7177290.0100.137751299.0955941212.673317152.483434193.4455531046.8151810.0000000.00.4728760.00.5271240.00.0000000.00.00000010.9454280.000043200262215152FalseTrueFalseFalseFalseFalse1022889600-0.222521-0.9749281.00.0-8.660254e-010.500000-0.8565510.51606233.88744.9337462002221
457403709_2001-03-01370925.145-10.9530.000000853.4684910.000000-255.168680853.468491263.485312178.1333812308.3242121472.9808100.0168.122957251.4395882032.38569153.228263142.3235021330.6880830.0000000.00.4254220.00.5730420.00.0003070.00.0012298.1308390.2728802001391360FalseTrueFalseFalseFalseFalse983404800-0.9009690.4338841.00.05.000000e-010.8660250.5270780.84981736.09844.8908212001090
287166591_2006-08-0159130.2322.3590.000000924.2290440.000000379.529610924.229044338.272344207.0619951350.8840911660.1963570.0165.534073262.9763602171.33192649.037631165.5501151305.1515400.0000000.00.9943250.00.0053670.00.0003070.00.000000171.4253680.204666200683111213FalseTrueFalseFalseFalseFalse11543904000.6234900.7818311.00.0-8.660254e-01-0.500000-0.873807-0.48627327.87345.3755052006310
6164751294_2013-10-01129424.296-0.4880.0000001133.2845700.000000-824.5165721133.284570183.58310170.250698303.9176881945.8327060.0201.917688304.3538912515.41022285.810368123.618186429.3120090.0000000.00.9996930.00.0000000.00.0003070.00.0000008.7540240.4423072013104011274FalseTrueFalseTrueFalseFalse13805856000.6234900.7818311.00.0-1.836970e-16-1.000000-0.012910-0.99991724.78444.9497532013400
3497112000_2007-12-01200028.280-3.1230.0000001080.0480720.000000327.4355421080.048072345.964699237.9974701992.5618071668.5074700.0186.634940284.9024102004.229759103.445181171.2480721169.9845080.0000000.00.9831710.00.0000000.00.0168290.00.00000036.8981730.1991862007124815335FalseTrueFalseFalseFalseFalse1196467200-0.222521-0.9749281.00.08.660254e-01-0.5000000.860961-0.50867131.40344.7019152007480
\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 | " \n", 1128 | " \n", 1129 | " \n", 1130 | " \n", 1131 | " \n", 1132 | " \n", 1133 | " \n", 1134 | " \n", 1135 | " \n", 1136 | " \n", 1137 | " \n", 1138 | " \n", 1139 | " \n", 1140 | " \n", 1141 | " \n", 1142 | " \n", 1143 | " \n", 1144 | " \n", 1145 | " \n", 1146 | " \n", 1147 | " \n", 1148 | " \n", 1149 | " \n", 1150 | " \n", 1151 | " \n", 1152 | " \n", 1153 | " \n", 1154 | " \n", 1155 | " \n", 1156 | " \n", 1157 | " \n", 1158 | " \n", 1159 | " \n", 1160 | " \n", 1161 | " \n", 1162 | " \n", 1163 | " \n", 1164 | " \n", 1165 | " \n", 1166 | " \n", 1167 | " \n", 1168 | " \n", 1169 | " \n", 1170 | " \n", 1171 | " \n", 1172 | " \n", 1173 | " \n", 1174 | " \n", 1175 | " \n", 1176 | " \n", 1177 | " \n", 1178 | " \n", 1179 | " \n", 1180 | " \n", 1181 | " \n", 1182 | " \n", 1183 | " \n", 1184 | " \n", 1185 | " \n", 1186 | " \n", 1187 | " \n", 1188 | " \n", 1189 | " \n", 1190 | " \n", 1191 | " \n", 1192 | " \n", 1193 | " \n", 1194 | " \n", 1195 | " \n", 1196 | " \n", 1197 | " \n", 1198 | " \n", 1199 | " \n", 1200 | " \n", 1201 | " \n", 1202 | " \n", 1203 | " \n", 1204 | " \n", 1205 | " \n", 1206 | " \n", 1207 | " \n", 1208 | " \n", 1209 | " \n", 1210 | " \n", 1211 | " \n", 1212 | " \n", 1213 | " \n", 1214 | " \n", 1215 | " \n", 1216 | " \n", 1217 | " \n", 1218 | " \n", 1219 | " \n", 1220 | " \n", 1221 | " \n", 1222 | " \n", 1223 | " \n", 1224 | " \n", 1225 | " \n", 1226 | " \n", 1227 | " \n", 1228 | " \n", 1229 | " \n", 1230 | " \n", 1231 | " \n", 1232 | " \n", 1233 | " \n", 1234 | " \n", 1235 | " \n", 1236 | " \n", 1237 | " \n", 1238 | " \n", 1239 | " \n", 1240 | " \n", 1241 | " \n", 1242 | " \n", 1243 | " \n", 1244 | " \n", 1245 | " \n", 1246 | " \n", 1247 | " \n", 1248 | " \n", 1249 | " \n", 1250 | " \n", 1251 | " \n", 1252 | " \n", 1253 | " \n", 1254 | " \n", 1255 | " \n", 1256 | " \n", 1257 | " \n", 1258 | " \n", 1259 | " \n", 1260 | " \n", 1261 | " \n", 1262 | " \n", 1263 | " \n", 1264 | " \n", 1265 | " \n", 1266 | " \n", 1267 | " \n", 1268 | " \n", 1269 | " \n", 1270 | " \n", 1271 | " \n", 1272 | " \n", 1273 | " \n", 1274 | " \n", 1275 | " \n", 1276 | " \n", 1277 | " \n", 1278 | " \n", 1279 | " \n", 1280 | " \n", 1281 | " \n", 1282 | " \n", 1283 | " \n", 1284 | " \n", 1285 | " \n", 1286 | " \n", 1287 | " \n", 1288 | " \n", 1289 | " \n", 1290 | " \n", 1291 | " \n", 1292 | " \n", 1293 | " \n", 1294 | " \n", 1295 | " \n", 1296 | " \n", 1297 | " \n", 1298 | " \n", 1299 | " \n", 1300 | " \n", 1301 | " \n", 1302 | " \n", 1303 | " \n", 1304 | " \n", 1305 | " \n", 1306 | " \n", 1307 | " \n", 1308 | " \n", 1309 | " \n", 1310 | " \n", 1311 | " \n", 1312 | " \n", 1313 | " \n", 1314 | " \n", 1315 | " \n", 1316 | " \n", 1317 | " \n", 1318 | " \n", 1319 | " \n", 1320 | " \n", 1321 | " \n", 1322 | " \n", 1323 | " \n", 1324 | " \n", 1325 | " \n", 1326 | " \n", 1327 | " \n", 1328 | " \n", 1329 | " \n", 1330 | " \n", 1331 | " \n", 1332 | " \n", 1333 | " \n", 1334 | " \n", 1335 | " \n", 1336 | " \n", 1337 | " \n", 1338 | " \n", 1339 | " \n", 1340 | " \n", 1341 | " \n", 1342 | " \n", 1343 | " \n", 1344 | " \n", 1345 | " \n", 1346 | " \n", 1347 | " \n", 1348 | " \n", 1349 | " \n", 1350 | " \n", 1351 | " \n", 1352 | " \n", 1353 | " \n", 1354 | " \n", 1355 | " \n", 1356 | " \n", 1357 | " \n", 1358 | " \n", 1359 | " \n", 1360 | " \n", 1361 | " \n", 1362 | " \n", 1363 | " \n", 1364 | " \n", 1365 | " \n", 1366 | " \n", 1367 | " \n", 1368 | " \n", 1369 | " \n", 1370 | " \n", 1371 | " \n", 1372 | " \n", 1373 | " \n", 1374 | " \n", 1375 | " \n", 1376 | " \n", 1377 | " \n", 1378 | " \n", 1379 | " \n", 1380 | " \n", 1381 | " \n", 1382 | " \n", 1383 | " \n", 1384 | " \n", 1385 | " \n", 1386 | " \n", 1387 | " \n", 1388 | " \n", 1389 | " \n", 1390 | " \n", 1391 | " \n", 1392 | " \n", 1393 | " \n", 1394 | " \n", 1395 | " \n", 1396 | " \n", 1397 | " \n", 1398 | " \n", 1399 | " \n", 1400 | " \n", 1401 | " \n", 1402 | " \n", 1403 | " \n", 1404 | " \n", 1405 | " \n", 1406 | " \n", 1407 | " \n", 1408 | " \n", 1409 | " \n", 1410 | " \n", 1411 | " \n", 1412 | " \n", 1413 | " \n", 1414 | " \n", 1415 | " \n", 1416 | " \n", 1417 | " \n", 1418 | " \n", 1419 | " \n", 1420 | " \n", 1421 | " \n", 1422 | " \n", 1423 | " \n", 1424 | " \n", 1425 | " \n", 1426 | " \n", 1427 | " \n", 1428 | " \n", 1429 | " \n", 1430 | " \n", 1431 | " \n", 1432 | " \n", 1433 | " \n", 1434 | " \n", 1435 | " \n", 1436 | " \n", 1437 | " \n", 1438 | " \n", 1439 | " \n", 1440 | " \n", 1441 | " \n", 1442 | " \n", 1443 | " \n", 1444 | " \n", 1445 | " \n", 1446 | " \n", 1447 | " \n", 1448 | " \n", 1449 | " \n", 1450 | " \n", 1451 | " \n", 1452 | " \n", 1453 | " \n", 1454 | " \n", 1455 | " \n", 1456 | " \n", 1457 | " \n", 1458 | " \n", 1459 | " \n", 1460 | " \n", 1461 | " \n", 1462 | " \n", 1463 | " \n", 1464 | " \n", 1465 | " \n", 1466 | " \n", 1467 | " \n", 1468 | " \n", 1469 | " \n", 1470 | " \n", 1471 | " \n", 1472 | " \n", 1473 | " \n", 1474 | " \n", 1475 | " \n", 1476 | " \n", 1477 | " \n", 1478 | " \n", 1479 | " \n", 1480 | " \n", 1481 | " \n", 1482 | " \n", 1483 | " \n", 1484 | " \n", 1485 | " \n", 1486 | " \n", 1487 | " \n", 1488 | " \n", 1489 | " \n", 1490 | " \n", 1491 | " \n", 1492 | " \n", 1493 | " \n", 1494 | " \n", 1495 | " \n", 1496 | " \n", 1497 | " \n", 1498 | " \n", 1499 | " \n", 1500 | " \n", 1501 | " \n", 1502 | " \n", 1503 | " \n", 1504 | " \n", 1505 | " \n", 1506 | " \n", 1507 | " \n", 1508 | " \n", 1509 | " \n", 1510 | " \n", 1511 | " \n", 1512 | " \n", 1513 | " \n", 1514 | " \n", 1515 | " \n", 1516 | " \n", 1517 | " \n", 1518 | " \n", 1519 | " \n", 1520 | " \n", 1521 | " \n", 1522 | " \n", 1523 | " \n", 1524 | " \n", 1525 | " \n", 1526 | " \n", 1527 | " \n", 1528 | " \n", 1529 | " \n", 1530 | " \n", 1531 | " \n", 1532 | " \n", 1533 | " \n", 1534 | " \n", 1535 | " \n", 1536 | " \n", 1537 | " \n", 1538 | " \n", 1539 | " \n", 1540 | " \n", 1541 | " \n", 1542 | " \n", 1543 | " \n", 1544 | " \n", 1545 | " \n", 1546 | " \n", 1547 | " \n", 1548 | " \n", 1549 | " \n", 1550 | " \n", 1551 | " \n", 1552 | " \n", 1553 | " \n", 1554 | " \n", 1555 | " \n", 1556 | " \n", 1557 | " \n", 1558 | " \n", 1559 | " \n", 1560 | " \n", 1561 | " \n", 1562 | " \n", 1563 | " \n", 1564 | " \n", 1565 | " \n", 1566 | " \n", 1567 | " \n", 1568 | " \n", 1569 | " \n", 1570 | " \n", 1571 | " \n", 1572 | " \n", 1573 | " \n", 1574 | " \n", 1575 | " \n", 1576 | " \n", 1577 | " \n", 1578 | " \n", 1579 | " \n", 1580 | " \n", 1581 | " \n", 1582 | " \n", 1583 | " \n", 1584 | " \n", 1585 | " \n", 1586 | " \n", 1587 | " \n", 1588 | " \n", 1589 | " \n", 1590 | " \n", 1591 | " \n", 1592 | " \n", 1593 | " \n", 1594 | " \n", 1595 | " \n", 1596 | " \n", 1597 | " \n", 1598 | " \n", 1599 | " \n", 1600 | " \n", 1601 | " \n", 1602 | " \n", 1603 | " \n", 1604 | " \n", 1605 | " \n", 1606 | " \n", 1607 | " \n", 1608 | " \n", 1609 | " \n", 1610 | " \n", 1611 | " \n", 1612 | " \n", 1613 | " \n", 1614 | " \n", 1615 | " \n", 1616 | " \n", 1617 | " \n", 1618 | " \n", 1619 | " \n", 1620 | " \n", 1621 | " \n", 1622 | " \n", 1623 | " \n", 1624 | " \n", 1625 | " \n", 1626 | " \n", 1627 | " \n", 1628 | " \n", 1629 | " \n", 1630 | " \n", 1631 | " \n", 1632 | " \n", 1633 | " \n", 1634 | " \n", 1635 | " \n", 1636 | " \n", 1637 | " \n", 1638 | " \n", 1639 | " \n", 1640 | " \n", 1641 | " \n", 1642 | " \n", 1643 | " \n", 1644 | " \n", 1645 | " \n", 1646 | " \n", 1647 | " \n", 1648 | " \n", 1649 | " \n", 1650 | " \n", 1651 | " \n", 1652 | " \n", 1653 | " \n", 1654 | " \n", 1655 | " \n", 1656 | " \n", 1657 | " \n", 1658 | " \n", 1659 | " \n", 1660 | " \n", 1661 | " \n", 1662 | " \n", 1663 | " \n", 1664 | " \n", 1665 | " \n", 1666 | " \n", 1667 | " \n", 1668 | " \n", 1669 | " \n", 1670 | " \n", 1671 | " \n", 1672 | " \n", 1673 | " \n", 1674 | " \n", 1675 | " \n", 1676 | " \n", 1677 | " \n", 1678 | " \n", 1679 | " \n", 1680 | " \n", 1681 | " \n", 1682 | " \n", 1683 | " \n", 1684 | " \n", 1685 | " \n", 1686 | " \n", 1687 | " \n", 1688 | " \n", 1689 | " \n", 1690 | " \n", 1691 | " \n", 1692 | " \n", 1693 | " \n", 1694 | " \n", 1695 | " \n", 1696 | " \n", 1697 | " \n", 1698 | " \n", 1699 | " \n", 1700 | " \n", 1701 | " \n", 1702 | " \n", 1703 | " \n", 1704 | " \n", 1705 | " \n", 1706 | " \n", 1707 | " \n", 1708 | " \n", 1709 | " \n", 1710 | " \n", 1711 | " \n", 1712 | " \n", 1713 | " \n", 1714 | " \n", 1715 | " \n", 1716 | " \n", 1717 | " \n", 1718 | " \n", 1719 | " \n", 1720 | " \n", 1721 | " \n", 1722 | " \n", 1723 | " \n", 1724 | " \n", 1725 | " \n", 1726 | " \n", 1727 | " \n", 1728 | " \n", 1729 | " \n", 1730 | " \n", 1731 | " \n", 1732 | " \n", 1733 | " \n", 1734 | " \n", 1735 | " \n", 1736 | " \n", 1737 | " \n", 1738 | " \n", 1739 | " \n", 1740 | " \n", 1741 | " \n", 1742 | " \n", 1743 | " \n", 1744 | " \n", 1745 | " \n", 1746 | " \n", 1747 | " \n", 1748 | " \n", 1749 | " \n", 1750 | " \n", 1751 | " \n", 1752 | " \n", 1753 | " \n", 1754 | " \n", 1755 | " \n", 1756 | " \n", 1757 | " \n", 1758 | " \n", 1759 | " \n", 1760 | " \n", 1761 | " \n", 1762 | " \n", 1763 | " \n", 1764 | " \n", 1765 | " \n", 1766 | " \n", 1767 | " \n", 1768 | " \n", 1769 | " \n", 1770 | " \n", 1771 | " \n", 1772 | " \n", 1773 | " \n", 1774 | " \n", 1775 | " \n", 1776 | " \n", 1777 | "
IDarealatlonburn_areaclimate_aetclimate_defclimate_pdsiclimate_petclimate_prclimate_roclimate_soilclimate_sradclimate_sweclimate_tmmnclimate_tmmxclimate_vapclimate_vpdclimate_vselevationlandcover_0landcover_1landcover_2landcover_3landcover_4landcover_5landcover_6landcover_7landcover_8population_densityprecipitationYearMonthWeekDayDayofweekDayofyearIs_month_endIs_month_startIs_quarter_endIs_quarter_startIs_year_endIs_year_startElapsedweekday_cosweekday_sinday_month_cosday_month_sinmonth_year_cosmonth_year_sinday_year_cosday_year_sinmanhat_distbearing_distwoyburnt
38572362_2014-11-0136229.1563.2480.01038.699650281.743092-864.3196571320.31676161.3836133.000000808.8487992332.0320980.0191.143116312.0211172029.852540136.405213149.641607858.2108730.0000000.00.9275370.00.0636800.0000000.0087830.0000000.00000016.2382970.0619342014114415305FalseTrueFalseFalseFalseFalse1414800000-0.222521-0.9749281.00.05.000000e-01-0.8660250.497513-0.86745625.90845.5295152014441
92420716_2016-01-0171619.1681.7620.0233.2528671172.825468-664.6329511406.15473713.5990341.000000234.1302352552.9949310.0201.043693316.0586602221.202052129.725287112.664454340.1841660.0065890.00.9726440.00.0000000.0000000.0207660.0000000.00000014.0897610.0062902016153141FalseTrueFalseTrueFalseTrue1451606400-0.900969-0.4338841.00.01.000000e+000.0000001.0000000.00000017.40645.1776062016530
394541244_2014-11-01124425.181-0.2640.01091.2752800.000000-949.1811501091.275280158.38447649.228275410.4981322060.1727130.0190.599012294.7254432499.41436767.790647120.061589452.1074330.0000000.01.0000000.00.0000000.0000000.0000000.0000000.0000006.4626640.3608772014114415305FalseTrueFalseFalseFalseFalse1414800000-0.222521-0.9749281.00.05.000000e-01-0.8660250.497513-0.86745625.44544.9711892014440
952283524_2016-01-01352427.329-9.3240.0911.0842560.000000-337.548495911.084256160.45888467.5824111928.0769961290.7784120.0195.228371295.9700112353.89444286.868380171.688326950.9560630.0000000.00.0054210.00.9837450.0006150.0049940.0000000.00522516.1268790.2314822016153141FalseTrueFalseTrueFalseTrue1451606400-0.900969-0.4338841.00.01.000000e+000.0000001.0000000.00000036.65344.6892742016530
1291763083_2016-10-01308328.137-6.8700.0666.955944842.336406-337.5146651509.40727965.3804623.004310259.6170242412.2411110.0198.876811315.7503892178.958578131.914881212.128337688.9653070.0000000.00.6402130.00.3546720.0000000.0051140.0000000.00000026.6781580.1697622016103915275FalseTrueFalseTrueFalseFalse1475280000-0.222521-0.9749281.00.0-1.836970e-16-1.000000-0.008583-0.99996335.00744.5927562016390
80661420_2015-10-0142029.8063.0200.01138.8293070.000000-820.5675281138.829307181.85854145.8052671405.3547961923.5044700.0191.404566289.9836922182.72674694.096521148.560522955.1216930.0000000.00.9671420.00.0311840.0000000.0016740.0000000.00000027.8501120.3563602015104013274FalseTrueFalseTrueFalseFalse1443657600-0.9009690.4338841.00.0-1.836970e-16-1.000000-0.012910-0.99991726.78645.4950252015400
431111080_2014-12-01108025.1810.4030.0962.847435146.094870-889.8085701108.97730874.9260113.943754324.9688592006.4966810.0198.290766296.8702472551.31913170.434158122.576705433.9598320.0003070.00.9078940.00.0000000.0000000.0339890.0006150.057195254.6407100.0937972014124910335FalseTrueFalseFalseFalseFalse14173920001.0000000.0000001.00.08.660254e-01-0.5000000.860961-0.50867124.77845.0465742014490
361571768_2014-10-01176827.832-2.2460.01201.2295890.000000-920.4024151201.229589148.2701697.297947456.6320052213.5037440.0168.429710275.5335752111.98888970.433937157.438768824.4331510.0000000.00.9981560.00.0000000.0000000.0018440.0000000.00000013.3585130.4089062014104012274FalseTrueFalseTrueFalseFalse1412121600-0.2225210.9749281.00.0-1.836970e-16-1.000000-0.012910-0.99991730.07844.7710342014400
27133386_2014-08-0138622.3053.0990.01056.2237370.000000-231.3573751056.223737183.43203577.7798821435.3181761936.6001690.0195.717284290.2775302512.21722364.71559588.144494485.9574390.0000000.01.0000000.00.0000000.0000000.0000000.0000000.00000017.3338040.455457201483114213FalseTrueFalseFalseFalseFalse1406851200-0.900969-0.4338841.00.0-8.660254e-01-0.500000-0.873807-0.48627319.20645.3971552014310
103042662_2014-03-01266227.438-5.3420.01067.52767728.843442-322.5447651096.196510108.0015645.1101082155.9613721812.6268350.0194.436703302.3231052460.19049383.453911146.839350667.2560500.0000000.00.7193240.00.2763730.0000000.0012290.0000000.00307348.8986850.1432382014391560FalseTrueFalseFalseFalseFalse1393632000-0.222521-0.9749281.00.05.000000e-010.8660250.5270780.84981732.78044.6222492014090
\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 | } --------------------------------------------------------------------------------