forked from pms/uczenie-maszynowe
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
12fe073db0 | ||
|
d9f660474c | ||
|
7bf375944a | ||
|
a367ed7abf | ||
|
2af4ea2178 | ||
|
afd3d92f3f |
@ -44,23 +44,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[[332187.32537534]\n",
|
||||
" [369587.77676738]\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"
|
||||
"[279661.8663101 279261.14658016 522543.09697553 243798.45172733\n",
|
||||
" 408919.21577439 272940.5507781 367515.38801642 592972.56867895\n",
|
||||
" 418509.89826131 943578.7139463 ]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -84,7 +77,7 @@
|
||||
"def preprocess(data):\n",
|
||||
" \"\"\"Wstępne przetworzenie danych\"\"\"\n",
|
||||
" data = data.replace({\"parter\": 0, \"poddasze\": 0}, regex=True)\n",
|
||||
" data = data.applymap(np.nan_to_num) # Zamienia \"NaN\" na liczby\n",
|
||||
" data = data.map(np.nan_to_num) # Zamienia \"NaN\" na liczby\n",
|
||||
" return data\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@ -101,7 +94,7 @@
|
||||
"data_train, data_test = train_test_split(data, test_size=0.2)\n",
|
||||
"\n",
|
||||
"# Uczenie modelu\n",
|
||||
"y_train = pd.DataFrame(data_train[\"cena\"])\n",
|
||||
"y_train = pd.Series(data_train[\"cena\"])\n",
|
||||
"x_train = pd.DataFrame(data_train[FEATURES])\n",
|
||||
"model = LinearRegression() # definicja modelu\n",
|
||||
"model.fit(x_train, y_train) # dopasowanie modelu\n",
|
||||
@ -154,14 +147,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Błąd średniokwadratowy wynosi 1179760250402.185\n"
|
||||
"Błąd średniokwadratowy wynosi 137394744518.31197\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -182,14 +175,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"-10.712011261173265\n"
|
||||
"0.2160821272059249\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -213,7 +206,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -225,14 +218,6 @@
|
||||
"F-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": [
|
||||
@ -254,7 +239,7 @@
|
||||
"data_train, data_test = train_test_split(data_iris, test_size=0.2)\n",
|
||||
"\n",
|
||||
"# Uczenie modelu\n",
|
||||
"y_train = pd.DataFrame(data_train[\"Iris setosa?\"])\n",
|
||||
"y_train = pd.Series(data_train[\"Iris setosa?\"])\n",
|
||||
"x_train = pd.DataFrame(data_train[FEATURES])\n",
|
||||
"model = LogisticRegression() # definicja modelu\n",
|
||||
"model.fit(x_train, y_train) # dopasowanie modelu\n",
|
||||
|
@ -714,7 +714,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"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"
|
||||
"Proces wczytywania danych i przetwarzania ich przez sieć ułatwiają klasy `Dataset` i `DataLoader`: https://pytorch.org/tutorials/beginner/basics/data_tutorial.html"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -735,7 +735,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.12"
|
||||
"version": "3.12.3"
|
||||
},
|
||||
"livereveal": {
|
||||
"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