Compare commits
No commits in common. "main" and "main" have entirely different histories.
@ -44,16 +44,23 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 15,
|
"execution_count": 2,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"[279661.8663101 279261.14658016 522543.09697553 243798.45172733\n",
|
"[[332187.32537534]\n",
|
||||||
" 408919.21577439 272940.5507781 367515.38801642 592972.56867895\n",
|
" [369587.77676738]\n",
|
||||||
" 418509.89826131 943578.7139463 ]\n"
|
" [488428.70420785]\n",
|
||||||
|
" [300013.00301966]\n",
|
||||||
|
" [412118.79730411]\n",
|
||||||
|
" [283333.7605634 ]\n",
|
||||||
|
" [275209.84706017]\n",
|
||||||
|
" [361970.50784352]\n",
|
||||||
|
" [272402.36116539]\n",
|
||||||
|
" [328635.55642844]]\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -77,7 +84,7 @@
|
|||||||
"def preprocess(data):\n",
|
"def preprocess(data):\n",
|
||||||
" \"\"\"Wstępne przetworzenie danych\"\"\"\n",
|
" \"\"\"Wstępne przetworzenie danych\"\"\"\n",
|
||||||
" data = data.replace({\"parter\": 0, \"poddasze\": 0}, regex=True)\n",
|
" data = data.replace({\"parter\": 0, \"poddasze\": 0}, regex=True)\n",
|
||||||
" data = data.map(np.nan_to_num) # Zamienia \"NaN\" na liczby\n",
|
" data = data.applymap(np.nan_to_num) # Zamienia \"NaN\" na liczby\n",
|
||||||
" return data\n",
|
" return data\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -94,7 +101,7 @@
|
|||||||
"data_train, data_test = train_test_split(data, test_size=0.2)\n",
|
"data_train, data_test = train_test_split(data, test_size=0.2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Uczenie modelu\n",
|
"# Uczenie modelu\n",
|
||||||
"y_train = pd.Series(data_train[\"cena\"])\n",
|
"y_train = pd.DataFrame(data_train[\"cena\"])\n",
|
||||||
"x_train = pd.DataFrame(data_train[FEATURES])\n",
|
"x_train = pd.DataFrame(data_train[FEATURES])\n",
|
||||||
"model = LinearRegression() # definicja modelu\n",
|
"model = LinearRegression() # definicja modelu\n",
|
||||||
"model.fit(x_train, y_train) # dopasowanie modelu\n",
|
"model.fit(x_train, y_train) # dopasowanie modelu\n",
|
||||||
@ -147,14 +154,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 16,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"Błąd średniokwadratowy wynosi 137394744518.31197\n"
|
"Błąd średniokwadratowy wynosi 1179760250402.185\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -175,14 +182,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 17,
|
"execution_count": 4,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"0.2160821272059249\n"
|
"-10.712011261173265\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -206,7 +213,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 19,
|
"execution_count": 1,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
@ -218,6 +225,14 @@
|
|||||||
"F-score: 1.0\n",
|
"F-score: 1.0\n",
|
||||||
"Model score: 1.0\n"
|
"Model score: 1.0\n"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"/home/pawel/.local/lib/python3.10/site-packages/sklearn/utils/validation.py:1111: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
|
||||||
|
" y = column_or_1d(y, warn=True)\n"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
@ -239,7 +254,7 @@
|
|||||||
"data_train, data_test = train_test_split(data_iris, test_size=0.2)\n",
|
"data_train, data_test = train_test_split(data_iris, test_size=0.2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Uczenie modelu\n",
|
"# Uczenie modelu\n",
|
||||||
"y_train = pd.Series(data_train[\"Iris setosa?\"])\n",
|
"y_train = pd.DataFrame(data_train[\"Iris setosa?\"])\n",
|
||||||
"x_train = pd.DataFrame(data_train[FEATURES])\n",
|
"x_train = pd.DataFrame(data_train[FEATURES])\n",
|
||||||
"model = LogisticRegression() # definicja modelu\n",
|
"model = LogisticRegression() # definicja modelu\n",
|
||||||
"model.fit(x_train, y_train) # dopasowanie modelu\n",
|
"model.fit(x_train, y_train) # dopasowanie modelu\n",
|
||||||
|
@ -714,7 +714,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Proces wczytywania danych i przetwarzania ich przez sieć ułatwiają klasy `Dataset` i `DataLoader`: https://pytorch.org/tutorials/beginner/basics/data_tutorial.html"
|
"Tutaj artykuł o tym, jak stworzyć dataloader dla danych z własnego pliku CSV: https://androidkt.com/load-pandas-dataframe-using-dataset-and-dataloader-in-pytorch"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -735,7 +735,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.12.3"
|
"version": "3.10.12"
|
||||||
},
|
},
|
||||||
"livereveal": {
|
"livereveal": {
|
||||||
"start_slideshow_at": "selected",
|
"start_slideshow_at": "selected",
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user