{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": true, "pycharm": { "is_executing": true }, "ExecuteTime": { "end_time": "2024-04-13T16:07:39.757038200Z", "start_time": "2024-04-13T16:07:01.476848900Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: kaggle in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (1.6.6)\n", "Requirement already satisfied: six>=1.10 in c:\\software\\python3\\lib\\site-packages (from kaggle) (1.16.0)\n", "Requirement already satisfied: certifi in c:\\software\\python3\\lib\\site-packages (from kaggle) (2023.7.22)\n", "Requirement already satisfied: python-dateutil in c:\\software\\python3\\lib\\site-packages (from kaggle) (2.8.2)\n", "Requirement already satisfied: requests in c:\\software\\python3\\lib\\site-packages (from kaggle) (2.31.0)\n", "Requirement already satisfied: tqdm in c:\\software\\python3\\lib\\site-packages (from kaggle) (4.66.1)\n", "Requirement already satisfied: python-slugify in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from kaggle) (8.0.4)\n", "Requirement already satisfied: urllib3 in c:\\software\\python3\\lib\\site-packages (from kaggle) (1.26.16)\n", "Requirement already satisfied: bleach in c:\\software\\python3\\lib\\site-packages (from kaggle) (6.0.0)\n", "Requirement already satisfied: webencodings in c:\\software\\python3\\lib\\site-packages (from bleach->kaggle) (0.5.1)\n", "Requirement already satisfied: text-unidecode>=1.3 in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from python-slugify->kaggle) (1.3)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\software\\python3\\lib\\site-packages (from requests->kaggle) (3.2.0)\n", "Requirement already satisfied: idna<4,>=2.5 in c:\\software\\python3\\lib\\site-packages (from requests->kaggle) (3.4)\n", "Requirement already satisfied: colorama in c:\\software\\python3\\lib\\site-packages (from tqdm->kaggle) (0.4.6)\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "[notice] A new release of pip is available: 23.0.1 -> 24.0\n", "[notice] To update, run: python3.exe -m pip install --upgrade pip\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: pandas in c:\\software\\python3\\lib\\site-packages (2.0.3)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in c:\\software\\python3\\lib\\site-packages (from pandas) (2.8.2)\n", "Requirement already satisfied: pytz>=2020.1 in c:\\software\\python3\\lib\\site-packages (from pandas) (2023.3)\n", "Requirement already satisfied: tzdata>=2022.1 in c:\\software\\python3\\lib\\site-packages (from pandas) (2023.3)\n", "Requirement already satisfied: numpy>=1.21.0 in c:\\software\\python3\\lib\\site-packages (from pandas) (1.24.3)\n", "Requirement already satisfied: six>=1.5 in c:\\software\\python3\\lib\\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "[notice] A new release of pip is available: 23.0.1 -> 24.0\n", "[notice] To update, run: python3.exe -m pip install --upgrade pip\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: scikit-learn in c:\\software\\python3\\lib\\site-packages (1.3.0)\n", "Requirement already satisfied: numpy>=1.17.3 in c:\\software\\python3\\lib\\site-packages (from scikit-learn) (1.24.3)\n", "Requirement already satisfied: scipy>=1.5.0 in c:\\software\\python3\\lib\\site-packages (from scikit-learn) (1.11.2)\n", "Requirement already satisfied: joblib>=1.1.1 in c:\\software\\python3\\lib\\site-packages (from scikit-learn) (1.3.2)\n", "Requirement already satisfied: threadpoolctl>=2.0.0 in c:\\software\\python3\\lib\\site-packages (from scikit-learn) (3.2.0)\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "[notice] A new release of pip is available: 23.0.1 -> 24.0\n", "[notice] To update, run: python3.exe -m pip install --upgrade pip\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: matplotlib in c:\\software\\python3\\lib\\site-packages (3.7.2)\n", "Requirement already satisfied: contourpy>=1.0.1 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (1.1.0)\n", "Requirement already satisfied: cycler>=0.10 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (0.11.0)\n", "Requirement already satisfied: fonttools>=4.22.0 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (4.42.0)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (1.4.4)\n", "Requirement already satisfied: numpy>=1.20 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (1.24.3)\n", "Requirement already satisfied: packaging>=20.0 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (23.1)\n", "Requirement already satisfied: pillow>=6.2.0 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (10.0.0)\n", "Requirement already satisfied: pyparsing<3.1,>=2.3.1 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (3.0.9)\n", "Requirement already satisfied: python-dateutil>=2.7 in c:\\software\\python3\\lib\\site-packages (from matplotlib) (2.8.2)\n", "Requirement already satisfied: six>=1.5 in c:\\software\\python3\\lib\\site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "[notice] A new release of pip is available: 23.0.1 -> 24.0\n", "[notice] To update, run: python3.exe -m pip install --upgrade pip\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (0.14.3)\n", "Requirement already satisfied: fiona>=1.8.21 in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from geopandas) (1.9.6)\n", "Requirement already satisfied: packaging in c:\\software\\python3\\lib\\site-packages (from geopandas) (23.1)\n", "Requirement already satisfied: pandas>=1.4.0 in c:\\software\\python3\\lib\\site-packages (from geopandas) (2.0.3)\n", "Requirement already satisfied: pyproj>=3.3.0 in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from geopandas) (3.6.1)\n", "Requirement already satisfied: shapely>=1.8.0 in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from geopandas) (2.0.3)\n", "Requirement already satisfied: attrs>=19.2.0 in c:\\software\\python3\\lib\\site-packages (from fiona>=1.8.21->geopandas) (23.1.0)\n", "Requirement already satisfied: certifi in c:\\software\\python3\\lib\\site-packages (from fiona>=1.8.21->geopandas) (2023.7.22)\n", "Requirement already satisfied: click~=8.0 in c:\\software\\python3\\lib\\site-packages (from fiona>=1.8.21->geopandas) (8.1.7)\n", "Requirement already satisfied: click-plugins>=1.0 in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from fiona>=1.8.21->geopandas) (1.1.1)\n", "Requirement already satisfied: cligj>=0.5 in \\\\files\\students\\s464914\\.appdata\\python\\python310\\site-packages (from fiona>=1.8.21->geopandas) (0.7.2)\n", "Requirement already satisfied: six in c:\\software\\python3\\lib\\site-packages (from fiona>=1.8.21->geopandas) (1.16.0)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in c:\\software\\python3\\lib\\site-packages (from pandas>=1.4.0->geopandas) (2.8.2)\n", "Requirement already satisfied: pytz>=2020.1 in c:\\software\\python3\\lib\\site-packages (from pandas>=1.4.0->geopandas) (2023.3)\n", "Requirement already satisfied: tzdata>=2022.1 in c:\\software\\python3\\lib\\site-packages (from pandas>=1.4.0->geopandas) (2023.3)\n", "Requirement already satisfied: numpy>=1.21.0 in c:\\software\\python3\\lib\\site-packages (from pandas>=1.4.0->geopandas) (1.24.3)\n", "Requirement already satisfied: colorama in c:\\software\\python3\\lib\\site-packages (from click~=8.0->fiona>=1.8.21->geopandas) (0.4.6)\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "[notice] A new release of pip is available: 23.0.1 -> 24.0\n", "[notice] To update, run: python3.exe -m pip install --upgrade pip\n" ] } ], "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", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2024-03-17T17:38:40.019389600Z", "start_time": "2024-03-17T17:38:36.535384600Z" } }, "outputs": [], "source": [ "import matplotlib.pyplot as plt \n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "pycharm": { "is_executing": true }, "ExecuteTime": { "end_time": "2024-04-13T16:11:03.249257400Z", "start_time": "2024-04-13T16:10:58.745694100Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading forest-cover-type-dataset.zip to J:\\PycharmProjects\\ium_464914\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", " 0%| | 0.00/11.2M [00:00, ?B/s]\n", " 9%|8 | 1.00M/11.2M [00:00<00:06, 1.56MB/s]\n", " 18%|#7 | 2.00M/11.2M [00:00<00:03, 3.10MB/s]\n", " 36%|###5 | 4.00M/11.2M [00:00<00:01, 6.25MB/s]\n", " 54%|#####3 | 6.00M/11.2M [00:01<00:00, 9.19MB/s]\n", " 81%|######## | 9.00M/11.2M [00:01<00:00, 13.0MB/s]\n", "100%|##########| 11.2M/11.2M [00:01<00:00, 9.30MB/s]\n" ] } ], "source": [ "!kaggle datasets download -d uciml/forest-cover-type-dataset" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2024-04-13T16:11:41.214712500Z", "start_time": "2024-04-13T16:11:37.462860300Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Archive: forest-cover-type-dataset.zip\n", " inflating: covtype.csv \n" ] } ], "source": [ "!unzip -o forest-cover-type-dataset.zip " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " | Elevation | \n", "Aspect | \n", "Slope | \n", "Horizontal_Distance_To_Hydrology | \n", "Vertical_Distance_To_Hydrology | \n", "Horizontal_Distance_To_Roadways | \n", "Hillshade_9am | \n", "Hillshade_Noon | \n", "Hillshade_3pm | \n", "Horizontal_Distance_To_Fire_Points | \n", "... | \n", "Soil_Type32 | \n", "Soil_Type33 | \n", "Soil_Type34 | \n", "Soil_Type35 | \n", "Soil_Type36 | \n", "Soil_Type37 | \n", "Soil_Type38 | \n", "Soil_Type39 | \n", "Soil_Type40 | \n", "Cover_Type | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
318054 | \n", "2517 | \n", "271 | \n", "12 | \n", "272 | \n", "84 | \n", "484 | \n", "189 | \n", "244 | \n", "193 | \n", "162 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
30504 | \n", "2959 | \n", "0 | \n", "1 | \n", "180 | \n", "20 | \n", "5960 | \n", "217 | \n", "236 | \n", "156 | \n", "3960 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
349520 | \n", "3093 | \n", "54 | \n", "19 | \n", "42 | \n", "-3 | \n", "797 | \n", "227 | \n", "196 | \n", "94 | \n", "1318 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "
365645 | \n", "2502 | \n", "330 | \n", "17 | \n", "150 | \n", "52 | \n", "738 | \n", "177 | \n", "216 | \n", "178 | \n", "510 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "6 | \n", "
131114 | \n", "2962 | \n", "4 | \n", "13 | \n", "95 | \n", "7 | \n", "4270 | \n", "202 | \n", "214 | \n", "148 | \n", "1999 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
385769 | \n", "3181 | \n", "119 | \n", "5 | \n", "170 | \n", "-1 | \n", "2416 | \n", "228 | \n", "235 | \n", "141 | \n", "999 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "
161626 | \n", "2950 | \n", "270 | \n", "4 | \n", "108 | \n", "15 | \n", "2053 | \n", "210 | \n", "241 | \n", "170 | \n", "2037 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
394880 | \n", "3051 | \n", "155 | \n", "22 | \n", "390 | \n", "70 | \n", "1871 | \n", "239 | \n", "236 | \n", "114 | \n", "1510 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "
389492 | \n", "3024 | \n", "191 | \n", "16 | \n", "785 | \n", "110 | \n", "3000 | \n", "218 | \n", "251 | \n", "162 | \n", "1961 | \n", "... | \n", "0 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
52507 | \n", "2714 | \n", "349 | \n", "18 | \n", "67 | \n", "20 | \n", "1599 | \n", "184 | \n", "207 | \n", "160 | \n", "3234 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
10 rows × 55 columns
\n", "\n", " | Elevation | \n", "Aspect | \n", "Slope | \n", "Horizontal_Distance_To_Hydrology | \n", "Vertical_Distance_To_Hydrology | \n", "Horizontal_Distance_To_Roadways | \n", "Hillshade_9am | \n", "Hillshade_Noon | \n", "Hillshade_3pm | \n", "Horizontal_Distance_To_Fire_Points | \n", "... | \n", "Soil_Type32 | \n", "Soil_Type33 | \n", "Soil_Type34 | \n", "Soil_Type35 | \n", "Soil_Type36 | \n", "Soil_Type37 | \n", "Soil_Type38 | \n", "Soil_Type39 | \n", "Soil_Type40 | \n", "Cover_Type | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
318054 | \n", "-1.579964 | \n", "1.030645 | \n", "-0.280934 | \n", "0.012100 | \n", "0.644670 | \n", "-1.196821 | \n", "-0.864631 | \n", "1.046164 | \n", "1.318678 | \n", "-1.373130 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
30504 | \n", "-0.001305 | \n", "-1.390866 | \n", "-1.749905 | \n", "-0.420741 | \n", "-0.453191 | \n", "2.315116 | \n", "0.181321 | \n", "0.641484 | \n", "0.351977 | \n", "1.495029 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
349520 | \n", "0.477293 | \n", "-0.908351 | \n", "0.653865 | \n", "-1.070003 | \n", "-0.847735 | \n", "-0.996083 | \n", "0.554876 | \n", "-1.381919 | \n", "-1.267901 | \n", "-0.500147 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "
365645 | \n", "-1.633538 | \n", "1.557837 | \n", "0.386780 | \n", "-0.561885 | \n", "0.095739 | \n", "-1.033922 | \n", "-1.312896 | \n", "-0.370218 | \n", "0.926772 | \n", "-1.110329 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "6 | \n", "
131114 | \n", "0.009410 | \n", "-1.355124 | \n", "-0.147392 | \n", "-0.820649 | \n", "-0.676194 | \n", "1.231264 | \n", "-0.379010 | \n", "-0.471388 | \n", "0.142960 | \n", "0.014128 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
385769 | \n", "0.791596 | \n", "-0.327546 | \n", "-1.215734 | \n", "-0.467789 | \n", "-0.813427 | \n", "0.042234 | \n", "0.592231 | \n", "0.590899 | \n", "-0.039929 | \n", "-0.741048 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "
161626 | \n", "-0.033449 | \n", "1.021709 | \n", "-1.349277 | \n", "-0.759486 | \n", "-0.538961 | \n", "-0.190570 | \n", "-0.080167 | \n", "0.894409 | \n", "0.717756 | \n", "0.042825 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
394880 | \n", "0.327285 | \n", "-0.005869 | \n", "1.054494 | \n", "0.567265 | \n", "0.404513 | \n", "-0.307292 | \n", "1.003141 | \n", "0.641484 | \n", "-0.745360 | \n", "-0.355153 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "
389492 | \n", "0.230851 | \n", "0.315808 | \n", "0.253237 | \n", "2.425659 | \n", "1.090676 | \n", "0.416772 | \n", "0.218677 | \n", "1.400260 | \n", "0.508739 | \n", "-0.014568 | \n", "... | \n", "0 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
52507 | \n", "-0.876353 | \n", "1.727611 | \n", "0.520322 | \n", "-0.952383 | \n", "-0.453191 | \n", "-0.481735 | \n", "-1.051408 | \n", "-0.825483 | \n", "0.456485 | \n", "0.946771 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "2 | \n", "
10 rows × 55 columns
\n", "