update main

This commit is contained in:
sadurska@trui.pl 2021-06-08 23:36:45 +02:00
parent 0e4b12691c
commit ca4f919157

View File

@ -28,17 +28,13 @@
"import torch\n", "import torch\n",
"import pandas as pd\n", "import pandas as pd\n",
"\n", "\n",
"from sklearn.model_selection import train_test_split\n",
"from torchtext.vocab import Vocab\n", "from torchtext.vocab import Vocab\n",
"from collections import Counter\n", "from collections import Counter\n",
"from sklearn.feature_extraction.text import TfidfVectorizer\n",
"from sklearn.metrics import accuracy_score\n",
"\n", "\n",
"import lzma\n", "import lzma\n",
"import re\n", "import re"
"import itertools"
], ],
"execution_count": 2, "execution_count": null,
"outputs": [] "outputs": []
}, },
{ {
@ -60,7 +56,7 @@
" x = self.softmax(x)\n", " x = self.softmax(x)\n",
" return x" " return x"
], ],
"execution_count": 22, "execution_count": null,
"outputs": [] "outputs": []
}, },
{ {
@ -82,7 +78,7 @@
" x = self.fc1(x)\n", " x = self.fc1(x)\n",
" return x" " return x"
], ],
"execution_count": 23, "execution_count": null,
"outputs": [] "outputs": []
}, },
{ {
@ -111,7 +107,7 @@
"for i in range(len(ner_tags_set)):\n", "for i in range(len(ner_tags_set)):\n",
" ner_tags_dictionary[ner_tags_set[i]] = i" " ner_tags_dictionary[ner_tags_set[i]] = i"
], ],
"execution_count": 46, "execution_count": null,
"outputs": [] "outputs": []
}, },
{ {
@ -141,7 +137,7 @@
"train_tokens_ids = data_preprocessing(tokens)\n", "train_tokens_ids = data_preprocessing(tokens)\n",
"train_labels = labels_preprocessing(ner_tags)" "train_labels = labels_preprocessing(ner_tags)"
], ],
"execution_count": 47, "execution_count": null,
"outputs": [] "outputs": []
}, },
{ {
@ -215,7 +211,7 @@
" display('recall: : ', recall)\n", " display('recall: : ', recall)\n",
" display('f1: ', f1_score)" " display('f1: ', f1_score)"
], ],
"execution_count": 27, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "display_data", "output_type": "display_data",
@ -539,7 +535,7 @@
"test_tokens_ids = data_preprocessing(dev_0_data)\n", "test_tokens_ids = data_preprocessing(dev_0_data)\n",
"test_labels = labels_preprocessing(dev_0_tags)\n" "test_labels = labels_preprocessing(dev_0_tags)\n"
], ],
"execution_count": 41, "execution_count": null,
"outputs": [] "outputs": []
}, },
{ {
@ -601,7 +597,7 @@
"display('recall: : ', recall)\n", "display('recall: : ', recall)\n",
"display('f1: ', f1_score)" "display('f1: ', f1_score)"
], ],
"execution_count": 42, "execution_count": null,
"outputs": [ "outputs": [
{ {
"output_type": "display_data", "output_type": "display_data",
@ -763,7 +759,7 @@
" Y_predictions = ner_model(X)\n", " Y_predictions = ner_model(X)\n",
" result[i].append(int(torch.argmax(Y_predictions)))" " result[i].append(int(torch.argmax(Y_predictions)))"
], ],
"execution_count": 49, "execution_count": null,
"outputs": [] "outputs": []
} }
] ]