1307 lines
1.1 MiB
Plaintext
1307 lines
1.1 MiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "84866313-54ac-4a76-8592-665fee1093e7",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Wykorzystanie indeksu wegetacji NDVI do klasyfikacji gatunków drzew\n",
|
||
|
"# Rafał Borkowski\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# Pochodzenie danych"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "f5d2dbe3-7a79-4080-950e-745e68833977",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Spis treści:\n",
|
||
|
"1. Pochodzenie źródła danych\n",
|
||
|
"2. Etap 0 - preprocesing i przygotowanie\n",
|
||
|
"3. Obliczanie indeksu NDVI\n",
|
||
|
"4. Przetwarzanie próbek na dane\n",
|
||
|
"5. Przykładowe dane\n",
|
||
|
"6. Import bibliotek i funkcji\n",
|
||
|
"7. Wartości histogramu"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "ccc658c7-d667-4543-b35c-9b9e0bef1957",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Pochodzenie źródła danych\n",
|
||
|
"\n",
|
||
|
"**Źródłem danych** są lotnicze zdjęcia spektralne wykonane w barwach widzialnych (RGB) oraz bliskiej podczerwieni (NIR) dostępne na [Geoportalu krajowym](https://mapy.geoportal.gov.pl/imap/Imgp_2.html?gpmap=gp0).\n",
|
||
|
"\n",
|
||
|
"**Obszarem zainteresowań** objęty jest zwarty obszar leśny Nadleśnictwa Doświadczalnego Zielonka [52º31' N, 17º4' E]( https://www.wspolrzedne.pl/?szer=52.531663485504446&dlug=17.076341745854453&zoom=12). \n",
|
||
|
"\n",
|
||
|
"# Etap 0 - preprocesing i przygotowanie\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"Po pobraniu zdjęcia lotnicze w formacie .tif zostały wczytane do programu [QGIS](https://qgis.org/en/site/) będącym otwartym oprogramowaniem geoinformacyjnym.\n",
|
||
|
"Korzystając z danych dotyczących drzewostanów, dostępnych na stronie [Banku Danych o Lasach](https://www.bdl.lasy.gov.pl/portal/) wytypowano zwarte, jednogatunkowe drzewostany sosny zwyczajnej (*Pinus sylvestris*) oraz dębu (*Quercus spp*). Wybrano drzewostany, których wiek jest zbliżony do średniego wieku dla danego gatunku wewnątrz kompleksu leśnego. \n",
|
||
|
"\n",
|
||
|
"**Dla dębu**:\n",
|
||
|
"- 153 lata,\n",
|
||
|
"- 158 lat,\n",
|
||
|
"- 159 lat.\n",
|
||
|
"\n",
|
||
|
"**Dla sosny**:\n",
|
||
|
"- 54 lata,\n",
|
||
|
"- 55 lat,\n",
|
||
|
"- 58 lat.\n",
|
||
|
"\n",
|
||
|
"Kolejnym krokiem było wykorzystanie wtyczki [QRectangleCreator](https://plugins.qgis.org/plugins/QRectangleCreator/) do generowania próbek drzew. Wtyczka ta umożliwia definiowanie predefiniowanych kształtów poligonów, w naszym przypadku kwadratów o wymiarach 2x2 metrów. Na podstawie oceny wizualnej, wyznaczono lokalizacje tych poligonów, które odpowiadały **koronom drzew** na zdjęciach spektralnych. Ze względu na rozmiar korony w przypadku dębu możliwe było wyznaczenie więcej, niż jednego poligonu z jednej korony drzewa. Ważne było pozyskanie próbki indeksu wegetacji NDVI.\n",
|
||
|
"\n",
|
||
|
"**Rycina 1** prezentuje koncept pozyskiwania danych."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"id": "2b21c434-512d-40e8-b264-39b09f83b95b",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxw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ynCHOvuwwnM1wKlzmJ+mkmU2wK99UTmQLpjP2SjMrkBHBKVxlghkxHd0EpRgrxSlRrBdiPx5NLDfH01MWWObEvVAGyrN0Yt/3JaHqdzHbX81ssw9LpIsXLhqCcTY4DlRxOnTPXFulP729jxvZ7x00ExLg/iXgb9NarFQ1B8mW88Yiiq2IxX7tsIyJWsQw5VgEuZopkkFpX3kGBcNEAGrW4TG89VAuAdKLkDJBTDgVVPCUChFISKJWRtlo9N9h6pP/HCGz9DooZQ6RgQF0CkaKipGPO6VATvfVKYyHVtgf6SZxpl1PFZ2f3e6QGJIECp7oyHVEErT8eOZo/6oT4QkiRhvGFh2dqgB89HJJqg/5gvdl0j0Da/frbb4QEdJKzBcV0pJopD6DCIEAVkJK9BRCDgkCVq9ORAAAO6nZ0pNlDitVwmGcHJ9PJTN9ZZIPRWJ8Blpp/fnjcL5fRoKpFjxx
|
||
|
"text/plain": [
|
||
|
"<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=569x569>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from IPython.display import display\n",
|
||
|
"from PIL import Image\n",
|
||
|
"\n",
|
||
|
"def show_image(image_path):\n",
|
||
|
" image = Image.open(image_path)\n",
|
||
|
" display(image)\n",
|
||
|
"\n",
|
||
|
"image_path = \"C:/python_zaliczenie/jpg/fig1.jpg\"\n",
|
||
|
"show_image(image_path)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "d8aae501-e209-466a-b7ce-39411c4c3cfc",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Na powyższej ilustracji widzimy fragment zdjęcia spektralnego w kompozycji barw umownych (**CIR**). Często wykorzystywaną techniką jest CIR (*Color Infrared*), gdzie roślinność przedstawiona jest w czerwieni. Dzięki zastosowaniu podczerwieni widoczne jest **zróżnicowanie gatunkowe**. Niebieskim prostokątem oznaczona została przykładowa korona dębu, zielonym prostokątem przykładowe korona sosny. Różowe prostokąty to poligony próbkujące, w tym przypadku fragmenty koron dębów. "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "096ae301-feea-4e5e-b969-9bfd36f5f82d",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Obliczanie indeksu NDVI\n",
|
||
|
"\n",
|
||
|
"Założeniem projektu była hipoteza twierdząca, że na podstawie indeksu wegetacji **NDVI** możliwe jest rozróznienie gatunków drzew. NDVI (*Normalized Difference Vegetation Index*), czyli znormalizowany indeks wegetacji to wskaźnik stosowany do oceny aktywności wegetacyjnej roślin na podstawie różnicy wchłaniania światła w obszarach podczerwieni i bliskiej podczerwieni. Jego wartości skorelowane są z zawartością chlorofilu. \n",
|
||
|
"\n",
|
||
|
"NDVI przyjmuje postać:\n",
|
||
|
"\n",
|
||
|
"NDVI = (NIR - RED) / (NIR + RED), gdzie\n",
|
||
|
"\n",
|
||
|
"NIR to wartość odbicia promieniowania w bliskiej podczerieni,\n",
|
||
|
"RED to wartość odbicia promieniowania w zakrsie czerwonym światła widzialnego.\n",
|
||
|
"\n",
|
||
|
"Wskaźnik NDVI przyjmuje wartości z zakresu -1 do 1."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "79ec3717-aa84-4b92-990f-887a9aba7bb8",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Przetwarzanie próbek na dane\n",
|
||
|
"\n",
|
||
|
"Przykład kodu, do pozyskiwania statystyk z przygotowanych próbek. Podajemy folder z próbkami poligonów NDVI oraz folder wynikowoy dla pliku CSV. \n",
|
||
|
"\n",
|
||
|
"Przeliczane są następujące wartości:\n",
|
||
|
"- liczba pixeli w poligonie,\n",
|
||
|
"- wartość minimalna,\n",
|
||
|
"- wartość maksymalna,\n",
|
||
|
"- wartość średnia,\n",
|
||
|
"- odchylenie standardowe.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "526e6625-5aa3-4810-b65f-f82d2ee875d4",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\"\"\"\n",
|
||
|
"import rasterio\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import glob\n",
|
||
|
"import numpy as np\n",
|
||
|
"import os\n",
|
||
|
"import time # Dodaj ten import!\n",
|
||
|
"\n",
|
||
|
"import tkinter as tk\n",
|
||
|
"from tkinter import filedialog\n",
|
||
|
"\n",
|
||
|
"def calculate_raster_statistics(input_folder, output_csv):\n",
|
||
|
" # Lista rastrów do przetworzenia\n",
|
||
|
" raster_list = glob.glob(os.path.join(input_folder, '*.tif'))\n",
|
||
|
"\n",
|
||
|
" # Tworzenie pustego dataframe'u do przechowywania wyników\n",
|
||
|
" results_df = pd.DataFrame()\n",
|
||
|
"\n",
|
||
|
" # Pętla przez rastry\n",
|
||
|
" start_time = time.time() # Początkowy czas\n",
|
||
|
" for raster_path in raster_list:\n",
|
||
|
" with rasterio.open(raster_path) as src:\n",
|
||
|
" raster = src.read(1)\n",
|
||
|
"\n",
|
||
|
" # Obliczanie statystyk\n",
|
||
|
" min_val = np.min(raster)\n",
|
||
|
" max_val = np.max(raster)\n",
|
||
|
" mean_val = np.mean(raster)\n",
|
||
|
" std_val = np.std(raster)\n",
|
||
|
" count_val = np.count_nonzero(~np.isnan(raster))\n",
|
||
|
"\n",
|
||
|
" # Tworzenie dataframe'u ze statystykami\n",
|
||
|
" df = pd.DataFrame({\n",
|
||
|
" 'Raster': [raster_path],\n",
|
||
|
" 'Count': [count_val],\n",
|
||
|
" 'Min': [min_val],\n",
|
||
|
" 'Max': [max_val],\n",
|
||
|
" 'Mean': [mean_val],\n",
|
||
|
" 'Std': [std_val]\n",
|
||
|
"\n",
|
||
|
" })\n",
|
||
|
"\n",
|
||
|
" # Łączenie wyniku z dataframe'em wyników\n",
|
||
|
" results_df = pd.concat([results_df, df])\n",
|
||
|
"\n",
|
||
|
" # Zapisanie wyników do pliku CSV\n",
|
||
|
" results_df.to_csv(output_csv, index=False)\n",
|
||
|
" elapsed_time = time.time() - start_time # Czas trwania obliczeń\n",
|
||
|
" print(f\"Wyniki zostały zapisane do: {output_csv}\")\n",
|
||
|
" print(f\"Czas trwania obliczeń: {elapsed_time:.2f} sekundy\")\n",
|
||
|
"\n",
|
||
|
"# Tworzymy GUI z pomocą tkinter\n",
|
||
|
"root = tk.Tk()\n",
|
||
|
"root.withdraw() # Ukrywamy główne okno, ponieważ nie potrzebujemy pełnej aplikacji GUI\n",
|
||
|
"\n",
|
||
|
"# Wybierz folder z rastrami\n",
|
||
|
"input_folder = filedialog.askdirectory(title=\"Wybierz folder z rastrami\")\n",
|
||
|
"\n",
|
||
|
"# Sprawdź, czy użytkownik wybrał folder\n",
|
||
|
"if not input_folder:\n",
|
||
|
" print(\"Anulowano wybór folderu z rastrami.\")\n",
|
||
|
"else:\n",
|
||
|
" # Wybierz ścieżkę do zapisu pliku CSV\n",
|
||
|
" output_csv = filedialog.asksaveasfilename(\n",
|
||
|
" title=\"Wybierz miejsce zapisu pliku CSV\",\n",
|
||
|
" defaultextension=\".csv\",\n",
|
||
|
" filetypes=[(\"CSV Files\", \"*.csv\")]\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" # Sprawdź, czy użytkownik wybrał miejsce zapisu\n",
|
||
|
" if not output_csv:\n",
|
||
|
" print(\"Anulowano wybór miejsca zapisu pliku CSV.\")\n",
|
||
|
" else:\n",
|
||
|
" # Wywołaj funkcję przetwarzania z wybranymi ścieżkami\n",
|
||
|
" calculate_raster_statistics(input_folder, output_csv\n",
|
||
|
"\"\"\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "d52eeac9-6e3a-4f73-a2a2-05f62f5cf555",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Przykładowe dane\n",
|
||
|
"\n",
|
||
|
"Wyjaśnienie danych:\n",
|
||
|
"- **id** - numer id każdej próbki\n",
|
||
|
"- **min** - minimalna wartość indeksu NDVI\n",
|
||
|
"- **max** - maksymalna wartość indeksu NDVI\n",
|
||
|
"- **mean** - średnia wartość indeksu NDVI\n",
|
||
|
"- **std** - odchylenie standardowe wartość indeksu NDVI\n",
|
||
|
"- **count** - liczba pixeli w poligonie\n",
|
||
|
"- **species** - gatunek drzewa\n",
|
||
|
"- **age** - wiek drzewostanu\n",
|
||
|
"- **tsl** - typ siedliskowy lasu; cecha lasu świadcząca o żyzności siedliska"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"id": "e1bc8a4f-9706-4203-9065-04399ccff8aa",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" id tree_id min max mean std count species \\\n",
|
||
|
"0 5640 0 0.238095 0.489933 0.352131 0.054493 156 DB \n",
|
||
|
"1 5641 1 0.203791 0.537415 0.421799 0.072868 156 DB \n",
|
||
|
"2 5642 10 0.210762 0.513889 0.427296 0.053479 144 DB \n",
|
||
|
"3 5643 100 0.362162 0.609023 0.531492 0.045743 169 DB \n",
|
||
|
"4 5644 1000 0.283019 0.570470 0.441266 0.069439 144 DB \n",
|
||
|
"... ... ... ... ... ... ... ... ... \n",
|
||
|
"5633 11273 95 0.300000 0.611940 0.460505 0.076445 156 DB \n",
|
||
|
"5634 11274 96 0.227273 0.594595 0.432737 0.073367 156 DB \n",
|
||
|
"5635 11275 97 0.252336 0.572414 0.436175 0.070488 144 DB \n",
|
||
|
"5636 11276 98 0.227907 0.594406 0.407233 0.073816 156 DB \n",
|
||
|
"5637 11277 99 0.285714 0.664122 0.482923 0.079463 156 DB \n",
|
||
|
"\n",
|
||
|
" age tsl \n",
|
||
|
"0 153 LSW \n",
|
||
|
"1 153 LSW \n",
|
||
|
"2 153 LSW \n",
|
||
|
"3 153 LSW \n",
|
||
|
"4 153 LSW \n",
|
||
|
"... ... ... \n",
|
||
|
"5633 158 LSW \n",
|
||
|
"5634 158 LSW \n",
|
||
|
"5635 158 LSW \n",
|
||
|
"5636 158 LSW \n",
|
||
|
"5637 158 LSW \n",
|
||
|
"\n",
|
||
|
"[5638 rows x 10 columns]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import pandas as pd\n",
|
||
|
"df = pd.read_csv(r\"C:\\python_zaliczenie\\CSV\\trees.csv\", delimiter=\";\")\n",
|
||
|
"print(df)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "928d16a7-d3d2-4055-9cfd-1ccd143c5dac",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Główne statystyki zbioru\n",
|
||
|
"\n",
|
||
|
"**Liczba obserwacji** = 5638\n",
|
||
|
"**Liczba kolumn** = 10\n",
|
||
|
"\n",
|
||
|
"**Liczba obserwacji w podziale na gatunek i wiek**\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"| species | age | liczba obserwacji |\n",
|
||
|
"|---------|-----|-------------------|\n",
|
||
|
"| DB | 153 | 1081 |\n",
|
||
|
"| DB | 158 | 893 |\n",
|
||
|
"| DB | 159 | 1026 |\n",
|
||
|
"| SO | 54 | 333 |\n",
|
||
|
"| SO | 55 | 1329 |\n",
|
||
|
"| SO | 58 | 976 |\n",
|
||
|
"-------------------------------------\n",
|
||
|
"\n",
|
||
|
"**Średnia wartość parametru NDVI dla zbioru** = **0.30291**\n",
|
||
|
"\n",
|
||
|
"**Średnia wartość parametru NDVI w podziele na gatunki:**\n",
|
||
|
"\n",
|
||
|
"**DB** = 0,424301\n",
|
||
|
"**SO** = 0,164860\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"0 976"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "71c8801d-e332-4f29-bc13-856d235984c3",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Średnia wartośćc parametru NDVI w podziale na gatunki i wiek\n",
|
||
|
"\n",
|
||
|
"| species | age | 54 | 55 | 58 | 153 | 158 | 159 |\n",
|
||
|
"|---------|-------|----------|----------|----------|----------|----------|----------|\n",
|
||
|
"| DB | | NaN | NaN | NaN | 0.429681 | 0.416908 | 0.425066 |\n",
|
||
|
"| SO | | 0.164 | 0.149983 | 0.185314 | NaN | NaN | NaN |\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "f3924c1d-15af-4422-8dc5-8c2c2f2e7883",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Analiza danych\n",
|
||
|
"# Import bibliotek i funkcji\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 12,
|
||
|
"id": "1337cbcf-4ff0-47ef-b17a-128029698a7a",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"#import bibliotek\n",
|
||
|
"\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import numpy as np\n",
|
||
|
"from pandas import Series, DataFrame\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from scipy.stats import shapiro\n",
|
||
|
"from scipy.stats import mannwhitneyu\n",
|
||
|
"from statsmodels.graphics.gofplots import qqplot\n",
|
||
|
"import seaborn as sns\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 43,
|
||
|
"id": "fccc77d0-a7ff-4fe7-83d3-806679a023b4",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"### import funkcji ###\n",
|
||
|
"# wczytywanie zboru danych do data frame'u\n",
|
||
|
"def read_csv_pandas(path_to_file):\n",
|
||
|
" df = pd.read_csv(path_to_file,sep=';')\n",
|
||
|
" return(df)\n",
|
||
|
"\n",
|
||
|
"# Tworzenie histogramu danych\n",
|
||
|
"def plot_histogram_all(df, colors):\n",
|
||
|
" grouped_df = df.groupby('species')\n",
|
||
|
"\n",
|
||
|
" for (species, group), color in zip(grouped_df, colors):\n",
|
||
|
" plt.hist(group['mean'], label=species, alpha=0.5, color=color, edgecolor='black')\n",
|
||
|
" mean_value = group['mean'].mean()\n",
|
||
|
" plt.axvline(mean_value, color='red', linestyle='dashed', linewidth=2, label=f'Mean ({species}): {mean_value:.2f}')\n",
|
||
|
"\n",
|
||
|
" plt.title('Histogram wartości średnich według gatunku')\n",
|
||
|
" plt.xlabel('Wartości średnie NDVI')\n",
|
||
|
" plt.ylabel('Częstotliwość')\n",
|
||
|
" plt.legend()\n",
|
||
|
"\n",
|
||
|
" plt.show()\n",
|
||
|
" \n",
|
||
|
"# Histogram danych z podziałem na gatunek\n",
|
||
|
"def plot_histogram(df, species, color):\n",
|
||
|
" df_species = df[df['species'] == species]\n",
|
||
|
"\n",
|
||
|
" # Tworzymy histogram z kolorem ramki wokół prostokątów\n",
|
||
|
" plt.hist(df_species['mean'], bins=40, label=species, alpha=0.5, edgecolor='black', color=color)\n",
|
||
|
"\n",
|
||
|
" # Dodajemy linię reprezentującą średnią wartość\n",
|
||
|
" mean_value = df_species['mean'].mean()\n",
|
||
|
" plt.axvline(mean_value, color='red', linestyle='dashed', linewidth=2, label=f'Mean: {mean_value:.2f}')\n",
|
||
|
"\n",
|
||
|
" # Ustawiamy etykiety osi\n",
|
||
|
" plt.xlabel('Mean Value')\n",
|
||
|
" plt.ylabel('Frequency')\n",
|
||
|
"\n",
|
||
|
" # Ustawiamy zakres osi x od minimum do maksimum danych\n",
|
||
|
" plt.xlim(df_species['mean'].min(), df_species['mean'].max())\n",
|
||
|
"\n",
|
||
|
" # Dodajemy legendę\n",
|
||
|
" plt.legend()\n",
|
||
|
"\n",
|
||
|
" # Dodajemy tytuł\n",
|
||
|
" plt.title(f'Histogram dla species=\\'{species}\\'')\n",
|
||
|
"\n",
|
||
|
" # Wyświetlamy histogram\n",
|
||
|
" plt.show()\n",
|
||
|
"\n",
|
||
|
"# Statystyki opisowe\n",
|
||
|
"def descriptive_statistics(data, species):\n",
|
||
|
" # Filtrujemy dane dla danego gatunku\n",
|
||
|
" data_species = data[data['species'] == species]['mean']\n",
|
||
|
"\n",
|
||
|
" # Miary pozycyjne\n",
|
||
|
" mean_value = data_species.mean()\n",
|
||
|
" median_value = data_species.median()\n",
|
||
|
" mode_value = data_species.mode().iloc[0] # Mode może mieć więcej niż jedną wartość, dlatego wybieramy pierwszą\n",
|
||
|
"\n",
|
||
|
" # Miary przeciętne\n",
|
||
|
" arithmetic_mean = data_species.mean()\n",
|
||
|
" harmonic_mean = 1 / (1 / data_species).mean()\n",
|
||
|
" geometric_mean = data_species.prod() ** (1 / len(data_species))\n",
|
||
|
"\n",
|
||
|
" # Miary zmienności klasyczne\n",
|
||
|
" variance_value = data_species.var()\n",
|
||
|
" std_deviation_value = data_species.std()\n",
|
||
|
"\n",
|
||
|
" # Miary pozycyjne dla zmiennych ilościowych\n",
|
||
|
" q1 = data_species.quantile(0.25)\n",
|
||
|
" q3 = data_species.quantile(0.75)\n",
|
||
|
" interquartile_range = q3 - q1\n",
|
||
|
"\n",
|
||
|
" # Wyświetlanie wyników\n",
|
||
|
" print(f\"Statystyki opisowe dla gatunku '{species}':\")\n",
|
||
|
" print(\"\\nMiary pozycyjne:\")\n",
|
||
|
" print(f\"Średnia arytmetyczna: {mean_value}\")\n",
|
||
|
" print(f\"Mediana: {median_value}\")\n",
|
||
|
" print(f\"Moda: {mode_value}\")\n",
|
||
|
"\n",
|
||
|
" print(\"\\nMiary przeciętne:\")\n",
|
||
|
" print(f\"Średnia arytmetyczna: {arithmetic_mean}\")\n",
|
||
|
" print(f\"Średnia harmoniczna: {harmonic_mean}\")\n",
|
||
|
" print(f\"Średnia geometryczna: {geometric_mean}\")\n",
|
||
|
"\n",
|
||
|
" print(\"\\nMiary zmienności klasyczne:\")\n",
|
||
|
" print(f\"Wariancja: {variance_value}\")\n",
|
||
|
" print(f\"Odchylenie standardowe: {std_deviation_value}\")\n",
|
||
|
"\n",
|
||
|
" print(\"\\nMiary pozycyjne dla zmiennych ilościowych:\")\n",
|
||
|
" print(f\"Kwartyl 1 (Q1): {q1}\")\n",
|
||
|
" print(f\"Kwartyl 3 (Q3): {q3}\")\n",
|
||
|
" print(f\"Rozstęp międzykwartylowy: {interquartile_range}\")\n",
|
||
|
"\n",
|
||
|
"# Test normalności rozkładu\n",
|
||
|
"def assess_normality(data, species):\n",
|
||
|
" # Filtrujemy dane dla danego gatunku\n",
|
||
|
" data_species = data[data['species'] == species]['mean']\n",
|
||
|
"\n",
|
||
|
" # Wykres QQ\n",
|
||
|
" qqplot(data_species, line='s')\n",
|
||
|
" plt.title(f'Q-Q Plot dla gatunku {species}')\n",
|
||
|
" plt.show()\n",
|
||
|
"\n",
|
||
|
" # Histogram\n",
|
||
|
" plt.hist(data_species, bins=20, density=True, alpha=0.5, color='grey', edgecolor='black')\n",
|
||
|
" plt.title(f'Histogram dla gatunku {species}')\n",
|
||
|
" plt.xlabel('Wartości średnie')\n",
|
||
|
" plt.ylabel('Częstotliwość')\n",
|
||
|
" plt.show()\n",
|
||
|
"\n",
|
||
|
" # Test Shapiro-Wilka\n",
|
||
|
" stat, p_value = shapiro(data_species)\n",
|
||
|
" print(f'Test Shapiro-Wilka dla gatunku {species}:')\n",
|
||
|
" print(f'Statystyka testowa: {stat}')\n",
|
||
|
" print(f'Wartość p: {p_value}')\n",
|
||
|
" if p_value > 0.05:\n",
|
||
|
" print('Nie ma podstaw do odrzucenia hipotezy zerowej - dane mogą pochodzić z rozkładu normalnego.')\n",
|
||
|
" else:\n",
|
||
|
" print('Hipoteza zerowa (rozkład normalny) jest odrzucana.')\n",
|
||
|
"\n",
|
||
|
"#\n",
|
||
|
"def compare_groups(data, group1_name, group2_name):\n",
|
||
|
" # Wyodrębnienie grup\n",
|
||
|
" group1 = data[data['species'] == group1_name]['mean']\n",
|
||
|
" group2 = data[data['species'] == group2_name]['mean']\n",
|
||
|
"\n",
|
||
|
" # Przeprowadzenie testu U Manna-Whitneya\n",
|
||
|
" u_stat, p_value = mannwhitneyu(group1, group2)\n",
|
||
|
" print(f\"Test U Manna-Whitneya: statystyka U = {u_stat}, p-wartość = {p_value}\")\n",
|
||
|
"\n",
|
||
|
" # Wykres pudełkowy dla obu grup\n",
|
||
|
" sns.boxplot(x='species', y='mean', data=data)\n",
|
||
|
" plt.title(f'Porównanie grup {group1_name} i {group2_name}')\n",
|
||
|
" plt.xlabel('Species')\n",
|
||
|
" plt.ylabel('Mean Value')\n",
|
||
|
" plt.show()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def compare_wilcoxon(data, group1_name, group2_name, alpha=0.05):\n",
|
||
|
" # Wyodrębnienie grup\n",
|
||
|
" group1 = data[data['species'] == group1_name]['mean']\n",
|
||
|
" group2 = data[data['species'] == group2_name]['mean']\n",
|
||
|
"\n",
|
||
|
" # Test Wilcoxona dla dwóch grup\n",
|
||
|
" stat, p_value = wilcoxon(group1, group2)\n",
|
||
|
"\n",
|
||
|
" # Sprawdzenie istotności statystycznej i wypisanie wyniku\n",
|
||
|
" if p_value < alpha:\n",
|
||
|
" print(\"Istnieją istotne różnice między grupami.\")\n",
|
||
|
" else:\n",
|
||
|
" print(\"Brak istotnych różnic między grupami.\")\n",
|
||
|
"\n",
|
||
|
" return stat, p_value\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 27,
|
||
|
"id": "0b35b556-4935-47b5-8772-ba9a482a80f2",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Liczba obserwacji, liczba kolumn\n",
|
||
|
"(5638, 10)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"Liczba obeserwacji: \n",
|
||
|
"species age\n",
|
||
|
"DB 153 1081\n",
|
||
|
" 158 893\n",
|
||
|
" 159 1026\n",
|
||
|
"SO 54 333\n",
|
||
|
" 55 1329\n",
|
||
|
" 58 976\n",
|
||
|
"dtype: int64\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"# podstawowe statystyki zbioru\n",
|
||
|
"df = read_csv_pandas(r'C:\\python_zaliczenie\\CSV\\trees.csv')\n",
|
||
|
"print(\"Liczba obserwacji, liczba kolumn\")\n",
|
||
|
"print(df.shape)\n",
|
||
|
"print(\"\\n\")\n",
|
||
|
"\n",
|
||
|
"#Ilość obserwacji w przeiczeniu na gatuenk i wiek\n",
|
||
|
"counts = df.groupby(['species', 'age']).size()\n",
|
||
|
"print(\"Liczba obeserwacji: \")\n",
|
||
|
"print(counts)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 28,
|
||
|
"id": "fa0223b4-0f6b-4783-af05-d8e8bab98722",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"0.30290945529230223\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"#Średnia wartość parametru NDVI\n",
|
||
|
"print(df['mean'].mean())\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 29,
|
||
|
"id": "bc324412-0e36-4ac3-a759-19e8e583630c",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"species\n",
|
||
|
"DB 0.424301\n",
|
||
|
"SO 0.164860\n",
|
||
|
"Name: mean, dtype: float64\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"#ŚRednia wartość parametru NDVI w rozbiciu na gatunki\n",
|
||
|
"\n",
|
||
|
"print(df.groupby('species')['mean'].mean())\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"id": "7f5c974c-ccf7-4675-bf5e-ed102ac8bf5b",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"age 54 55 58 153 158 159\n",
|
||
|
"species \n",
|
||
|
"DB NaN NaN NaN 0.429681 0.416908 0.425066\n",
|
||
|
"SO 0.16429 0.149983 0.185314 NaN NaN NaN\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"#ŚRednia wartość parametru NDVI w rozbiciu na gatunki i wiek\n",
|
||
|
"\n",
|
||
|
"print(df.pivot_table(index='species', columns='age',values=('mean')))\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "63eadc1f-bad1-436e-9087-84776f6e8fdf",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Wartości histogramu"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"id": "874b2ef6-35eb-4bd8-b585-aad970d2c8e0",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjwAAAHGCAYAAABw7lF4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABvaklEQVR4nO3dd1xTV/8H8E+AMAIB2UMRsOLeW6wCBTdqtVarbd1WS60DR93iqNSt1brauqvW5ylaa+vAAVXRFvfW1j0Yosi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Qoi8/bNjx45CKpWKRYsWiZycnNe+5wDEjBkzVM+bNm0q3N3dRXZ2tqosNTVV2Nvbi6K+rkryOfGy/M+CwYMHi4YNG6q9ZmlpqfaZly9//3tZ/ufqi593xX1v85eNiYkRERERwtraWvTs2VNkZmaq6uTvi/nbPF9x/7beZhzSImzatAkxMTEFHu+++26RyzZr1gznz59HcHAw9u/fj5SUlGL3e+TIEQAocNZXs2bNULNmTRw6dAgAcPLkSWRnZ6NXr15q9Vq0aPHK/x5fHBJ60erVq9GoUSOYm5vDxMQEUqkUhw4dwtWrVwvU7dSpE4yM/vcnUrNmTQAoMHSQX37v3r1XrGmegIAAHD9+HJmZmbh79y7+/fdffPTRR2jQoAEiIiIA5P0HXrlyZXh7e6uWO3v2LLp27Qp7e3sYGxtDKpWiX79+yMnJwY0bN9T6sLW1xXvvvffaOF50+PBh1KpVC82aNVMrHzBgAIQQOHz4MIC89+TZs2fo06cPfv3
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"colors = ['orange', 'blue']\n",
|
||
|
"plot_histogram_all(df, colors)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "eef80bf8-08e3-45c5-87d5-ae2fb28e8023",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Parametry dla Sosny\n",
|
||
|
"\n",
|
||
|
"**Statystyki opisowe dla gatunku 'SO':**\n",
|
||
|
"\n",
|
||
|
"**Miary pozycyjne:**\n",
|
||
|
"- Średnia arytmetyczna: 0.16486043726990143\n",
|
||
|
"- Mediana: 0.16289376500000002\n",
|
||
|
"- Moda: 0.04902203\n",
|
||
|
"\n",
|
||
|
"**Miary przeciętne:**\n",
|
||
|
"- Średnia arytmetyczna: 0.16486043726990143\n",
|
||
|
"- Średnia harmoniczna: 0.15346692899481953\n",
|
||
|
"- Średnia geometryczna: 0.0\n",
|
||
|
"\n",
|
||
|
"**Miary zmienności klasyczne:**\n",
|
||
|
"- Wariancja: 0.0017045115313393045\n",
|
||
|
"- Odchylenie standardowe: 0.04128573035976601\n",
|
||
|
"\n",
|
||
|
"**Miary pozycyjne dla zmiennych ilościowych:**\n",
|
||
|
"- Kwartyl 1 (Q1): 0.1361851875\n",
|
||
|
"- Kwartyl 3 (Q3): 0.19286027\n",
|
||
|
"- Rozstęp międzykwartylowy: 0.0566750825\n",
|
||
|
"ylowy: 0.0566750825"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 24,
|
||
|
"id": "061eb973-2050-49e7-9800-b4d8a712d27e",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABXMklEQVR4nO3deVxU5f4H8M+Iw8Agi+yggFioua+5ZWDmgmtoqVkJbulVS0Tzhl4T0wupaXbVtKxQK7cKy66VklsL2nXJXNDcwC0WMRyWgWGA5/eHPybHAZkZZphh+Lxfr3nhOec5Z77nMMKHc57zHIkQQoCIiIjIRjWwdAFERERE5sSwQ0RERDaNYYeIiIhsGsMOERER2TSGHSIiIrJpDDtERERk0xh2iIiIyKYx7BAREZFNY9ghIiIim8awQ1SFTZs2QSKR4Pjx45UuHzp0KJo1a6Y1r1mzZoiKijLofVJSUhAXF4e7d+8aV6iNi4qK0jnOEokEcXFxFqmntlnjvlb837ifWq3G+++/j27dusHd3R1yuRxBQUEYMWIEdu3apbONGzduYObMmXjkkUfg4OCAxo0bIywsDJ999hkeHNg/PT0dEokEhw4dMudukQ1raOkCiGzJ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B3d6/2bBKRvngZi6iWuLm54dlnn8WMGTPw119/af56lclkAICioiKt9k899RSAe7/I73fs2DGcP38e/fr1AwB0794dMpkMO3bs0Gp39OhRzdkffUgkEk0tFU6
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plot_histogram(df, species='SO', color='orange')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 25,
|
||
|
"id": "94e9e375-7036-4ded-a814-32e4dc74a006",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Statystyki opisowe dla gatunku 'SO':\n",
|
||
|
"\n",
|
||
|
"Miary pozycyjne:\n",
|
||
|
"Średnia arytmetyczna: 0.16486043726990143\n",
|
||
|
"Mediana: 0.16289376500000002\n",
|
||
|
"Moda: 0.04902203\n",
|
||
|
"\n",
|
||
|
"Miary przeciętne:\n",
|
||
|
"Średnia arytmetyczna: 0.16486043726990143\n",
|
||
|
"Średnia harmoniczna: 0.15346692899481953\n",
|
||
|
"Średnia geometryczna: 0.0\n",
|
||
|
"\n",
|
||
|
"Miary zmienności klasyczne:\n",
|
||
|
"Wariancja: 0.0017045115313393045\n",
|
||
|
"Odchylenie standardowe: 0.04128573035976601\n",
|
||
|
"\n",
|
||
|
"Miary pozycyjne dla zmiennych ilościowych:\n",
|
||
|
"Kwartyl 1 (Q1): 0.1361851875\n",
|
||
|
"Kwartyl 3 (Q3): 0.19286027\n",
|
||
|
"Rozstęp międzykwartylowy: 0.0566750825\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"descriptive_statistics(df,species='SO')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "f13a314d-e70f-4bae-99ef-e4c42d77ed24",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Parametry dla dębu\n",
|
||
|
"## Statystyki opisowe dla gatunku DB\n",
|
||
|
"\n",
|
||
|
"**Miary pozycyjne:**\n",
|
||
|
"- Średnia arytmetyczna: 0.4243005584733333\n",
|
||
|
"- Mediana: 0.42180143999999997\n",
|
||
|
"- Moda: 0.3600402\n",
|
||
|
"\n",
|
||
|
"**Miary przeciętne:**\n",
|
||
|
"- Średnia arytmetyczna: 0.4243005584733333\n",
|
||
|
"- Średnia harmoniczna: 0.42035434595669174\n",
|
||
|
"- Średnia geometryczna: 0.0\n",
|
||
|
"\n",
|
||
|
"**Miary zmienności klasyczne:**\n",
|
||
|
"- Wariancja: 0.0016796518236727545\n",
|
||
|
"- Odchylenie standardowe: 0.04098355552746436\n",
|
||
|
"\n",
|
||
|
"**Miary pozycyjne dla zmiennych ilościowych:**\n",
|
||
|
"- Kwartyl 1 (Q1): 0.39590554499999997\n",
|
||
|
"- Kwartyl 3 (Q3): 0.45235550999999996\n",
|
||
|
"- Rozstęp międzykwartylowy: 0.05644996499999999"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 31,
|
||
|
"id": "7d38261d-e48e-4ba3-b258-f9dabb269d94",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkgAAAHFCAYAAAAJ2AY0AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABSeElEQVR4nO3deVxU9f4/8NcIwzCjw74Nq6iouWRuuQtqbrmkVlpWikvlRS1FbzczE9Pgqkl2tbR7U1BbbNOuZWXkmpL91DLX1BRwiUVM2QZmBvj8/vDLXGcAmcEZzgCv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PHHXWrKysuDi4oJmzZpBLpfDyckJzzzzDGbOnFnld1X0q/H19a3U2d4SPj4+uP/++/HGG29UufzOADJlyhRMmTIFRUVFOHDgABYvXoyRI0fi/PnzCAsLQ3p6ukk/n7vZu3fvXfty1WTHjh2QyWTo379/jW3vv/9+AMBvv/1W6+8julcMSER1xMPDA4899hiuXbuGOXPmID09He3atYNCoQBwewyYOw0cOBDA7R/+3bt3N84/cuQIzp49i4ULFwIAevToAYVCgU8++QTjxo0ztjt8+DAyMjIsHlxPJpMZa6lw4sQJ/PTTTwgJCbF6f63Rpk0baDQafPzxx4iNjTUGuIyMDKSmpla66mDOVrU7OTmhR48eaNu2LT788EP88ssvJgFp27ZtWLlypfE2W0FBAb766iv069cPTk5OUKlUGDBgAH799Vf
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plot_histogram(df, species='DB', color='blue')\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 32,
|
||
|
"id": "e46240e1-d2a8-4eb5-b165-afccf700bfde",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Statystyki opisowe dla gatunku 'DB':\n",
|
||
|
"\n",
|
||
|
"Miary pozycyjne:\n",
|
||
|
"Średnia arytmetyczna: 0.4243005584733333\n",
|
||
|
"Mediana: 0.42180143999999997\n",
|
||
|
"Moda: 0.3600402\n",
|
||
|
"\n",
|
||
|
"Miary przeciętne:\n",
|
||
|
"Średnia arytmetyczna: 0.4243005584733333\n",
|
||
|
"Średnia harmoniczna: 0.42035434595669174\n",
|
||
|
"Średnia geometryczna: 0.0\n",
|
||
|
"\n",
|
||
|
"Miary zmienności klasyczne:\n",
|
||
|
"Wariancja: 0.0016796518236727545\n",
|
||
|
"Odchylenie standardowe: 0.04098355552746436\n",
|
||
|
"\n",
|
||
|
"Miary pozycyjne dla zmiennych ilościowych:\n",
|
||
|
"Kwartyl 1 (Q1): 0.39590554499999997\n",
|
||
|
"Kwartyl 3 (Q3): 0.45235550999999996\n",
|
||
|
"Rozstęp międzykwartylowy: 0.05644996499999999\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"descriptive_statistics(df,species='DB')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "5b786b16-21e9-4f05-a682-c4de83a1deec",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Test Shapiro-Wilka dla SO"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 39,
|
||
|
"id": "6e6ca919-7ee3-4382-ba35-b661de2fe499",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAHFCAYAAAAaD0bAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB2xklEQVR4nO3dd1hT1xsH8G/YoICiCKiIiAvEhRMRtyxrXa1U69ZaN0rrqgsnamvd81dnrauOqhVQ3LgnuDeKA4qITGUl9/dHSiomQIIJAfl+nofn8Z577smbiPB67rnnFQmCIICIiIioBNHRdgBEREREhY0JEBEREZU4TICIiIioxGECRERERCUOEyAiIiIqcZgAERERUYnDBIiIiIhKHCZAREREVOIwASIiIqIShwkQUSG6cOECvv76a9jY2MDAwAA2Njbo2bMnLl++XKDxnj9/jlGjRsHBwQFGRkYoW7Ys2rVrh507dyo9RtWqVSESiWRfpUuXRrNmzbBly5Yc/dq0aYM2bd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SoEcaPH4/69esjKSkJO3fuxB9//IGOHTtqdAfifv36YeXKlejfvz+ePn2KunXr4syZM5g3bx58fHzQoUMHWd+6devi5MmTOHjwIGxsbGBqapojoft43MWLF6Nfv36YO3cuatSogaCgIBw+fDjfmFq0aIGyZcti2LBhmDFjBvT19fHHH38gIiJCqfc0ZcoUHDx4EO3bt8eUKVNgbGyMNWvWyH55Zz+dp8rrZC+gXrBgAby9vaG
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA8pElEQVR4nO3deVxWdf7//+cl4iUEXCjuG+i4r5mUa4JZLqNm1IyWlmbZpzJzDZU20BZU0rFN27X04zJNZX2rcRlHyFwSdwcNW8SYUswUEChAfP/+6Of1kVhkOQhHH/fb7brpda5zXud1vT03eXJWhzHGCAAAwKaqVXYDAAAA5UGYAQAAtkaYAQAAtkaYAQAAtkaYAQAAtkaYAQAAtkaYAQAAtkaYAQAAtkaYAQAAtkaYAf5g2bJlcjgc2rVrV6GfDx06VEFBQfmmBQUF6d577y3VerZt26aoqCilpqaWrdEr3L333ltgnB0Oh6Kioiqln5LIyspSVFSUYmNjL8v6oqKi5HA4dOrUqQpdz1dffaWwsDA1a9ZMTqdT9evXV8+ePTV9+vQC8+bm5mrJkiXq2bOnXC6XvLy81K5dO82aNUu//PJLhfaJqxdhBrDARx99pKeeeqpUy2zbtk2zZ88mzFxBsrKyNHv27MsWZi6Hzz77TL169VJ6errmz5+vDRs26MUXX1Tv3r21Zs2afPNmZWXplltu0aOPPqquXb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fu3fXBBx9ox44dio+P16BBg/Trr78WmL927dr53teoUaPY6b/99luhvVz8HRo0aFDgs8Kmlbf3wtb9x7GqXr26AgICLFtPWf2xB0lyOp2Frm/FihVq3Lix7rzzzgrpRZKCg4M1c+ZMvf/++/rpp580depUJSUluU8CbtasmSTp6NGjRda48FnTpk0rrE9cnQgzQAWoXr26pk2bpj179uj06dNatWqVkpOTNXDgQGVlZRW77IUfYsePHy/w2U8//eQ+X+bCfCkpKQXmO3HiRKG1C/uNeMWKFQoNDdWSJUs0ZMgQde/eXcHBwTp79mzxX9ICF75DYf0W9R0uVp7eixq/c+fOFbgfihVjVLNmTWVnZxeYbsU9YtatWydPT0/deOONBfbc1KxZU5IKrLs86/X09FRkZKQk6T//+Y+k3/ckVa9evdiTey98dsstt5R53UBhCDNABfP399df/vIXPfLIIzp9+rT7qhKn0ylJBX7TvummmyT9/gP0YvHx8Tp8+LD69+8vSerevbucTmeBe33s2LGj0EMRRXE4HO5eLjhw4IC2b99e4hpl1aZNGzVs2FCrVq3Kd2L1sWPHtG3btksuX57e+/btK0kFxu8f//hHgRO/S7qeov5Npd+veDt58mS+8JSTk6P169dfstdLCQwM1JYtW+R0OnXjjTfqm2++ybfeC/1e7FInZl9QWKiW5D681qhRI0m/70m77777tH79+gJjKklHjhzRvHnz1KFDh2JPEgbKgquZgAowbNgwdezYUcHBwapbt66OHTumRYsWKTAwUK1atZIkderUSZL04osvauzYsfL09FSbNm3Upk0b/c///I9efvllVatWTYMHD3ZfzdS0aVNNnTpV0u+HdaZNm6bo6GjVqlVLYWFh+u9//6vZs2erYcOGJT5vYujQoXrmmWcUGRmpkJAQJSYmas6cOWrevHmhV3NZqVq1anrmmWc0fvx4hYWF6YEHHlBqaqqioqJKdJipPL136NBBd911lxYsWCAPDw/ddNNNSkhI0IIFC+RyufKNX0nX4+vrq8DAQH388cfq37+/ateurTp16igoKEgjR47U008/rTvvvFPh4eH67bff9NJLLykvL6/sA3iRhg0bKi4uTgM
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Test Shapiro-Wilka dla gatunku SO:\n",
|
||
|
"Statystyka testowa: 0.9979913830757141\n",
|
||
|
"Wartość p: 0.0020150956697762012\n",
|
||
|
"Hipoteza zerowa (rozkład normalny) jest odrzucana.\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"assess_normality(df, species='SO')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "b7544567-bfcc-4e62-bf88-8961401ec89e",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Test Shapiro-Wilka dla DB"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 41,
|
||
|
"id": "bef614fa-30c9-45f0-9df6-03db37396b3f",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAHFCAYAAAAaD0bAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB5RElEQVR4nO3dd3jN5//H8efJjpDYsUNTe4sVahOjVZRSbdHSWtVSXdQMWqpLtWYHVS3aqqJGxd5bqFHUipFYqUTIkHM+vz/ydX7SDDlxIom8HteV63Luz33f531OIued+74/920yDMNAREREJAdxyOwARERERB42JUAiIiKS4ygBEhERkRxHCZCIiIjkOEqAREREJMdRAiQiIiI5jhIgERERyXGUAImIiEiOowRIREREchwlQCIPyc6dO3n22WcpWrQoLi4uFC1alK5du7Jnz5509Xf+/HkGDRqEr68vbm5u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XRhxIgRLF++nBYtWjBixAjc3d2ZOXOm9db2u3fn2fI8dxdQf/TRR7Rt2xZHR0eqVauGi4sLL774It999x2+vr5Ur16d3bt3pynRS6vBgweTO3du+vbtS1RUFFOnTsVkMtGjRw9efPFFBg4cSOfOnTl37hyTJ09O9a6//7px4wY7d+4E4NatWxw/fpyFCxeyZcsWunbtmuzmj5cvX7a2iYmJITg4mAkTJpA3b15efvll+7xoEVsYIvJQbN++3ejcubPh7e1tODg4GIDh5uZmrFixIl39nTt3zhg
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA8y0lEQVR4nO3deVyVdf7//+cRBEHgoCiKqKC5r6mUpiaQjmlqRjVaNpM5Y59KnVKL0skGtBKXLNtsm0lLp3Kasvq2mOYIuYfmlpmWuVAp5AIIFCi8f3948/xEFuF4AefSx/12O7c617mu1/U6by/k6bU6jDFGAAAANlWrphsAAAC4GIQZAABga4QZAABga4QZAABga4QZAABga4QZAABga4QZAABga4QZAABga4QZAABga4QZ4ByLFi2Sw+HQ5s2bS/186NChioyMLDYtMjJSd911V6XWs379eiUmJiozM9O9Ri9xd911V4lxdjgcSkxMrJF+KiIvL0+JiYlKTk6ulvUlJibK4XDo6NGjVbaOsz8PZ1916tRR48aNFRsbq6SkJGVkZJTZ19lXrVq1FBYWphtuuEHr1q2rsl5xefOu6QYAu1u2bJmCgoIqtcz69es1ffp03XXXXQoODq6axlCt8vLyNH36dElSTExMzTZjsYULF6pdu3Y6deqUMjIytHbtWs2ePVtPPfWUli5dqgEDBpRYZvny5XI6nSoqKtKhQ4c0Z84cxcTEaNOmTerevXsNfAtcyggzwEXq1q1bTbdQaadOnZLD4ZC3N38F4MI6deqkqKgo1/tbbrlFkyZNUt++fXXzzTfr+++/V6NGjYot06NHDzVo0ECS1Lt3b1199dW64oor9N///pcwA8txmAm4SOcfZioqKtITTzyhtm3bys/PT8HBwerSpYueffZZSWd2w8fHx0uSWrRo4dodf/bwRFFRkebMmaN27drJ19dXoaGhuvPOO/XTTz8VW68xRjNnzlRERITq1KmjqKgorVy5UjExMcX2DCQnJ8vhcGjx4sV68MEHFR4eLl9fX/3www/69ddfNW7cOHXo0EEBAQEKDQ3VddddpzVr1hRb14EDB+RwODR37lzNnj1bkZGR8vPzU0xMjPbu3atTp05pypQpatKkiZxOp+Li4ko9BFGaRYsWqW3btvL19VX79u315ptvVmi5ivZelvz8fD344INq3Lix/P391a9fP23ZsqXEn2dF1nPgwAE1bNhQkjR9+nTXn+nZOqUdNpP+/0My53I4HJowYYIWL16s9u3by9/fX127dtXHH398we/03XffqWXLlurZs6cyMjJch4kOHDhQbL6z28TFHBJr3ry55s2bp5MnT+qVV1654PxOp1OSVLt2bbfXCZSFf5YBpSgsLNTp06dLTK/IQ+bnzJmjxMRETZs2Tf369dOpU6f03Xffuc6PGTt2rI4fP67nn39e77//vsLCwiRJHTp0kCTdd999evXVVzVhwgQNHTpUBw4c0GOPPabk5GR9/fXXrn/tPvroo0pKStL//d//6eabb1ZaWprGjh2rU6dOqU2bNiX6mjp1qq655hq9/PLLqlWrlkJDQ/Xrr79KkhISEtS4cWPl5ORo2bJliomJ0apVq0ocLnnxxRfVpUsXvfjii8rMzNSDDz6oYcOGqWfPnqpdu7Zef/11HTx4UA899JDGjh2rjz76qNyxWrRokcaMGaPhw4dr3rx5ysrKUmJiovLz81WrVvn/1jp+/Hilej/fmDFjtHTpUj388MO67rrr9O233youLk7Z2dmVXk9YWJiWL1+uQYMG6a9//avGjh0rSa6AU1mffPKJUlNTNWPGDAUEBGjOnDmKi4vTnj171LJly1KXSUlJUVxcnPr166e33npL/v7+bq27Mm644QZ5eXnpyy+/LPHZ2Z+hs4eZpk2bJl9fX916661V3hcuQwaAy8KFC42kcl8RERHFlomIiDCjR492vR86dKi58sory13P3LlzjSSzf//+YtN3795tJJlx48YVm75p0yYjyfz97383xhhz/Phx4+vra0aOHFlsvg0bNhhJJjo62jVt9erVRpLp16/fBb//6dOnzalTp0z//v1NXFyca/r+/fuNJNO1a1dTWFjomj5//nwjydx4443F6kycONFIMllZWWWuq7Cw0DRp0sR0797dFBUVuaYfOHDA1K5du8Q4SzIJCQmV7r00u3btMpLMI488Umz622+/bSQV+/Os6Hp+/fXXMnscPXp0ie9jjDEJCQnm/L+GJZlGjRqZ7Oxs17QjR46YWrVqmaSkpBLL/vrrr2bx4sXGx8fH3H///cX+fM5uz+dvZ2e3idWrV5f5Pc9dPjU1tcx5GjVqZNq3b1+ir/NfQUFB5v333y93fYC7OMwElOLNN99UampqiVffvn0vuOzVV1+t7du3a9y4cfr8889L/Eu/PKtXr5akEldHXX311Wrfvr1WrVolSdq4caPy8/M1YsSIYvP16tWr1MMZ0pnzHErz8ssvq3v37qpTp468vb1Vu3ZtrVq1Srt37y4x7w033FBsj0n79u0lSUOGDCk239nphw4dKuObSnv27NEvv/yiUaNGFTvUEhERod69e5e5nLu9nyslJUWSSozfrbfeWup5RO6ux12xsbEKDAx0vW/UqJFCQ0N18ODBEvM++eSTuuuuuzRr1iw9++yzF9yjZTVTxt7KL774Qqmpqfrqq6/08ccfa8CAAbrtttu0bNmyau0PlwfCDFCK9u3bKyoqqsTr7HH/8kydOlVPPfWUNm7cqMGDByskJET9+/cv83Lvcx07dkySXIeeztWkSRPX52f/e/5Jl2VNK6vm008/rfvuu089e/bUe++9p40bNyo1NVWDBg3Sb7/9VmL++vXrF3vv4+NT7vTff/+91F7O/Q6NGzcu8Vlp0y6299LWff5YeXt7KyQkxLL1uOv8HiTJ19e31PUtWbJE4eHhuu2226qk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S9/vrr+u6
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Test Shapiro-Wilka dla gatunku DB:\n",
|
||
|
"Statystyka testowa: 0.9962971806526184\n",
|
||
|
"Wartość p: 9.341939062323945e-07\n",
|
||
|
"Hipoteza zerowa (rozkład normalny) jest odrzucana.\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"assess_normality(df, species='DB')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "b03087d4-31b1-4d83-b623-cc6afd6615b4",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Test U Manna-Whitneya\n",
|
||
|
"\n",
|
||
|
"**Test U Manna-Whitneya:**\n",
|
||
|
"\n",
|
||
|
"statystyka U = 42.0, p-wartość = 0.0\r\n",
|
||
|
"**\r\n",
|
||
|
"Istnieją istotne różnice między grupa**mi"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 44,
|
||
|
"id": "c86bf5fc-6aa2-4e78-b0ba-3172de44bf04",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Test U Manna-Whitneya: statystyka U = 42.0, p-wartość = 0.0\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAHGCAYAAACIDqqPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP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nT592tkdFRcnLy8t5/FGjRsnHx0e//vqrevfuLR8fHwUEBOjxxx9XZmamS41z5sxRp06dVKNGDfn6+qp9+/ZasmSJDMPI97Vs2bJF7du3l7e3t1q0aKGlS5e6rFfQsNS3336rvn37qkaNGnI4HGrXrp3WrVtXqO//iRMndO+996pq1aqqVq2ahg0bpr1798pms2nZsmXO9XJf98GDBxUaGqqqVauqR48ezvpHjRqVZ9933HGH7rjjjjz1v/fee5o6darq1q0rb29vde3aVXFxcVetNTk5Wb6+vvLx8cl3uc1mk3RpOPKll15Sy5Yt9eSTT+ZZz9/fX5GRkTp9+rSWLFlyxWMWdljqSgIDA/XKK68oLS1Nb7755lXX9/PzkyRVqlSp2McEiopwA5SgX3/9VZJUu3ZtGYah/v376+WXX9bw4cP1ySefaOrUqVq+fLm6d++eJzzs379fTzzxhB577DFt2bJFgwYN0k8//aSQkBD93//9n1577TVt2LBBrVq10qhRozRv3jxJlz4Eu3fv7jJM8O233+rs2bNyOBz64osvnO2ff/65goODVa1aNWfbhQsX1LdvX/Xo0UMfffSRRo8erfnz5+vFF190qe/o0aMaN26c1q1bpw0bNmjgwIF69NFH9c9//jPP9+G7777T448/rilTpuijjz5S27ZtNWbMGO3YseOK379t27bptttu09mzZ/XGG2/oo48+0s0336zw8HCXcJKf8+fPq1u3btq2bZtefPFFrVu3Tv7+/goPD893/aysLPXt21fdu3fXRx995AyTRfX000/rt99+09tvv623335bp06d0h133KHffvvtitt17txZCQkJGjZsmL788kulp6fnu96+ffv0559/qm/fvs7Ac7l77rlHHh4eiomJKdZrKKrevXvL09Mz359ndna2Ll68qKysLP3666+aOHGi7Ha77r33XrfUBkhiWAoojtxu+z179hgXLlww0tLSjI8//tioXbu2s7t+y5YthiRj3rx5LtuuXbvWkGQsXrzY2RYUFGR4enoaP/30k8u6Q4YMMex2uxEfH+/SHhYWZlx33XXG2bNnDcMwjLffftuQ5FzvueeeM1q0aGH07dvXePDBBw3DMIysrCyjSpUqxtNPP+3cz8iRIw1Jxrp161z237t3b6N58+YFvv7s7GzjwoULxty5c42aNWu6DKEEBQUZDofDOHbsmLMtPT3dqFGjhjFu3Dhn27Zt2wxJxrZt25xtLVq0MNq1a2dcuHDB5Xh33323Ua9ePSM7O7vAmv79738bkozo6GiX9nHjxhmSjHfeeSfP6166dGme/QQFBRkjR47M0961a1eja9eueepv3769y+s/evSoUalSJWPs2LEF1moYhpGRkWH079/fkGRIMjw9PY127doZM2bMMJKSkpzrrVmzxpBkvPHGG1fcn7+/v9GyZcsrrpP7e3vkyJFCrZffsFRBx8sdlrr84evra2zYsOGKxwNKGj03wDW49dZbValSJVWtWlV333236tatq+joaPn7+2vr1q2SlGeI47777lOVKlVcelQkqW3btmrWrJlL29atW9WjRw8FBAS4tI8aNUp//fWXdu/eLUm68847JcnZexMTE6OePXvqzjvvdP41v3v3bp0/f965bi6bzaZ77rknTy25Q2t/r+XOO++Un5+fPD09ValSJc2cOVPJycl5rp65+eabFRgY6HzucDjUrFmzPPv8u19//VWHDh3SsGHDJEkXL150Pnr37q2EhAT99NNPBW7/5ZdfqmrVqrrrrrtc2u+///4Ctxk0aFCBywpr6NChLj0qQUFBCgkJ0bZt2664nd1u18aNG/XDDz9o/vz5GjJkiH7//Xc9//zzatmy5RVfa34MwyiwZ6c0GJcNR+b6/PPPtXfvXn3zzTf6+OOPdeedd2rIkCHauHGj22oDCDfANVixYoX27t2ruLg4nTp1SgcOHNBtt90m6dI5FV5eXqpdu7bLNjabTXXr1lVycrJLe35XsCQnJ+fbXr9+fedy6dIH6g033KDPP//cGXpyw82JEyf0008/6fPPP5e3t7dCQkJc9nXdddfJ4XC4tNntdmVkZDiff/PNNwoNDZUkvfXWW/rqq6+0d+9ezZgxQ5LyDKnUrFkzT812u73AoRdJznODpk2bpkqVKrk8JkyYIEk6c+ZMgdsnJyfL398/T3t+bdKl1+3r61vg/gqrbt26+bZd/vMtSMuWLTV58mS99957io+PV1RUlJKTk/Xss89KkjMkHjlypMB9nD9/XmfOnMkTgkvL+fPnlZyc7Pw9/LubbrpJHTp00C233KI+ffpo/fr1atKkics5YUBp8zK7AKA8a9mypTp06JDvspo1a+rixYv6/fffXQKOYRhKTEzULbfc4rJ+fn9116xZUwkJCXnaT506JUmqVauWsy33nJkvv/xSOTk5uuOOO1S1alXVr19fMTEx+vzzz9WlSxfZ7fYiv841a9aoUqVK+vjjj12C0IcffljkfRUk97VERERo4MCB+a7TvHnzArevWbOmvvnmmzztiYmJ+a5fUC+Hw+HIcz6UdClY/f37faX9JyYm5hvwrsZms2nKlCmaO3euvv/+e0lScHCwqlevrk2bNikyMjLfujdt2qScnBz17NmzyMcsjk8++UTZ2dkuJ1gXxMPDQ61bt9b69euVlJSkOnXqlH6BqPDouQFKSe7VN++9955L+wcffKDz5887l19tH1u3bnWGmVwrVqzQdddd57w6S7o0NHX69GktWLBAt956q6pWrercx8aNG7V3794
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"compare_groups(df, 'SO', 'DB')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "c8cd98bd-ddd6-4395-a0a8-5b154bbf86bc",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Trenowanie modelu\n",
|
||
|
"\n",
|
||
|
"Wyniki oceny modelu są następujące:\n",
|
||
|
"\n",
|
||
|
"Dokładność (Accuracy): Wynosi 100%, co oznacza, że model poprawnie sklasyfikował wszystkie próbki w zbiorze testowym.\n",
|
||
|
"\n",
|
||
|
"Macierz pomyłek (Confusion Matrix): Pokazuje, że:\n",
|
||
|
"- 615 próbek dla gatunku DB zostało poprawnie sklasyfikowanych jako DB (True Positives).\n",
|
||
|
"- 510 próbek dla gatunku SO zostało poprawnie sklasyfikowanych jako SO (True Positives).\n",
|
||
|
"- 3 próbki dla gatunku SO zostały błędnie sklasyfikowane jako DB (False Negatives).\n",
|
||
|
"- Nie ma błędnych sklasyfikowań dla gatunku DB.\n",
|
||
|
"\n",
|
||
|
"Raport klasyfikacji (Classification Report): Zapewnia szczegółowe informacje na temat wyników klasyfikacji dla każdej klasy, w tym precision, recall, f1-score i support (liczba próbek w danej klasie).\n",
|
||
|
"- Precision (precyzja) dla obu klas wynosi 100%, co oznacza, że wszystkie pozytywne predykcje dla danej klasy są prawidłowe.\n",
|
||
|
"- Recall (czułość) dla klasy DB wynosi 100%, a dla klasy SO wynosi 99%, co oznacza, że większość próbek dla każdej klasy została poprawnie zidentyfikowana.\n",
|
||
|
"- F1-score dla obu klas wynosi 100%, co oznacza dobrą równowagę między precyzją a czułością.\n",
|
||
|
"- Support określa liczbę próbek w każdej klasie.\n",
|
||
|
"\n",
|
||
|
"Rozmiar zbioru treningowego i testowego: W zbiorze treningowym znajduje się 4510 próbek, a w zbiorze testowym 1128 próbek.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 46,
|
||
|
"id": "5f1eb754-5ed2-4acb-98ec-efe33700fa65",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"#Impor bibliotek\n",
|
||
|
"from sklearn.model_selection import train_test_split\n",
|
||
|
"from sklearn.linear_model import LogisticRegression\n",
|
||
|
"from sklearn.metrics import accuracy_score, classification_report, confusion_matrix\n",
|
||
|
"import numpy as np\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import joblib"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 47,
|
||
|
"id": "e9d5a5bc-9b05-4791-9aa6-eebd140e9f28",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"#Import zbioru danych\n",
|
||
|
"def read_csv_pandas(path_to_file):\n",
|
||
|
" df = pd.read_csv(path_to_file, sep=';')\n",
|
||
|
" return df\n",
|
||
|
"\n",
|
||
|
"df = read_csv_pandas(r'C:\\python_zaliczenie\\CSV\\trees.csv')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 51,
|
||
|
"id": "a9af00ca-8f62-448e-87d2-85e4d5a2c950",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Accuracy: 1.00\n",
|
||
|
"Confusion Matrix:\n",
|
||
|
"[[615 0]\n",
|
||
|
" [ 3 510]]\n",
|
||
|
"Classification Report:\n",
|
||
|
" precision recall f1-score support\n",
|
||
|
"\n",
|
||
|
" DB 1.00 1.00 1.00 615\n",
|
||
|
" SO 1.00 0.99 1.00 513\n",
|
||
|
"\n",
|
||
|
" accuracy 1.00 1128\n",
|
||
|
" macro avg 1.00 1.00 1.00 1128\n",
|
||
|
"weighted avg 1.00 1.00 1.00 1128\n",
|
||
|
"\n",
|
||
|
"Rozmiar zbioru treningowego: 4510\n",
|
||
|
"Rozmiar zbioru testowego: 1128\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Trenowanie modelu\n",
|
||
|
"\n",
|
||
|
"# Podziel dane na zbiór treningowy i testowy\n",
|
||
|
"X_train, X_test, y_train, y_test = train_test_split(df['mean'].values.reshape(-1, 1), df['species'], test_size=0.2, random_state=42)\n",
|
||
|
"\n",
|
||
|
"# Wytrenuj prosty model regresji logistycznej\n",
|
||
|
"model = LogisticRegression(random_state=42)\n",
|
||
|
"model.fit(X_train, y_train)\n",
|
||
|
"\n",
|
||
|
"# Określ ścieżkę, pod którą zapiszesz model\n",
|
||
|
"model_path = \"C:\\python_zaliczenie\\model\\so_db_model.joblib\"\n",
|
||
|
"\n",
|
||
|
"# Zapisz model do zmiennej 'model_path'\n",
|
||
|
"joblib.dump(model, model_path)\n",
|
||
|
"\n",
|
||
|
"# Przewiduj na zbiorze testowym\n",
|
||
|
"y_pred = model.predict(X_test)\n",
|
||
|
"\n",
|
||
|
"# Ocen jakość modelu\n",
|
||
|
"accuracy = accuracy_score(y_test, y_pred)\n",
|
||
|
"conf_matrix = confusion_matrix(y_test, y_pred)\n",
|
||
|
"classification_rep = classification_report(y_test, y_pred)\n",
|
||
|
"\n",
|
||
|
"# Wyświetl wyniki\n",
|
||
|
"print(f'Accuracy: {accuracy:.2f}')\n",
|
||
|
"print(f'Confusion Matrix:\\n{conf_matrix}')\n",
|
||
|
"print(f'Classification Report:\\n{classification_rep}')\n",
|
||
|
"\n",
|
||
|
"print(\"Rozmiar zbioru treningowego:\", len(X_train))\n",
|
||
|
"print(\"Rozmiar zbioru testowego:\", len(X_test))\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "fe0c9daa-d947-42b8-b749-02354c16242a",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Wyniki dla danych testowych (nie znanych przez model)\n",
|
||
|
"\n",
|
||
|
"## Ocena modelu\n",
|
||
|
"\n",
|
||
|
"Dokładność (Accuracy): Wynosi 98%, co oznacza, że model poprawnie sklasyfikował 98% wszystkich próbek w zbiorze testowym.\n",
|
||
|
"\n",
|
||
|
"Macierz pomyłek (Confusion Matrix): Pokazuje, że:\n",
|
||
|
"- 486 próbek dla gatunku DB zostało poprawnie sklasyfikowanych jako DB (True Positives), natomiast 18 próbek zostało błędnie sklasyfikowanych jako SO (False Negatives).\n",
|
||
|
"- Wszystkie 600 próbek dla gatunku SO zostało poprawnie sklasyfikowanych jako SO (True Positives), bez błędów.\n",
|
||
|
"\n",
|
||
|
"Raport klasyfikacji (Classification Report): Zapewnia szczegółowe informacje na temat wyników klasyfikacji dla każdej klasy, w tym precision, recall, f1-score i support (liczba próbek w danej klasie).\n",
|
||
|
"- Precyzja (Precision) dla klasy DB wynosi 100%, co oznacza, że wszystkie pozytywne predykcje dla klasy DB są prawidłowe. Dla klasy SO precyzja wynosi 97%, co oznacza, że większość pozytywnych predykcji dla klasy SO jest prawidłowa.\n",
|
||
|
"- Czułość (Recall) dla klasy DB wynosi 96%, co oznacza, że model zidentyfikował 96% wszystkich rzeczywistych próbek klasy DB. Dla klasy SO czułość wynosi 100%, co oznacza, że model zidentyfikował wszystkie rzeczywiste próbki klasy SO.\n",
|
||
|
"- F1-score dla klasy DB wynosi 98%, a dla klasy SO wynosi 99%, co oznacza, że model osiągnął dobrą równowagę między precyzją a czułością dla obu klas.\n",
|
||
|
"- Support określa liczbę próbek w każdej klasie.\n",
|
||
|
"\n",
|
||
|
"Rozmiar zbioru testowego: W zbiorze testowym znajduje się 1104 próbek.\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 52,
|
||
|
"id": "18defbdb-a23b-4ce9-bf0a-57325d67bcba",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"#import biblitek\n",
|
||
|
"import joblib\n",
|
||
|
"import pandas as pd\n",
|
||
|
"from sklearn.metrics import accuracy_score, classification_report, confusion_matrix, roc_curve, auc\n",
|
||
|
"import matplotlib.pyplot as plt\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 56,
|
||
|
"id": "ea40b561-c25c-45b9-99df-b1d8f46bcf5b",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Wczytaj model (upewnij się, że wcześniej model został zapisany)\n",
|
||
|
"model_path = \"C:\\python_zaliczenie\\model\\so_db_model.joblib\"\n",
|
||
|
"model = joblib.load(model_path)\n",
|
||
|
"\n",
|
||
|
"# Wczytaj dane testowe z pliku CSV\n",
|
||
|
"test_data = pd.read_csv(r'C:\\python_zaliczenie\\CSV\\trees_results_for_testing_model.csv', sep=';')\n",
|
||
|
"\n",
|
||
|
"# Dodaj numer ID do danych wynikowych\n",
|
||
|
"test_data['id'] = test_data['id'].astype(str) # Jeśli numer ID jest liczbą, zamień na tekst\n",
|
||
|
"test_data['id'] = test_data['id'] + '_predicted' # Dodaj '_predicted' do numeru ID\n",
|
||
|
"\n",
|
||
|
"# Przewiduj gatunki dla danych testowych\n",
|
||
|
"predicted_classes = model.predict(test_data['mean'].values.reshape(-1, 1))\n",
|
||
|
"predicted_probabilities = model.predict_proba(test_data['mean'].values.reshape(-1, 1))[:, 1]\n",
|
||
|
"\n",
|
||
|
"# Dodaj przewidziane gatunki i prawdopodobieństwa do danych wynikowych\n",
|
||
|
"test_data['predicted_species'] = predicted_classes\n",
|
||
|
"test_data['predicted_probabilities'] = predicted_probabilities"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 57,
|
||
|
"id": "ee3aa441-2c82-4920-8acc-f406a585a1f5",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Accuracy: 0.98\n",
|
||
|
"Confusion Matrix:\n",
|
||
|
"[[486 18]\n",
|
||
|
" [ 0 600]]\n",
|
||
|
"Classification Report:\n",
|
||
|
" precision recall f1-score support\n",
|
||
|
"\n",
|
||
|
" DB 1.00 0.96 0.98 504\n",
|
||
|
" SO 0.97 1.00 0.99 600\n",
|
||
|
"\n",
|
||
|
" accuracy 0.98 1104\n",
|
||
|
" macro avg 0.99 0.98 0.98 1104\n",
|
||
|
"weighted avg 0.98 0.98 0.98 1104\n",
|
||
|
"\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Sprawdź dokładność modelu\n",
|
||
|
"accuracy = accuracy_score(test_data['species'], predicted_classes)\n",
|
||
|
"conf_matrix = confusion_matrix(test_data['species'], predicted_classes)\n",
|
||
|
"classification_rep = classification_report(test_data['species'], predicted_classes)\n",
|
||
|
"\n",
|
||
|
"# Wyświetl wyniki dokładności\n",
|
||
|
"print(f'Accuracy: {accuracy:.2f}')\n",
|
||
|
"print(f'Confusion Matrix:\\n{conf_matrix}')\n",
|
||
|
"print(f'Classification Report:\\n{classification_rep}')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 61,
|
||
|
"id": "3ed47aa5-0ab3-4be5-964b-c8f8480fef0b",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArMAAAK7CAYAAADhtAd2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACK00lEQVR4nOzdZ3RU1cOF8T3pIZDQe5feEQQEKQGkiiAoHUJTECyIiCIKYkMUFZWm0pUmHaQGCEWBP91CV0LvLdT0837Im9ExCSSQ5GaS57dWls7JvTN7SmBzcuaMzRhjBAAAADghF6sDAAAAAA+KMgsAAACnRZkFAACA06LMAgAAwGlRZgEAAOC0KLMAAABwWpRZAAAAOC3KLAAAAJwWZRYAAABOizILpzd9+nTZbDb7l5ubm/Lly6eOHTvq6NGjVseTJBUtWlQ9evSwOkYct2/f1ieffKKqVasqc+bM8vHxUZUqVfTxxx/r9u3bVsdLtI8//lhLliyJM75x40bZbDZt3Lgx1TPFOnbsmF566SWVKlVK3t7eypQpk8qXL6933nlHZ86csR/XoEEDVahQwbKcD2P27NkaO3Zsil3/g/z8bN26Ve+9956uX78e53sNGjRQgwYNkiVbrEaNGqlfv372y7GvvdgvV1dX5cqVS61atdKuXbvivQ5jjGbPnq2GDRsqW7Zs8vT0VPHixTVgwACdOnUqwdtevny5WrVqpTx58sjDw0PZs2dXo0aNNGvWLEVEREiSrl27pqxZs8b7c3IviX39ApYygJObNm2akWSmTZtmtm3bZoKCgsyHH35ovL29Te7cuc3Vq1etjmj27Nlj/vrrL6tjODh//rypUKGC8fb2Nm+++aZZu3atWbt2r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qfP7/9/ib2cYm1ZMkSbdmyRcOHD1fevHmVO3duSdLx48fVt29fFS5cWJK0fft2vfzyyzpz5oz9MZCk4cOH64MPPlDbtm31+uuvy8/PT3/++adOnDghSZowYYJeeOEF/f3331q8eLHDbUdHR6t169basmWLhgwZotq1a+vEiRMaMWKEGjRooF27dsnb29t+/J49e3Tw4EG98847KlasmHx8fOJ9nD799FO99957euedd1SvXj1FRETo0KFD9vWxffr00dWrV/XNN99o0aJFypcvnySpXLly8V5fZGSkmjdvri1btmjgwIFq2LChIiMjtX37dp08eVK1a9dO8Dn7+eef5erqqnr16iV4zL/F9+fS7t27de3aNb3wwgvx/pkhSa1atZKLi4sCAwP1+uuva9euXbp69aqef/75BM+JT4MGDTR06FBdv35dWbNmTfC4B3n9JsXQoUP1+OOPa9KkSXJxcVGhQoVUtWpVTZs2Tb1793Y4dvr06cqdO7datGghSTpw4IBq166twoUL6/PPP1fevHm1Zs0avfLKK7p8+bJGjBiRIpmRhlndpoGHFTszu337dhMREWFu3rxpVq9ebfLmzWvq1avnMBNYpkwZU7Vq1Ti/0nrqqadMvnz57DNgvXr1Mu7u7ubAgQMJ3u6oUaOMi4tLnBnhBQsWGElm5cqV9rH/zlosW7bMSDJr1661j0VGRpr8+fObdu3a2cf69u1rMmfObE6cOOFwG2PGjDGS7Ov+Ymc4H3nkERMeHn6/h8z069fPSDKHDh1K8JjYWeIXX3zRPibJeHt7O8xOR0ZGmjJlypgSJUqkaO7IyEgTERFhevfubapWrerwvYSWGSQ0MyvJ/PTTTw7HtmjRwpQuXdp+efz48UZSnNntvn37Jmpm1svLy9SqVeuex/xb7Azn//73P4fxcuXK3XO5x70eF0nGz8/vvuvGo6KiTEREhHn//fdNjhw57DN
|
||
|
"text/plain": [
|
||
|
"<Figure size 800x800 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Oblicz krzywą ROC\n",
|
||
|
"fpr, tpr, thresholds = roc_curve(test_data['species'], predicted_probabilities, pos_label='SO')\n",
|
||
|
"roc_auc = auc(fpr, tpr)\n",
|
||
|
"\n",
|
||
|
"# Wykres krzywej ROC\n",
|
||
|
"plt.figure(figsize=(8, 8))\n",
|
||
|
"plt.plot(fpr, tpr, color='darkorange', lw=2, label=f'ROC curve (AUC = {roc_auc:.2f})')\n",
|
||
|
"plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')\n",
|
||
|
"plt.xlabel('False Positive Rate')\n",
|
||
|
"plt.ylabel('True Positive Rate')\n",
|
||
|
"plt.title('Receiver Operating Characteristic (ROC) Curve')\n",
|
||
|
"plt.legend(loc='lower right')\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 59,
|
||
|
"id": "fb4e5f9d-68c7-41a6-9cd2-393426c3b6e8",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
" id mean species predicted_species \\\n",
|
||
|
"0 11278_predicted 0.348585 DB DB \n",
|
||
|
"1 11279_predicted 0.415473 DB DB \n",
|
||
|
"2 11280_predicted 0.370652 DB DB \n",
|
||
|
"3 11281_predicted 0.399752 DB DB \n",
|
||
|
"4 11282_predicted 0.319520 DB DB \n",
|
||
|
"... ... ... ... ... \n",
|
||
|
"1099 12377_predicted 0.144427 SO SO \n",
|
||
|
"1100 12378_predicted 0.168115 SO SO \n",
|
||
|
"1101 12379_predicted 0.139620 SO SO \n",
|
||
|
"1102 12380_predicted 0.147586 SO SO \n",
|
||
|
"1103 12381_predicted 0.184157 SO SO \n",
|
||
|
"\n",
|
||
|
" predicted_probabilities \n",
|
||
|
"0 0.199945 \n",
|
||
|
"1 0.045746 \n",
|
||
|
"2 0.126598 \n",
|
||
|
"3 0.066005 \n",
|
||
|
"4 0.338688 \n",
|
||
|
"... ... \n",
|
||
|
"1099 0.974745 \n",
|
||
|
"1100 0.955569 \n",
|
||
|
"1101 0.977507 \n",
|
||
|
"1102 0.972752 \n",
|
||
|
"1103 0.935376 \n",
|
||
|
"\n",
|
||
|
"[1104 rows x 5 columns]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Zapisz wyniki do nowego pliku CSV\n",
|
||
|
"test_data.to_csv(r'C:\\python_zaliczenie\\CSV\\test_results.csv', index=False)\n",
|
||
|
"\n",
|
||
|
"# Wyświetl wyniki\n",
|
||
|
"print(test_data[['id', 'mean', 'species', 'predicted_species', 'predicted_probabilities']])"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"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.5"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|