03 part 1
This commit is contained in:
parent
78eb1a9c1a
commit
d43a29e1a7
94
create_data.ipynb
Normal file
94
create_data.ipynb
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!pip install kaggle\n",
|
||||
"!pip install pandas\n",
|
||||
"!pip install seaborn\n",
|
||||
"!pip install torch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 1 Pobranie zbioru\n",
|
||||
"!kaggle datasets download -d joniarroba/noshowappointments"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!unzip -o noshowappointments.zip"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"no_shows=pd.read_csv('KaggleV2-May-2016.csv')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Wyczyszczenie zbioru\n",
|
||||
"# Usunięcie negatywnego wieku\n",
|
||||
"no_shows = no_shows.drop(no_shows[no_shows[\"Age\"] < 0].index)\n",
|
||||
"\n",
|
||||
"# Usunięcie niewiadomego wieku (zależy od zastosowania)\n",
|
||||
"# no_shows = no_shows.drop(no_shows[no_shows[\"Age\"] == 0].index)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Normalizacja danych\n",
|
||||
"\n",
|
||||
"# Usunięcie kolumn PatientId oraz AppointmentID\n",
|
||||
"no_shows.drop([\"PatientId\", \"AppointmentID\"], inplace=True, axis=1)\n",
|
||||
"\n",
|
||||
"# Zmiena wartości kolumny No-show z Yes/No na wartość boolowską\n",
|
||||
"no_shows[\"No-show\"] = no_shows[\"No-show\"].map({'Yes': 1, 'No': 0})\n",
|
||||
"\n",
|
||||
"# Normalizacja kolumny Age\n",
|
||||
"no_shows[\"Age\"]=(no_shows[\"Age\"]-no_shows[\"Age\"].min())/(no_shows[\"Age\"].max()-no_shows[\"Age\"].min())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Zapisanie wyników jako artefakt"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
53
dataset_stats.ipynb
Normal file
53
dataset_stats.ipynb
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Załadowanie artefaktu"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# 3. Statystyki\n",
|
||||
"# Wielkość zbioru i podzbiorów\n",
|
||||
"print(f\"Wielkosc zbioru: {len(no_shows)}, podzbiór train: {train_size}, podzbiór test {test_size}.\")\n",
|
||||
"# Opis parametrów\n",
|
||||
"no_shows.describe(include='all')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Rozkład częstości dla klas\n",
|
||||
"no_shows[\"No-show\"].value_counts().plot(kind=\"bar\", title=\"No-show\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Zapisanie statystyk jako artefakt"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"language_info": {
|
||||
"name": "python"
|
||||
},
|
||||
"orig_nbformat": 4
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
Loading…
Reference in New Issue
Block a user