From e1742a1a535fb3322f6e118e94efec9bbd992cca Mon Sep 17 00:00:00 2001 From: Jakub Pokrywka Date: Thu, 26 May 2022 13:58:31 +0200 Subject: [PATCH] fix bug --- cw/09_sequence_labeling.ipynb | 148 +++++++++++++++++----------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/cw/09_sequence_labeling.ipynb b/cw/09_sequence_labeling.ipynb index 4c0c248..32e8283 100644 --- a/cw/09_sequence_labeling.ipynb +++ b/cw/09_sequence_labeling.ipynb @@ -23,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -61,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -70,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -79,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -97,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 7, "metadata": { "scrolled": true }, @@ -117,7 +117,7 @@ "['From: nigel.allen@canrem.com (Nigel Allen)\\nSubject: library of congress to host dead sea scroll symposium april 21-22\\nLines: 96\\n\\n\\n Library of Congress to Host Dead Sea Scroll Symposium April 21-22\\n To: National and Assignment desks, Daybook Editor\\n Contact: John Sullivan, 202-707-9216, or Lucy Suddreth, 202-707-9191\\n both of the Library of Congress\\n\\n WASHINGTON, April 19 -- A symposium on the Dead Sea \\nScrolls will be held at the Library of Congress on Wednesday,\\nApril 21, and Thursday, April 22. The two-day program, cosponsored\\nby the library and Baltimore Hebrew University, with additional\\nsupport from the Project Judaica Foundation, will be held in the\\nlibrary\\'s Mumford Room, sixth floor, Madison Building.\\n Seating is limited, and admission to any session of the symposium\\nmust be requested in writing (see Note A).\\n The symposium will be held one week before the public opening of a\\nmajor exhibition, \"Scrolls from the Dead Sea: The Ancient Library of\\nQumran and Modern Scholarship,\" that opens at the Library of Congress\\non April 29. On view will be fragmentary scrolls and archaeological\\nartifacts excavated at Qumran, on loan from the Israel Antiquities\\nAuthority. Approximately 50 items from Library of Congress special\\ncollections will augment these materials. The exhibition, on view in\\nthe Madison Gallery, through Aug. 1, is made possible by a generous\\ngift from the Project Judaica Foundation of Washington, D.C.\\n The Dead Sea Scrolls have been the focus of public and scholarly\\ninterest since 1947, when they were discovered in the desert 13 miles\\neast of Jerusalem. The symposium will explore the origin and meaning\\nof the scrolls and current scholarship. Scholars from diverse\\nacademic backgrounds and religious affiliations, will offer their\\ndisparate views, ensuring a lively discussion.\\n The symposium schedule includes opening remarks on April 21, at\\n2 p.m., by Librarian of Congress James H. Billington, and by\\nDr. Norma Furst, president, Baltimore Hebrew University. Co-chairing\\nthe symposium are Joseph Baumgarten, professor of Rabbinic Literature\\nand Institutions, Baltimore Hebrew University and Michael Grunberger,\\nhead, Hebraic Section, Library of Congress.\\n Geza Vermes, professor emeritus of Jewish studies, Oxford\\nUniversity, will give the keynote address on the current state of\\nscroll research, focusing on where we stand today. On the second\\nday, the closing address will be given by Shmaryahu Talmon, who will\\npropose a research agenda, picking up the theme of how the Qumran\\nstudies might proceed.\\n On Wednesday, April 21, other speakers will include:\\n\\n -- Eugene Ulrich, professor of Hebrew Scriptures, University of\\nNotre Dame and chief editor, Biblical Scrolls from Qumran, on \"The\\nBible at Qumran;\"\\n -- Michael Stone, National Endowment for the Humanities\\ndistinguished visiting professor of religious studies, University of\\nRichmond, on \"The Dead Sea Scrolls and the Pseudepigrapha.\"\\n -- From 5 p.m. to 6:30 p.m. a special preview of the exhibition\\nwill be given to symposium participants and guests.\\n\\n On Thursday, April 22, beginning at 9 a.m., speakers will include:\\n\\n -- Magen Broshi, curator, shrine of the Book, Israel Museum,\\nJerusalem, on \"Qumran: The Archaeological Evidence;\"\\n -- P. Kyle McCarter, Albright professor of Biblical and ancient\\nnear Eastern studies, The Johns Hopkins University, on \"The Copper\\nScroll;\"\\n -- Lawrence H. Schiffman, professor of Hebrew and Judaic studies,\\nNew York University, on \"The Dead Sea Scrolls and the History of\\nJudaism;\" and\\n -- James VanderKam, professor of theology, University of Notre\\nDame, on \"Messianism in the Scrolls and in Early Christianity.\"\\n\\n The Thursday afternoon sessions, at 1:30 p.m., include:\\n\\n -- Devorah Dimant, associate professor of Bible and Ancient Jewish\\nThought, University of Haifa, on \"Qumran Manuscripts: Library of a\\nJewish Community;\"\\n -- Norman Golb, Rosenberger professor of Jewish history and\\ncivilization, Oriental Institute, University of Chicago, on \"The\\nCurrent Status of the Jerusalem Origin of the Scrolls;\"\\n -- Shmaryahu Talmon, J.L. Magnas professor emeritus of Biblical\\nstudies, Hebrew University, Jerusalem, on \"The Essential \\'Commune of\\nthe Renewed Covenant\\': How Should Qumran Studies Proceed?\" will close\\nthe symposium.\\n\\n There will be ample time for question and answer periods at the\\nend of each session.\\n\\n Also on Wednesday, April 21, at 11 a.m.:\\n The Library of Congress and The Israel Antiquities Authority\\nwill hold a lecture by Esther Boyd-Alkalay, consulting conservator,\\nIsrael Antiquities Authority, on \"Preserving the Dead Sea Scrolls\"\\nin the Mumford Room, LM-649, James Madison Memorial Building, The\\nLibrary of Congress, 101 Independence Ave., S.E., Washington, D.C.\\n ------\\n NOTE A: For more information about admission to the symposium,\\nplease contact, in writing, Dr. Michael Grunberger, head, Hebraic\\nSection, African and Middle Eastern Division, Library of Congress,\\nWashington, D.C. 20540.\\n -30-\\n--\\nCanada Remote Systems - Toronto, Ontario\\n416-629-7000/629-7044\\n']" ] }, - "execution_count": 20, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -128,7 +128,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -137,7 +137,7 @@ "array([1, 0, 1, ..., 0, 1, 1])" ] }, - "execution_count": 21, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -148,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 9, "metadata": { "scrolled": true }, @@ -159,7 +159,7 @@ "['alt.atheism', 'soc.religion.christian']" ] }, - "execution_count": 22, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -170,7 +170,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -186,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -196,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -206,7 +206,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -216,7 +216,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -225,7 +225,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -234,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -243,7 +243,7 @@ "0" ] }, - "execution_count": 31, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -254,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -263,7 +263,7 @@ "array([7, 4, 4, ..., 3, 1, 8])" ] }, - "execution_count": 32, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -274,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -302,7 +302,7 @@ " 'talk.religion.misc']" ] }, - "execution_count": 33, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -320,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 19, "metadata": { "scrolled": false }, @@ -351,7 +351,7 @@ "dtype: int64" ] }, - "execution_count": 34, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -362,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -371,7 +371,7 @@ "0.05297397769516728" ] }, - "execution_count": 36, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -402,7 +402,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -413,7 +413,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -422,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -432,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 24, "metadata": {}, "outputs": [], "source": [ @@ -442,7 +442,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -451,7 +451,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -460,7 +460,7 @@ "array([17])" ] }, - "execution_count": 46, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -471,7 +471,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -480,7 +480,7 @@ "[\"From: DSHAL@vmd.cso.uiuc.edu\\nSubject: Re: Clintons views on Jerusalem\\nOrganization: C.C.S.O.\\nLines: 10\\n\\nIt seems that President Clinton can recognize Jerusalem as Israels capitol\\nwhile still keeping his diplomatic rear door open by stating that the Parties\\nconcerned should decide the city's final status. Even as I endorse Clintons vie\\nw (of course), it is definitely a matter to be decided upon by Israel (and\\nother participating neighboring contries).\\nI see no real conflict in stating both views, nor expect any better from\\npoliticians.\\n-----\\nDavid Shalhevet / dshal@vmd.cso.uiuc.edu / University of Illinois\\nDept Anim Sci / 220 PABL / 1201 W. Gregory Dr. / Urbana, IL 61801\\n\"]" ] }, - "execution_count": 49, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } @@ -491,7 +491,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -501,7 +501,7 @@ "\twith 72 stored elements in Compressed Sparse Row format>" ] }, - "execution_count": 48, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -512,7 +512,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 29, "metadata": { "scrolled": true }, @@ -526,7 +526,7 @@ " 0.04601515, 0.03421612, 0.31493021, 0.06406168, 0.02710846]])" ] }, - "execution_count": 47, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } @@ -537,7 +537,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -546,7 +546,7 @@ "0.31493021311781716" ] }, - "execution_count": 50, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -557,7 +557,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -566,7 +566,7 @@ "0.9558043606364172" ] }, - "execution_count": 51, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } @@ -577,7 +577,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -586,7 +586,7 @@ "0.8745139625309296" ] }, - "execution_count": 52, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -597,7 +597,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -606,7 +606,7 @@ "0.8027084439723845" ] }, - "execution_count": 53, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -633,7 +633,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 34, "metadata": {}, "outputs": [ { @@ -643,7 +643,7 @@ "\twith 1115170 stored elements in Compressed Sparse Row format>" ] }, - "execution_count": 57, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -654,7 +654,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 35, "metadata": {}, "outputs": [], "source": [ @@ -663,7 +663,7 @@ " def __init__(self,FEAUTERES, output_size):\n", " super(NeuralNetworkModel, self).__init__()\n", " self.fc1 = torch.nn.Linear(FEAUTERES,OUTPUT_SIZE)\n", - " self.softmax = torch.nn.LogSoftmax(dim=0)\n", + " self.softmax = torch.nn.LogSoftmax(dim=1)\n", " \n", "\n", " def forward(self, x):\n", @@ -674,7 +674,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 36, "metadata": {}, "outputs": [], "source": [ @@ -683,7 +683,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ @@ -692,7 +692,7 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": 38, "metadata": {}, "outputs": [ { @@ -701,7 +701,7 @@ "torch.Size([3, 10000])" ] }, - "execution_count": 78, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } @@ -712,24 +712,24 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "tensor([[-1.1011, -1.0970, -1.0999, -1.0927, -1.0981, -1.1001, -1.1005, -1.0943,\n", - " -1.0891, -1.1016, -1.1011, -1.1024, -1.1011, -1.1026, -1.1010, -1.0956,\n", - " -1.1007, -1.0912, -1.0943, -1.0976],\n", - " [-1.0939, -1.1010, -1.1079, -1.0998, -1.0978, -1.1030, -1.0976, -1.0997,\n", - " -1.1038, -1.1023, -1.1019, -1.1027, -1.0921, -1.1030, -1.1009, -1.1022,\n", - " -1.0965, -1.1024, -1.1032, -1.0996],\n", - " [-1.1008, -1.0979, -1.0881, -1.1034, -1.1000, -1.0928, -1.0978, -1.1018,\n", - " -1.1030, -1.0919, -1.0929, -1.0908, -1.1027, -1.0903, -1.0939, -1.0980,\n", - " -1.0986, -1.1024, -1.0984, -1.0987]], grad_fn=)" + "tensor([[-2.9994, -2.9932, -2.9925, -3.0006, -3.0067, -2.9946, -2.9861, -2.9916,\n", + " -2.9999, -2.9961, -3.0110, -2.9877, -2.9864, -2.9953, -2.9940, -3.0081,\n", + " -2.9930, -2.9893, -2.9899, -2.9997],\n", + " [-2.9992, -2.9876, -2.9953, -3.0049, -3.0003, -2.9856, -2.9890, -2.9889,\n", + " -2.9993, -3.0052, -3.0034, -2.9933, -2.9949, -2.9952, -3.0020, -2.9967,\n", + " -2.9868, -2.9948, -2.9885, -3.0042],\n", + " [-3.0028, -2.9884, -2.9998, -3.0043, -2.9949, -2.9838, -2.9941, -2.9926,\n", + " -2.9920, -2.9893, -3.0087, -2.9848, -2.9942, -3.0030, -3.0020, -3.0027,\n", + " -2.9836, -3.0018, -2.9880, -3.0045]], grad_fn=)" ] }, - "execution_count": 80, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -740,7 +740,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 40, "metadata": {}, "outputs": [], "source": [ @@ -749,7 +749,7 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 41, "metadata": {}, "outputs": [], "source": [ @@ -758,7 +758,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -12427,7 +12427,7 @@ " super(NERModel, self).__init__()\n", " self.emb = torch.nn.Embedding(23627,200)\n", " self.fc1 = torch.nn.Linear(600,9)\n", - " #self.softmax = torch.nn.Softmax(dim=0)\n", + " #self.softmax = torch.nn.Softmax(dim=1)\n", " # nie trzeba, bo używamy https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html\n", " # jako kryterium\n", " \n", @@ -12993,7 +12993,7 @@ "author": "Jakub Pokrywka", "email": "kubapok@wmi.amu.edu.pl", "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -13008,7 +13008,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.3" + "version": "3.10.4" }, "subtitle": "9.Sequence labeling[ćwiczenia]", "title": "Ekstrakcja informacji",