2024-03-17 18:28:15 +01:00
|
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {
|
|
|
|
|
"scrolled": true
|
|
|
|
|
},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"%pip install --user kaggle \n",
|
|
|
|
|
"%pip install --user pandas\n",
|
|
|
|
|
"%pip install --user scikit-learn\n",
|
|
|
|
|
"%pip install --user matplotlib\n",
|
|
|
|
|
"%pip install --user geopandas"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 2,
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:38:40.019389600Z",
|
|
|
|
|
"start_time": "2024-03-17T17:38:36.535384600Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"import matplotlib.pyplot as plt \n",
|
|
|
|
|
"import pandas as pd"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"!kaggle datasets download -d uciml/forest-cover-type-dataset"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": null,
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:38:23.310983800Z",
|
|
|
|
|
"start_time": "2024-03-17T17:38:22.919245800Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"outputs": [],
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"source": [
|
|
|
|
|
"!unzip -o meteorite-landings.zip -d data"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"<h4>Zbiór</h4>"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 30,
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:38:46.756471100Z",
|
|
|
|
|
"start_time": "2024-03-17T17:38:46.335674200Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>Elevation</th>\n",
|
|
|
|
|
" <th>Aspect</th>\n",
|
|
|
|
|
" <th>Slope</th>\n",
|
|
|
|
|
" <th>Horizontal_Distance_To_Hydrology</th>\n",
|
|
|
|
|
" <th>Vertical_Distance_To_Hydrology</th>\n",
|
|
|
|
|
" <th>Horizontal_Distance_To_Roadways</th>\n",
|
|
|
|
|
" <th>Hillshade_9am</th>\n",
|
|
|
|
|
" <th>Hillshade_Noon</th>\n",
|
|
|
|
|
" <th>Hillshade_3pm</th>\n",
|
|
|
|
|
" <th>Horizontal_Distance_To_Fire_Points</th>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <th>Soil_Type32</th>\n",
|
|
|
|
|
" <th>Soil_Type33</th>\n",
|
|
|
|
|
" <th>Soil_Type34</th>\n",
|
|
|
|
|
" <th>Soil_Type35</th>\n",
|
|
|
|
|
" <th>Soil_Type36</th>\n",
|
|
|
|
|
" <th>Soil_Type37</th>\n",
|
|
|
|
|
" <th>Soil_Type38</th>\n",
|
|
|
|
|
" <th>Soil_Type39</th>\n",
|
|
|
|
|
" <th>Soil_Type40</th>\n",
|
|
|
|
|
" <th>Cover_Type</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>318054</th>\n",
|
|
|
|
|
" <td>2517</td>\n",
|
|
|
|
|
" <td>271</td>\n",
|
|
|
|
|
" <td>12</td>\n",
|
|
|
|
|
" <td>272</td>\n",
|
|
|
|
|
" <td>84</td>\n",
|
|
|
|
|
" <td>484</td>\n",
|
|
|
|
|
" <td>189</td>\n",
|
|
|
|
|
" <td>244</td>\n",
|
|
|
|
|
" <td>193</td>\n",
|
|
|
|
|
" <td>162</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>30504</th>\n",
|
|
|
|
|
" <td>2959</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>180</td>\n",
|
|
|
|
|
" <td>20</td>\n",
|
|
|
|
|
" <td>5960</td>\n",
|
|
|
|
|
" <td>217</td>\n",
|
|
|
|
|
" <td>236</td>\n",
|
|
|
|
|
" <td>156</td>\n",
|
|
|
|
|
" <td>3960</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>349520</th>\n",
|
|
|
|
|
" <td>3093</td>\n",
|
|
|
|
|
" <td>54</td>\n",
|
|
|
|
|
" <td>19</td>\n",
|
|
|
|
|
" <td>42</td>\n",
|
|
|
|
|
" <td>-3</td>\n",
|
|
|
|
|
" <td>797</td>\n",
|
|
|
|
|
" <td>227</td>\n",
|
|
|
|
|
" <td>196</td>\n",
|
|
|
|
|
" <td>94</td>\n",
|
|
|
|
|
" <td>1318</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>365645</th>\n",
|
|
|
|
|
" <td>2502</td>\n",
|
|
|
|
|
" <td>330</td>\n",
|
|
|
|
|
" <td>17</td>\n",
|
|
|
|
|
" <td>150</td>\n",
|
|
|
|
|
" <td>52</td>\n",
|
|
|
|
|
" <td>738</td>\n",
|
|
|
|
|
" <td>177</td>\n",
|
|
|
|
|
" <td>216</td>\n",
|
|
|
|
|
" <td>178</td>\n",
|
|
|
|
|
" <td>510</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>131114</th>\n",
|
|
|
|
|
" <td>2962</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>13</td>\n",
|
|
|
|
|
" <td>95</td>\n",
|
|
|
|
|
" <td>7</td>\n",
|
|
|
|
|
" <td>4270</td>\n",
|
|
|
|
|
" <td>202</td>\n",
|
|
|
|
|
" <td>214</td>\n",
|
|
|
|
|
" <td>148</td>\n",
|
|
|
|
|
" <td>1999</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>385769</th>\n",
|
|
|
|
|
" <td>3181</td>\n",
|
|
|
|
|
" <td>119</td>\n",
|
|
|
|
|
" <td>5</td>\n",
|
|
|
|
|
" <td>170</td>\n",
|
|
|
|
|
" <td>-1</td>\n",
|
|
|
|
|
" <td>2416</td>\n",
|
|
|
|
|
" <td>228</td>\n",
|
|
|
|
|
" <td>235</td>\n",
|
|
|
|
|
" <td>141</td>\n",
|
|
|
|
|
" <td>999</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>161626</th>\n",
|
|
|
|
|
" <td>2950</td>\n",
|
|
|
|
|
" <td>270</td>\n",
|
|
|
|
|
" <td>4</td>\n",
|
|
|
|
|
" <td>108</td>\n",
|
|
|
|
|
" <td>15</td>\n",
|
|
|
|
|
" <td>2053</td>\n",
|
|
|
|
|
" <td>210</td>\n",
|
|
|
|
|
" <td>241</td>\n",
|
|
|
|
|
" <td>170</td>\n",
|
|
|
|
|
" <td>2037</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>394880</th>\n",
|
|
|
|
|
" <td>3051</td>\n",
|
|
|
|
|
" <td>155</td>\n",
|
|
|
|
|
" <td>22</td>\n",
|
|
|
|
|
" <td>390</td>\n",
|
|
|
|
|
" <td>70</td>\n",
|
|
|
|
|
" <td>1871</td>\n",
|
|
|
|
|
" <td>239</td>\n",
|
|
|
|
|
" <td>236</td>\n",
|
|
|
|
|
" <td>114</td>\n",
|
|
|
|
|
" <td>1510</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>389492</th>\n",
|
|
|
|
|
" <td>3024</td>\n",
|
|
|
|
|
" <td>191</td>\n",
|
|
|
|
|
" <td>16</td>\n",
|
|
|
|
|
" <td>785</td>\n",
|
|
|
|
|
" <td>110</td>\n",
|
|
|
|
|
" <td>3000</td>\n",
|
|
|
|
|
" <td>218</td>\n",
|
|
|
|
|
" <td>251</td>\n",
|
|
|
|
|
" <td>162</td>\n",
|
|
|
|
|
" <td>1961</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>52507</th>\n",
|
|
|
|
|
" <td>2714</td>\n",
|
|
|
|
|
" <td>349</td>\n",
|
|
|
|
|
" <td>18</td>\n",
|
|
|
|
|
" <td>67</td>\n",
|
|
|
|
|
" <td>20</td>\n",
|
|
|
|
|
" <td>1599</td>\n",
|
|
|
|
|
" <td>184</td>\n",
|
|
|
|
|
" <td>207</td>\n",
|
|
|
|
|
" <td>160</td>\n",
|
|
|
|
|
" <td>3234</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>10 rows × 55 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Elevation Aspect Slope Horizontal_Distance_To_Hydrology \\\n",
|
|
|
|
|
"318054 2517 271 12 272 \n",
|
|
|
|
|
"30504 2959 0 1 180 \n",
|
|
|
|
|
"349520 3093 54 19 42 \n",
|
|
|
|
|
"365645 2502 330 17 150 \n",
|
|
|
|
|
"131114 2962 4 13 95 \n",
|
|
|
|
|
"385769 3181 119 5 170 \n",
|
|
|
|
|
"161626 2950 270 4 108 \n",
|
|
|
|
|
"394880 3051 155 22 390 \n",
|
|
|
|
|
"389492 3024 191 16 785 \n",
|
|
|
|
|
"52507 2714 349 18 67 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Vertical_Distance_To_Hydrology Horizontal_Distance_To_Roadways \\\n",
|
|
|
|
|
"318054 84 484 \n",
|
|
|
|
|
"30504 20 5960 \n",
|
|
|
|
|
"349520 -3 797 \n",
|
|
|
|
|
"365645 52 738 \n",
|
|
|
|
|
"131114 7 4270 \n",
|
|
|
|
|
"385769 -1 2416 \n",
|
|
|
|
|
"161626 15 2053 \n",
|
|
|
|
|
"394880 70 1871 \n",
|
|
|
|
|
"389492 110 3000 \n",
|
|
|
|
|
"52507 20 1599 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Hillshade_9am Hillshade_Noon Hillshade_3pm \\\n",
|
|
|
|
|
"318054 189 244 193 \n",
|
|
|
|
|
"30504 217 236 156 \n",
|
|
|
|
|
"349520 227 196 94 \n",
|
|
|
|
|
"365645 177 216 178 \n",
|
|
|
|
|
"131114 202 214 148 \n",
|
|
|
|
|
"385769 228 235 141 \n",
|
|
|
|
|
"161626 210 241 170 \n",
|
|
|
|
|
"394880 239 236 114 \n",
|
|
|
|
|
"389492 218 251 162 \n",
|
|
|
|
|
"52507 184 207 160 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Horizontal_Distance_To_Fire_Points ... Soil_Type32 Soil_Type33 \\\n",
|
|
|
|
|
"318054 162 ... 0 0 \n",
|
|
|
|
|
"30504 3960 ... 0 0 \n",
|
|
|
|
|
"349520 1318 ... 0 0 \n",
|
|
|
|
|
"365645 510 ... 0 0 \n",
|
|
|
|
|
"131114 1999 ... 0 0 \n",
|
|
|
|
|
"385769 999 ... 0 0 \n",
|
|
|
|
|
"161626 2037 ... 0 0 \n",
|
|
|
|
|
"394880 1510 ... 0 0 \n",
|
|
|
|
|
"389492 1961 ... 0 1 \n",
|
|
|
|
|
"52507 3234 ... 0 0 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Soil_Type34 Soil_Type35 Soil_Type36 Soil_Type37 Soil_Type38 \\\n",
|
|
|
|
|
"318054 0 0 0 0 0 \n",
|
|
|
|
|
"30504 0 0 0 0 0 \n",
|
|
|
|
|
"349520 0 0 0 0 0 \n",
|
|
|
|
|
"365645 0 0 0 0 0 \n",
|
|
|
|
|
"131114 0 0 0 0 0 \n",
|
|
|
|
|
"385769 0 0 0 0 0 \n",
|
|
|
|
|
"161626 0 0 0 0 0 \n",
|
|
|
|
|
"394880 0 0 0 0 0 \n",
|
|
|
|
|
"389492 0 0 0 0 0 \n",
|
|
|
|
|
"52507 0 0 0 0 0 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Soil_Type39 Soil_Type40 Cover_Type \n",
|
|
|
|
|
"318054 0 0 2 \n",
|
|
|
|
|
"30504 0 0 2 \n",
|
|
|
|
|
"349520 0 0 1 \n",
|
|
|
|
|
"365645 0 0 6 \n",
|
|
|
|
|
"131114 0 0 2 \n",
|
|
|
|
|
"385769 0 0 1 \n",
|
|
|
|
|
"161626 0 0 2 \n",
|
|
|
|
|
"394880 0 0 1 \n",
|
|
|
|
|
"389492 0 0 2 \n",
|
|
|
|
|
"52507 0 0 2 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[10 rows x 55 columns]"
|
|
|
|
|
]
|
2024-03-17 18:28:15 +01:00
|
|
|
|
},
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 30,
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"data = pd.read_csv(\"covtype.csv\")\n",
|
|
|
|
|
"data = data.sample(frac = 1)\n",
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"data.head(10)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Podział na podzbiory"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 4,
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:38:53.929532900Z",
|
|
|
|
|
"start_time": "2024-03-17T17:38:51.607851900Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"from sklearn.model_selection import train_test_split\n",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"forest_train, forest_test = train_test_split(data, test_size=0.2, random_state=1)\n",
|
|
|
|
|
"forest_train, forest_val = train_test_split(forest_train, test_size=0.25, random_state=1)"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"<h4>Statystyki</h4>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"Wielkości zbiorów"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 5,
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:38:58.202546800Z",
|
|
|
|
|
"start_time": "2024-03-17T17:38:58.143643600Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"wielkość zbioru: (581012, 55)\n",
|
|
|
|
|
"wielkość zbioru treningowego: (348606, 55)\n",
|
|
|
|
|
"wielkość zbioru testującego: (116203, 55)\n",
|
|
|
|
|
"wielkość zbioru walidacyjnego: (116203, 55)\n"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"print(f'wielkość zbioru: {data.shape}')\n",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"print(f'wielkość zbioru treningowego: {forest_train.shape}')\n",
|
|
|
|
|
"print(f'wielkość zbioru testującego: {forest_test.shape}')\n",
|
|
|
|
|
"print(f'wielkość zbioru walidacyjnego: {forest_val.shape}')"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"execution_count": 9,
|
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:39:01.338802400Z",
|
|
|
|
|
"start_time": "2024-03-17T17:39:01.252677700Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
|
|
|
|
"<class 'pandas.core.frame.DataFrame'>\n",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"RangeIndex: 581012 entries, 0 to 581011\n",
|
|
|
|
|
"Data columns (total 55 columns):\n",
|
|
|
|
|
" # Column Non-Null Count Dtype\n",
|
|
|
|
|
"--- ------ -------------- -----\n",
|
|
|
|
|
" 0 Elevation 581012 non-null int64\n",
|
|
|
|
|
" 1 Aspect 581012 non-null int64\n",
|
|
|
|
|
" 2 Slope 581012 non-null int64\n",
|
|
|
|
|
" 3 Horizontal_Distance_To_Hydrology 581012 non-null int64\n",
|
|
|
|
|
" 4 Vertical_Distance_To_Hydrology 581012 non-null int64\n",
|
|
|
|
|
" 5 Horizontal_Distance_To_Roadways 581012 non-null int64\n",
|
|
|
|
|
" 6 Hillshade_9am 581012 non-null int64\n",
|
|
|
|
|
" 7 Hillshade_Noon 581012 non-null int64\n",
|
|
|
|
|
" 8 Hillshade_3pm 581012 non-null int64\n",
|
|
|
|
|
" 9 Horizontal_Distance_To_Fire_Points 581012 non-null int64\n",
|
|
|
|
|
" 10 Wilderness_Area1 581012 non-null int64\n",
|
|
|
|
|
" 11 Wilderness_Area2 581012 non-null int64\n",
|
|
|
|
|
" 12 Wilderness_Area3 581012 non-null int64\n",
|
|
|
|
|
" 13 Wilderness_Area4 581012 non-null int64\n",
|
|
|
|
|
" 14 Soil_Type1 581012 non-null int64\n",
|
|
|
|
|
" 15 Soil_Type2 581012 non-null int64\n",
|
|
|
|
|
" 16 Soil_Type3 581012 non-null int64\n",
|
|
|
|
|
" 17 Soil_Type4 581012 non-null int64\n",
|
|
|
|
|
" 18 Soil_Type5 581012 non-null int64\n",
|
|
|
|
|
" 19 Soil_Type6 581012 non-null int64\n",
|
|
|
|
|
" 20 Soil_Type7 581012 non-null int64\n",
|
|
|
|
|
" 21 Soil_Type8 581012 non-null int64\n",
|
|
|
|
|
" 22 Soil_Type9 581012 non-null int64\n",
|
|
|
|
|
" 23 Soil_Type10 581012 non-null int64\n",
|
|
|
|
|
" 24 Soil_Type11 581012 non-null int64\n",
|
|
|
|
|
" 25 Soil_Type12 581012 non-null int64\n",
|
|
|
|
|
" 26 Soil_Type13 581012 non-null int64\n",
|
|
|
|
|
" 27 Soil_Type14 581012 non-null int64\n",
|
|
|
|
|
" 28 Soil_Type15 581012 non-null int64\n",
|
|
|
|
|
" 29 Soil_Type16 581012 non-null int64\n",
|
|
|
|
|
" 30 Soil_Type17 581012 non-null int64\n",
|
|
|
|
|
" 31 Soil_Type18 581012 non-null int64\n",
|
|
|
|
|
" 32 Soil_Type19 581012 non-null int64\n",
|
|
|
|
|
" 33 Soil_Type20 581012 non-null int64\n",
|
|
|
|
|
" 34 Soil_Type21 581012 non-null int64\n",
|
|
|
|
|
" 35 Soil_Type22 581012 non-null int64\n",
|
|
|
|
|
" 36 Soil_Type23 581012 non-null int64\n",
|
|
|
|
|
" 37 Soil_Type24 581012 non-null int64\n",
|
|
|
|
|
" 38 Soil_Type25 581012 non-null int64\n",
|
|
|
|
|
" 39 Soil_Type26 581012 non-null int64\n",
|
|
|
|
|
" 40 Soil_Type27 581012 non-null int64\n",
|
|
|
|
|
" 41 Soil_Type28 581012 non-null int64\n",
|
|
|
|
|
" 42 Soil_Type29 581012 non-null int64\n",
|
|
|
|
|
" 43 Soil_Type30 581012 non-null int64\n",
|
|
|
|
|
" 44 Soil_Type31 581012 non-null int64\n",
|
|
|
|
|
" 45 Soil_Type32 581012 non-null int64\n",
|
|
|
|
|
" 46 Soil_Type33 581012 non-null int64\n",
|
|
|
|
|
" 47 Soil_Type34 581012 non-null int64\n",
|
|
|
|
|
" 48 Soil_Type35 581012 non-null int64\n",
|
|
|
|
|
" 49 Soil_Type36 581012 non-null int64\n",
|
|
|
|
|
" 50 Soil_Type37 581012 non-null int64\n",
|
|
|
|
|
" 51 Soil_Type38 581012 non-null int64\n",
|
|
|
|
|
" 52 Soil_Type39 581012 non-null int64\n",
|
|
|
|
|
" 53 Soil_Type40 581012 non-null int64\n",
|
|
|
|
|
" 54 Cover_Type 581012 non-null int64\n",
|
|
|
|
|
"dtypes: int64(55)\n",
|
|
|
|
|
"memory usage: 243.8 MB\n"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"data.info()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"Nachylenie\n",
|
|
|
|
|
"\n"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"execution_count": 10,
|
|
|
|
|
"metadata": {
|
|
|
|
|
"ExecuteTime": {
|
|
|
|
|
"end_time": "2024-03-17T17:39:04.561664800Z",
|
|
|
|
|
"start_time": "2024-03-17T17:39:04.530325200Z"
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"Średnie nachylenie: 14.103703537964792\n",
|
|
|
|
|
"Maksymalne nachylenie: 66\n",
|
|
|
|
|
"Minimalne nachylenie: 0\n"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"print(f'Średnie nachylenie: {data[\"Slope\"].mean()}')\n",
|
|
|
|
|
"print(f'Maksymalne nachylenie: {data[\"Slope\"].max()}')\n",
|
|
|
|
|
"print(f'Minimalne nachylenie: {data[\"Slope\"].min()}')"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-03-17 18:42:28 +01:00
|
|
|
|
"execution_count": 12,
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAACWwAAA9nCAYAAABopOliAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzde5SWZb038O8wDDMcnEFEBgwGMZXExGPl5I7MEyqalaVliVnKxmOJlds0M32RDlvNElHezDRlu9V0l4fyDJiipkmedplmoAmYpxlBGGBm3j9czMsEjCjPPA8wn89az+I+/O77+t3DtGzdfJ/rKmttbW0NAAAAAAAAAAAAna5bqRsAAAAAAAAAAADoKgS2AAAAAAAAAAAAikRgCwAAAAAAAAAAoEgEtgAAAAAAAAAAAIpEYAsAAAAAAAAAAKBIBLYAAAAAAAAAAACKRGALAAAAAAAAAACgSAS2AAAAAAAAAAAAikRgCwAAAAAAAAAAoEgEtgCADdKee+6ZsrKy7LnnnqVuZb3hZwIAAAAAAADrP4EtAKDopk+fnrKysnf1+frXv17qtgEAAACAApoxY0a7d4APPPBAqVsCACgKgS0AgPXYl7/85ZSVlWXLLbcsdSsAAAAAUFBXXnllu/2rrrqqRJ1sWFYE3M4+++xStwIAvEfdS90AANC1HXfccTn++OPfsa5///5F6GbDNn369FK3AAAAAABrZfHixbnhhhuSJH369MnChQtz3XXX5aKLLkplZWWJuwMA6FwCWwBASQ0YMCAf/OAHS90GAAAAAFBEN910U958880kyU9+8pN85Stfyeuvv56bb745n/3sZ0vcHQBA57IkIgAAAAAAAFBUK5Y/HDlyZI4++ugMHz683XEAgI2ZwBYAsFGbP39+zjjjjOy2227p169fKisrM2TIkBx22GG56667VnvNV77ylZSVlaVnz55t3/LryPDhw1NWVpYPf/jD7Y63tLTknnvuyTe+8Y3sscce6d+/fyoqKtK3b9/stNNO+cY3vpG5c+eu9p5nn312ysrKcuWVVyZJ5syZk7KyslU+K9tzzz1TVlaWPffcs8N+f//73+fII4/MlltumaqqqvTt2zc777xzzjzzzPzzn/9c43XTp09vG3fF8ovXXXdd9t5772y++ebp2bNnhg8fnm9961t57bXX3uGnBgAAAEBXNW/evLZ3c1/60pfa/fm73/2uw3dUSfLSSy/lP/7jP7LLLrukpqYmFRUVqa2tzQ477JAvfOEL+cUvfpHGxsZVrlvxbuvss89Oktx111355Cc/mUGDBqWqqipbbbVVTjzxxPzjH/9Yq+f44x//mPHjx2f48OHp06dPevfuneHDh+e4447LM888s1b3ePLJJ3PSSSdlhx12yKabbpqKiooMHDgw++yzT374wx9m3rx5bbVbbrllu3eC3/ve91Z5X/jlL395rcYFAEpLYAsA2Ghdc8012XrrrXPeeefl0Ucfzeuvv56lS5fmxRdfzPXXX5999903xxxzTJYvX97uui9+8YtJkiVLluTGG2/scIxHHnmk7eXLiutWOOecc7L33nvn/PPPzwMPPJBXX301y5cvT0NDQ/70pz/l/PPPz3bbbZebbrqpgE+9Zi0tLTnxxBPzsY99LFdffXXmzJmTpqamNDQ0ZPbs2Zk4cWK22Wab3HnnnWt1ryOPPDKHH3547rnnnrzyyitZsmRJnnnmmfzoRz/KRz7ykcyfP78ITwUAAADAhuaaa65Jc3NzunXrliOOOCLJ2+/WysrKsmzZsvzXf/3XGq+97777st122+UHP/hBHnvssTQ2Nmb58uV5+eWX8+STT+baa6/N0UcfnZkzZ3bYw/e+973su+++ufnmmzN//vw0NTXl+eefz+TJk7P99tvnvvvuW+O1LS0tmTBhQnbbbbdcdtlleeaZZ7Jo0aK89dZbeeaZZ3LppZdm++23z9SpU9d4j+bm5kyYMCEjR47MxRdfnCeffDJvvPFGli9fngULFuTuu+/OaaedltNPP/0dfpoAwIaoe6kbAADoDNddd12OPPLItLa2tn0zbsSIEdl8883z97//PZdffnluu+22XH755amurs4FF1zQdu0nPvGJbLHFFnnppZdyzTXX5KijjlrjONOmTUuSlJeX5/Of/3y7c8uXL8+gQYPy6U9/OvX19dlqq61SVVWVF154IQ888EAuueSSLFy4MEcccUT++Mc/Zrvttmu79vjjj89nP/vZnHnmmfn1r3+dLbbYIrfffvs6/Uz+4z/+I5MnT06SDBs2LKeddlp22WWXLFq0KL/5zW9y8cUXp6GhIQcddFAefvjh7Ljjjmu813e+85088MAD+dSnPpWxY8dm6NChWbBgQSZPnpxbb701zz77bE455ZQOX64BAAAA0DX98pe/TPL2jPHve9/7krz9vuqjH/1o7r///lx11VU5+eSTV7muqakpn//859PY2JhNNtkkxx13XD7xiU9kwIABWbp0aZ5//vk88MAD7/gFyVtvvTWPPPJI22zxI0eOTENDQ66//vr83//7f9vekT355JMZMmTIKtefdNJJueSSS5Iko0aNype//OVstdVW6dWrV/70pz/lxz/+cZ566qn8+7//ewYOHJhPfvKTq9xj3Lhx+fnPf54kGTRoUE488cR89KMfTU1NTf75z3/m4Ycfzg033NDumjvuuCNLly7NDjvskCQ57rjjcvzxx7er2XTTTTt8dgBg/VDW2traWuomAICuZfr06fnEJz6RZPUvFVZn+PDhqaioaNvfc889M2PGjHz84x9vW55vhVdeeSVbb711Ghoa8pWvfCWXXXZZundfNad+xhln5Lzzzku3bt3y9NNPZ/jw4W3nTj311FxwwQUpLy/PP/7xj9TW1q5yfUtLS4YMGZKXXnop++233yqBqr///e953/ve167vlb344ovZfffd849//CNf+tKX2l5UrezLX/5yrrzyygwdOjR///vfO/oRdfgzeeKJJ7LTTjulpaUlH/zgB3Pfffelb9++7Wp+97vfZcyYMWlpacmHP/zhPPTQQ+3Or/z3liT/5//8n5xxxhntalpbW7P//vvnjjvuSPfu3fPSSy9l880377BvAAAAALqO2bNnZ+edd06S/PznP8/RRx/ddu7SSy/NcccdlyR56qmnMmLEiHbX3nPPPdl7772TJDfffHMOOuig1Y6xfPnyvPXWW6murm53fOXlBHfZZZfMmDEjffr0aVfzy1/+MmPHjk2SfO5zn8t1113X7vydd96Z/fbbL0nys5/9LF/96ldXGX/JkiUZM2ZM7rnnngwdOjTPPvtsu/eTv/nNb3LIIYckSerr63Pbbbet8q5uhRdeeGGV0NiK5/jud7/btrwjALBhsSQiAFBSU6ZMyQ477PCOn3/84x/v6p4NDQ153/vel0suuWS1Ya3k7WnP3/e+96WlpSVXXXVVu3Mrljdsbm7Otddeu9rr77333rz00kvt6le25ZZbrjGslSSDBw/ON7/5zSRvv6TpzBz9lClT0tLSkuTtF0mrewG0//775ytf+UqS5OGHH84f/vCHNd5v1113zbe//e1VjpeVlWXChAlJ3n4xNmvWrAJ0DwAAAMDGYsV7uJ49e+bQQw9td+6www5Ljx492tWtbP78+W3bo0aNWuMY3bt3XyWs9a+mTp26SlgrSY488sgccMABSZKbbrqp3ZhJ8v3vfz9Jcuihh642rJUkVVVVufjii5Mkc+bMyb333rvae/Tq1Ss33HDDGsNaSVY7wxcAsOET2AIANjq/+c1vkiQHHXRQKisr11jXvXv31NfXJ8kqwaJddtklH/jAB5L8/2UP/9WK4z179synP/3pd+yrsbExzz//fJ566qk8+eSTefLJJ9OrV6925zrLXXfdlSTZfvvt85GPfGSNdccee+wq16zOEUcc0e4biSvbdddd27b/9re/vdtWAQAAANhILV++vO2d2sEHH7xKqKpfv3458MADkyTXXHNN2xcQVxg0aFDb9hVXXPGe+9hhhx3avcP6Vyu+1Lh8+fJ2M9k3Nja27X/2s5/tcIztttsu/fv3T9L
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"<Figure size 3000x5000 with 10 Axes>"
|
|
|
|
|
]
|
2024-03-17 18:28:15 +01:00
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"import seaborn as sns\n",
|
|
|
|
|
"features = data.loc[:,'Elevation':'Horizontal_Distance_To_Fire_Points']\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"plt.figure(figsize=(30, 50))\n",
|
|
|
|
|
"for i,col in enumerate(features.columns.values):\n",
|
|
|
|
|
" plt.subplot(5,2,i+1)\n",
|
|
|
|
|
" sns.boxplot(x=data['Cover_Type'], y=col, data=data)\n",
|
|
|
|
|
" plt.title(col, fontsize=20)\n",
|
|
|
|
|
" \n",
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"plt.show()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"Normalizacja"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 31,
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"text/html": [
|
|
|
|
|
"<div>\n",
|
|
|
|
|
"<style scoped>\n",
|
|
|
|
|
" .dataframe tbody tr th:only-of-type {\n",
|
|
|
|
|
" vertical-align: middle;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe tbody tr th {\n",
|
|
|
|
|
" vertical-align: top;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"\n",
|
|
|
|
|
" .dataframe thead th {\n",
|
|
|
|
|
" text-align: right;\n",
|
|
|
|
|
" }\n",
|
|
|
|
|
"</style>\n",
|
|
|
|
|
"<table border=\"1\" class=\"dataframe\">\n",
|
|
|
|
|
" <thead>\n",
|
|
|
|
|
" <tr style=\"text-align: right;\">\n",
|
|
|
|
|
" <th></th>\n",
|
|
|
|
|
" <th>Elevation</th>\n",
|
|
|
|
|
" <th>Aspect</th>\n",
|
|
|
|
|
" <th>Slope</th>\n",
|
|
|
|
|
" <th>Horizontal_Distance_To_Hydrology</th>\n",
|
|
|
|
|
" <th>Vertical_Distance_To_Hydrology</th>\n",
|
|
|
|
|
" <th>Horizontal_Distance_To_Roadways</th>\n",
|
|
|
|
|
" <th>Hillshade_9am</th>\n",
|
|
|
|
|
" <th>Hillshade_Noon</th>\n",
|
|
|
|
|
" <th>Hillshade_3pm</th>\n",
|
|
|
|
|
" <th>Horizontal_Distance_To_Fire_Points</th>\n",
|
|
|
|
|
" <th>...</th>\n",
|
|
|
|
|
" <th>Soil_Type32</th>\n",
|
|
|
|
|
" <th>Soil_Type33</th>\n",
|
|
|
|
|
" <th>Soil_Type34</th>\n",
|
|
|
|
|
" <th>Soil_Type35</th>\n",
|
|
|
|
|
" <th>Soil_Type36</th>\n",
|
|
|
|
|
" <th>Soil_Type37</th>\n",
|
|
|
|
|
" <th>Soil_Type38</th>\n",
|
|
|
|
|
" <th>Soil_Type39</th>\n",
|
|
|
|
|
" <th>Soil_Type40</th>\n",
|
|
|
|
|
" <th>Cover_Type</th>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </thead>\n",
|
|
|
|
|
" <tbody>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>318054</th>\n",
|
|
|
|
|
" <td>-1.579964</td>\n",
|
|
|
|
|
" <td>1.030645</td>\n",
|
|
|
|
|
" <td>-0.280934</td>\n",
|
|
|
|
|
" <td>0.012100</td>\n",
|
|
|
|
|
" <td>0.644670</td>\n",
|
|
|
|
|
" <td>-1.196821</td>\n",
|
|
|
|
|
" <td>-0.864631</td>\n",
|
|
|
|
|
" <td>1.046164</td>\n",
|
|
|
|
|
" <td>1.318678</td>\n",
|
|
|
|
|
" <td>-1.373130</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>30504</th>\n",
|
|
|
|
|
" <td>-0.001305</td>\n",
|
|
|
|
|
" <td>-1.390866</td>\n",
|
|
|
|
|
" <td>-1.749905</td>\n",
|
|
|
|
|
" <td>-0.420741</td>\n",
|
|
|
|
|
" <td>-0.453191</td>\n",
|
|
|
|
|
" <td>2.315116</td>\n",
|
|
|
|
|
" <td>0.181321</td>\n",
|
|
|
|
|
" <td>0.641484</td>\n",
|
|
|
|
|
" <td>0.351977</td>\n",
|
|
|
|
|
" <td>1.495029</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>349520</th>\n",
|
|
|
|
|
" <td>0.477293</td>\n",
|
|
|
|
|
" <td>-0.908351</td>\n",
|
|
|
|
|
" <td>0.653865</td>\n",
|
|
|
|
|
" <td>-1.070003</td>\n",
|
|
|
|
|
" <td>-0.847735</td>\n",
|
|
|
|
|
" <td>-0.996083</td>\n",
|
|
|
|
|
" <td>0.554876</td>\n",
|
|
|
|
|
" <td>-1.381919</td>\n",
|
|
|
|
|
" <td>-1.267901</td>\n",
|
|
|
|
|
" <td>-0.500147</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>365645</th>\n",
|
|
|
|
|
" <td>-1.633538</td>\n",
|
|
|
|
|
" <td>1.557837</td>\n",
|
|
|
|
|
" <td>0.386780</td>\n",
|
|
|
|
|
" <td>-0.561885</td>\n",
|
|
|
|
|
" <td>0.095739</td>\n",
|
|
|
|
|
" <td>-1.033922</td>\n",
|
|
|
|
|
" <td>-1.312896</td>\n",
|
|
|
|
|
" <td>-0.370218</td>\n",
|
|
|
|
|
" <td>0.926772</td>\n",
|
|
|
|
|
" <td>-1.110329</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>6</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>131114</th>\n",
|
|
|
|
|
" <td>0.009410</td>\n",
|
|
|
|
|
" <td>-1.355124</td>\n",
|
|
|
|
|
" <td>-0.147392</td>\n",
|
|
|
|
|
" <td>-0.820649</td>\n",
|
|
|
|
|
" <td>-0.676194</td>\n",
|
|
|
|
|
" <td>1.231264</td>\n",
|
|
|
|
|
" <td>-0.379010</td>\n",
|
|
|
|
|
" <td>-0.471388</td>\n",
|
|
|
|
|
" <td>0.142960</td>\n",
|
|
|
|
|
" <td>0.014128</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>385769</th>\n",
|
|
|
|
|
" <td>0.791596</td>\n",
|
|
|
|
|
" <td>-0.327546</td>\n",
|
|
|
|
|
" <td>-1.215734</td>\n",
|
|
|
|
|
" <td>-0.467789</td>\n",
|
|
|
|
|
" <td>-0.813427</td>\n",
|
|
|
|
|
" <td>0.042234</td>\n",
|
|
|
|
|
" <td>0.592231</td>\n",
|
|
|
|
|
" <td>0.590899</td>\n",
|
|
|
|
|
" <td>-0.039929</td>\n",
|
|
|
|
|
" <td>-0.741048</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>161626</th>\n",
|
|
|
|
|
" <td>-0.033449</td>\n",
|
|
|
|
|
" <td>1.021709</td>\n",
|
|
|
|
|
" <td>-1.349277</td>\n",
|
|
|
|
|
" <td>-0.759486</td>\n",
|
|
|
|
|
" <td>-0.538961</td>\n",
|
|
|
|
|
" <td>-0.190570</td>\n",
|
|
|
|
|
" <td>-0.080167</td>\n",
|
|
|
|
|
" <td>0.894409</td>\n",
|
|
|
|
|
" <td>0.717756</td>\n",
|
|
|
|
|
" <td>0.042825</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>394880</th>\n",
|
|
|
|
|
" <td>0.327285</td>\n",
|
|
|
|
|
" <td>-0.005869</td>\n",
|
|
|
|
|
" <td>1.054494</td>\n",
|
|
|
|
|
" <td>0.567265</td>\n",
|
|
|
|
|
" <td>0.404513</td>\n",
|
|
|
|
|
" <td>-0.307292</td>\n",
|
|
|
|
|
" <td>1.003141</td>\n",
|
|
|
|
|
" <td>0.641484</td>\n",
|
|
|
|
|
" <td>-0.745360</td>\n",
|
|
|
|
|
" <td>-0.355153</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>389492</th>\n",
|
|
|
|
|
" <td>0.230851</td>\n",
|
|
|
|
|
" <td>0.315808</td>\n",
|
|
|
|
|
" <td>0.253237</td>\n",
|
|
|
|
|
" <td>2.425659</td>\n",
|
|
|
|
|
" <td>1.090676</td>\n",
|
|
|
|
|
" <td>0.416772</td>\n",
|
|
|
|
|
" <td>0.218677</td>\n",
|
|
|
|
|
" <td>1.400260</td>\n",
|
|
|
|
|
" <td>0.508739</td>\n",
|
|
|
|
|
" <td>-0.014568</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>1</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" <tr>\n",
|
|
|
|
|
" <th>52507</th>\n",
|
|
|
|
|
" <td>-0.876353</td>\n",
|
|
|
|
|
" <td>1.727611</td>\n",
|
|
|
|
|
" <td>0.520322</td>\n",
|
|
|
|
|
" <td>-0.952383</td>\n",
|
|
|
|
|
" <td>-0.453191</td>\n",
|
|
|
|
|
" <td>-0.481735</td>\n",
|
|
|
|
|
" <td>-1.051408</td>\n",
|
|
|
|
|
" <td>-0.825483</td>\n",
|
|
|
|
|
" <td>0.456485</td>\n",
|
|
|
|
|
" <td>0.946771</td>\n",
|
|
|
|
|
" <td>...</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>0</td>\n",
|
|
|
|
|
" <td>2</td>\n",
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
" </tbody>\n",
|
|
|
|
|
"</table>\n",
|
|
|
|
|
"<p>10 rows × 55 columns</p>\n",
|
|
|
|
|
"</div>"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
" Elevation Aspect Slope Horizontal_Distance_To_Hydrology \\\n",
|
|
|
|
|
"318054 -1.579964 1.030645 -0.280934 0.012100 \n",
|
|
|
|
|
"30504 -0.001305 -1.390866 -1.749905 -0.420741 \n",
|
|
|
|
|
"349520 0.477293 -0.908351 0.653865 -1.070003 \n",
|
|
|
|
|
"365645 -1.633538 1.557837 0.386780 -0.561885 \n",
|
|
|
|
|
"131114 0.009410 -1.355124 -0.147392 -0.820649 \n",
|
|
|
|
|
"385769 0.791596 -0.327546 -1.215734 -0.467789 \n",
|
|
|
|
|
"161626 -0.033449 1.021709 -1.349277 -0.759486 \n",
|
|
|
|
|
"394880 0.327285 -0.005869 1.054494 0.567265 \n",
|
|
|
|
|
"389492 0.230851 0.315808 0.253237 2.425659 \n",
|
|
|
|
|
"52507 -0.876353 1.727611 0.520322 -0.952383 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Vertical_Distance_To_Hydrology Horizontal_Distance_To_Roadways \\\n",
|
|
|
|
|
"318054 0.644670 -1.196821 \n",
|
|
|
|
|
"30504 -0.453191 2.315116 \n",
|
|
|
|
|
"349520 -0.847735 -0.996083 \n",
|
|
|
|
|
"365645 0.095739 -1.033922 \n",
|
|
|
|
|
"131114 -0.676194 1.231264 \n",
|
|
|
|
|
"385769 -0.813427 0.042234 \n",
|
|
|
|
|
"161626 -0.538961 -0.190570 \n",
|
|
|
|
|
"394880 0.404513 -0.307292 \n",
|
|
|
|
|
"389492 1.090676 0.416772 \n",
|
|
|
|
|
"52507 -0.453191 -0.481735 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Hillshade_9am Hillshade_Noon Hillshade_3pm \\\n",
|
|
|
|
|
"318054 -0.864631 1.046164 1.318678 \n",
|
|
|
|
|
"30504 0.181321 0.641484 0.351977 \n",
|
|
|
|
|
"349520 0.554876 -1.381919 -1.267901 \n",
|
|
|
|
|
"365645 -1.312896 -0.370218 0.926772 \n",
|
|
|
|
|
"131114 -0.379010 -0.471388 0.142960 \n",
|
|
|
|
|
"385769 0.592231 0.590899 -0.039929 \n",
|
|
|
|
|
"161626 -0.080167 0.894409 0.717756 \n",
|
|
|
|
|
"394880 1.003141 0.641484 -0.745360 \n",
|
|
|
|
|
"389492 0.218677 1.400260 0.508739 \n",
|
|
|
|
|
"52507 -1.051408 -0.825483 0.456485 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Horizontal_Distance_To_Fire_Points ... Soil_Type32 Soil_Type33 \\\n",
|
|
|
|
|
"318054 -1.373130 ... 0 0 \n",
|
|
|
|
|
"30504 1.495029 ... 0 0 \n",
|
|
|
|
|
"349520 -0.500147 ... 0 0 \n",
|
|
|
|
|
"365645 -1.110329 ... 0 0 \n",
|
|
|
|
|
"131114 0.014128 ... 0 0 \n",
|
|
|
|
|
"385769 -0.741048 ... 0 0 \n",
|
|
|
|
|
"161626 0.042825 ... 0 0 \n",
|
|
|
|
|
"394880 -0.355153 ... 0 0 \n",
|
|
|
|
|
"389492 -0.014568 ... 0 1 \n",
|
|
|
|
|
"52507 0.946771 ... 0 0 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Soil_Type34 Soil_Type35 Soil_Type36 Soil_Type37 Soil_Type38 \\\n",
|
|
|
|
|
"318054 0 0 0 0 0 \n",
|
|
|
|
|
"30504 0 0 0 0 0 \n",
|
|
|
|
|
"349520 0 0 0 0 0 \n",
|
|
|
|
|
"365645 0 0 0 0 0 \n",
|
|
|
|
|
"131114 0 0 0 0 0 \n",
|
|
|
|
|
"385769 0 0 0 0 0 \n",
|
|
|
|
|
"161626 0 0 0 0 0 \n",
|
|
|
|
|
"394880 0 0 0 0 0 \n",
|
|
|
|
|
"389492 0 0 0 0 0 \n",
|
|
|
|
|
"52507 0 0 0 0 0 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
" Soil_Type39 Soil_Type40 Cover_Type \n",
|
|
|
|
|
"318054 0 0 2 \n",
|
|
|
|
|
"30504 0 0 2 \n",
|
|
|
|
|
"349520 0 0 1 \n",
|
|
|
|
|
"365645 0 0 6 \n",
|
|
|
|
|
"131114 0 0 2 \n",
|
|
|
|
|
"385769 0 0 1 \n",
|
|
|
|
|
"161626 0 0 2 \n",
|
|
|
|
|
"394880 0 0 1 \n",
|
|
|
|
|
"389492 0 0 2 \n",
|
|
|
|
|
"52507 0 0 2 \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"[10 rows x 55 columns]"
|
|
|
|
|
]
|
2024-03-17 18:28:15 +01:00
|
|
|
|
},
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"execution_count": 31,
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"from sklearn.preprocessing import StandardScaler\n",
|
|
|
|
|
"scaler = StandardScaler()\n",
|
|
|
|
|
"\n",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"columns_to_normalize = data.columns[~data.columns.str.startswith('Soil_Type')]\n",
|
|
|
|
|
"columns_to_normalize = columns_to_normalize.to_list()\n",
|
|
|
|
|
"columns_to_normalize.remove('Cover_Type')\n",
|
|
|
|
|
"data[columns_to_normalize] = scaler.fit_transform(data[columns_to_normalize])\n",
|
2024-03-17 18:28:15 +01:00
|
|
|
|
"\n",
|
2024-04-13 17:39:48 +02:00
|
|
|
|
"data.head(10)"
|
2024-03-17 18:28:15 +01:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
|
"kernelspec": {
|
|
|
|
|
"display_name": "Python 3 (ipykernel)",
|
|
|
|
|
"language": "python",
|
|
|
|
|
"name": "python3"
|
|
|
|
|
},
|
|
|
|
|
"language_info": {
|
|
|
|
|
"codemirror_mode": {
|
|
|
|
|
"name": "ipython",
|
|
|
|
|
"version": 3
|
|
|
|
|
},
|
|
|
|
|
"file_extension": ".py",
|
|
|
|
|
"mimetype": "text/x-python",
|
|
|
|
|
"name": "python",
|
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
|
"version": "3.11.6"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|
"nbformat_minor": 4
|
|
|
|
|
}
|