full train results

This commit is contained in:
Szymon Polak 2021-05-17 10:39:55 +02:00
parent 393630083f
commit 996589b699
5 changed files with 45836 additions and 41 deletions

20000
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

11563
dev-1/out.tsv Normal file

File diff suppressed because it is too large Load Diff

BIN
geval Normal file

Binary file not shown.

View File

@ -1,38 +1,13 @@
{ {
"metadata": {
"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.8.3"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python38332bit715560a51b8a44948ee59d26a58cf272",
"display_name": "Python 3.8.3 32-bit"
},
"metadata": {
"interpreter": {
"hash": "d4bdc0d8028da516e3b937f3ab23da3f18f7264589053952c883afefa2219368"
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import pandas as pd\n", "import pandas as pd\n",
"import csv\n",
"from sklearn.linear_model import LinearRegression\n", "from sklearn.linear_model import LinearRegression\n",
"from stop_words import get_stop_words\n", "from stop_words import get_stop_words\n",
"from sklearn.feature_extraction.text import TfidfVectorizer" "from sklearn.feature_extraction.text import TfidfVectorizer"
@ -40,37 +15,48 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"data": {
"text/plain": [
"LinearRegression()"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"#trening\n", "#trening\n",
"\n", "\n",
"#dane treningowe\n", "#dane treningowe\n",
"train_data = pd.read_csv('train/train.tsv.xz', compression='xz', sep='\\t')\n", "train_data = pd.read_csv('train/train.tsv.xz', compression='xz', header=None, sep='\\t')\n",
"\n", "\n",
"#regresja liniowa\n", "#regresja liniowa\n",
"LR = LinearRegression()\n", "LR = LinearRegression()\n",
"#vectorizer\n", "#vectorizer\n",
"VEC = TfidfVectorizer(stop_words=get_stop_words('polish'))\n", "VEC = TfidfVectorizer(stop_words=get_stop_words('polish'))\n",
"#wektoryzacja danych treningowych\n", "#wektoryzacja danych treningowych\n",
"train_x = VEC.fit_transform(train_data[2])\n", "train_x = VEC.fit_transform(train_data[4])\n",
"#średnia dat\n", "#średnia dat\n",
"dm = mean([train_data[0],train_data[1]])\n", "dm = (train_data[0] + train_data[1])/2\n",
"#trening\n", "#trening\n",
"LR.fit(train_x, dm)" "LR.fit(train_x, dm)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#dev-0 predict\n", "#dev-0 predict\n",
"\n", "\n",
"#dane treningowe\n", "#dane treningowe\n",
"dev0_data = pd.read_csv('dev-0/in.tsv', sep='\\t')\n", "dev0_data = pd.read_csv('dev-0/in.tsv', header=None, error_bad_lines=False, quoting=csv.QUOTE_NONE, sep='\\t')\n",
"\n", "\n",
"#wektoryzacja danych treningowych\n", "#wektoryzacja danych treningowych\n",
"dev0_x = VEC.transform(dev0_data[0])\n", "dev0_x = VEC.transform(dev0_data[0])\n",
@ -82,7 +68,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 16,
"metadata": { "metadata": {
"tags": [] "tags": []
}, },
@ -91,7 +77,7 @@
"#dev-1 predict\n", "#dev-1 predict\n",
"\n", "\n",
"#dane treningowe\n", "#dane treningowe\n",
"dev1_data = pd.read_csv('dev-1/in.tsv', sep='\\t')\n", "dev1_data = pd.read_csv('dev-1/in.tsv', header=None, error_bad_lines=False, quoting=csv.QUOTE_NONE, sep='\\t')\n",
"\n", "\n",
"#wektoryzacja danych treningowych\n", "#wektoryzacja danych treningowych\n",
"dev1_x = VEC.transform(dev1_data[0])\n", "dev1_x = VEC.transform(dev1_data[0])\n",
@ -103,22 +89,48 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#test-A predict\n", "#test-A predict\n",
"\n", "\n",
"#dane treningowe\n", "#dane treningowe\n",
"testA_data = pd.read_csv('testA/in.tsv', sep='\\t')\n", "testA_data = pd.read_csv('test-A/in.tsv', header=None, error_bad_lines=False, quoting=csv.QUOTE_NONE, sep='\\t')\n",
"\n", "\n",
"#wektoryzacja danych treningowych\n", "#wektoryzacja danych treningowych\n",
"testA_x = VEC.transform(testA_data[0])\n", "testA_x = VEC.transform(testA_data[0])\n",
"#predykcja\n", "#predykcja\n",
"testA_y = LR.predict(testA_x)\n", "testA_y = LR.predict(testA_x)\n",
"#zapis wyników\n", "#zapis wyników\n",
"testA_y.tofile('testA/out.tsv', sep='\\n')" "testA_y.tofile('test-A/out.tsv', sep='\\n')"
] ]
} }
] ],
} "metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.8.0"
},
"metadata": {
"interpreter": {
"hash": "d4bdc0d8028da516e3b937f3ab23da3f18f7264589053952c883afefa2219368"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

14220
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff