diff --git a/Neural graph module/ngm.ipynb b/Neural graph module/ngm.ipynb index 303e0909ef4f68fccbddc758a6c5d890c1eebfe3..12c6bc468947ef9267a3752b1ba1d7a7419e8af5 100644 --- a/Neural graph module/ngm.ipynb +++ b/Neural graph module/ngm.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "c:\\Users\\maxbj\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\tqdm\\auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + "b:\\Programs\\Miniconda\\envs\\tdde19\\lib\\site-packages\\tqdm\\auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -38,9 +38,17 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "cuda\n" + ] + } + ], "source": [ "# Use GPU if available\n", "device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n", @@ -50,7 +58,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -60,7 +68,7 @@ " super(NgmOne, self).__init__()\n", " self.tokenizer = BertTokenizer.from_pretrained(\"bert-base-uncased\")\n", " self.bert = BertModel.from_pretrained(\"bert-base-uncased\").to(device)\n", - " self.linear = nn.Linear(768, 247).to(device)\n", + " self.linear = nn.Linear(768, 163).to(device)\n", " self.softmax = nn.Softmax(dim=1).to(device)\n", " self.device = device\n", " \n", @@ -78,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -116,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -186,7 +194,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -203,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -225,7 +233,6 @@ "\n", "\n", "\n", - "\n", "#From scratch json creates data set.\n", "# class MyDataset(Dataset):\n", "# def __init__(self, json_file, transform=None):\n", @@ -254,19 +261,14 @@ "name": "stderr", "output_type": "stream", "text": [ - "Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.predictions.decoder.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.dense.weight', 'cls.seq_relationship.weight', 'cls.predictions.bias']\n", - "- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", - "- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n" + "100%|██████████| 408/408 [00:00<00:00, 792.24it/s]" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "Finished with batches\n", - "features: tensor([[ 101, 2040, 2003, 1996, 3677, 1997, 1996, 4035, 6870, 19247,\n", - " 1029, 102, 1031, 4942, 1033, 102, 0, 0, 0, 0,\n", - " 0, 0, 0]]) mask: tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0]]) label_index tensor(81)\n" + "Finished with batches\n" ] }, { @@ -275,6 +277,15 @@ "text": [ "\n" ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "features: tensor([[ 101, 2040, 2003, 1996, 3664, 1997, 15632, 1029, 102, 1031,\n", + " 4942, 1033, 102, 0, 0, 0, 0, 0, 0, 0,\n", + " 0, 0, 0]]) mask: tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) label_index tensor(128)\n" + ] } ], "source": [ @@ -295,58 +306,41 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model = NgmOne(device)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, "metadata": {}, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.predictions.transform.dense.bias', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.decoder.weight']\n", - "- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", - "- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Finished with batches\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\n" - ] - }, - { - "ename": "ValueError", - "evalue": "'<http://dbpediaorg/property/launchPad>' is not in list", + "ename": "NameError", + "evalue": "name 'nn' is not defined", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn [43], line 11\u001b[0m\n\u001b[0;32m 8\u001b[0m relations \u001b[39m=\u001b[39m json\u001b[39m.\u001b[39mload(f)\n\u001b[0;32m 10\u001b[0m train, train_mask, corr_rels \u001b[39m=\u001b[39m make_batch()\n\u001b[1;32m---> 11\u001b[0m corr_indx \u001b[39m=\u001b[39m torch\u001b[39m.\u001b[39mLongTensor([relations\u001b[39m.\u001b[39mindex(r) \u001b[39mfor\u001b[39;00m r \u001b[39min\u001b[39;00m corr_rels])\u001b[39m.\u001b[39mto(device)\n\u001b[0;32m 13\u001b[0m \u001b[39mfor\u001b[39;00m epoch \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(EPOCHS):\n\u001b[0;32m 14\u001b[0m optimizer\u001b[39m.\u001b[39mzero_grad()\n", - "Cell \u001b[1;32mIn [43], line 11\u001b[0m, in \u001b[0;36m<listcomp>\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 8\u001b[0m relations \u001b[39m=\u001b[39m json\u001b[39m.\u001b[39mload(f)\n\u001b[0;32m 10\u001b[0m train, train_mask, corr_rels \u001b[39m=\u001b[39m make_batch()\n\u001b[1;32m---> 11\u001b[0m corr_indx \u001b[39m=\u001b[39m torch\u001b[39m.\u001b[39mLongTensor([relations\u001b[39m.\u001b[39;49mindex(r) \u001b[39mfor\u001b[39;00m r \u001b[39min\u001b[39;00m corr_rels])\u001b[39m.\u001b[39mto(device)\n\u001b[0;32m 13\u001b[0m \u001b[39mfor\u001b[39;00m epoch \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(EPOCHS):\n\u001b[0;32m 14\u001b[0m optimizer\u001b[39m.\u001b[39mzero_grad()\n", - "\u001b[1;31mValueError\u001b[0m: '<http://dbpediaorg/property/launchPad>' is not in list" + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32mc:\\Users\\Albin\\Documents\\TDDE19\\codebase\\Neural graph module\\ngm.ipynb Cell 11\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X13sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39m# Train with data loader.\u001b[39;00m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X13sZmlsZQ%3D%3D?line=2'>3</a>\u001b[0m criterion \u001b[39m=\u001b[39m nn\u001b[39m.\u001b[39mCrossEntropyLoss()\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X13sZmlsZQ%3D%3D?line=3'>4</a>\u001b[0m optimizer \u001b[39m=\u001b[39m optim\u001b[39m.\u001b[39mAdam(model\u001b[39m.\u001b[39mparameters(), lr\u001b[39m=\u001b[39m\u001b[39m0.0001\u001b[39m)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X13sZmlsZQ%3D%3D?line=5'>6</a>\u001b[0m epoch \u001b[39m=\u001b[39m \u001b[39m500\u001b[39m\n", + "\u001b[1;31mNameError\u001b[0m: name 'nn' is not defined" ] } ], "source": [ "# Train with data loader.\n", "\n", - "\n", - "\n", - "model = NgmOne(device)\n", "criterion = nn.CrossEntropyLoss()\n", - "optimizer = optim.Adam(model.parameters(), lr=0.001)\n", + "optimizer = optim.Adam(model.parameters(), lr=0.0001)\n", "\n", "epoch = 500\n", - "batch_size = 200\n", + "batch_size = 64\n", + "train_dataloader = DataLoader(train_set, batch_size=batch_size, shuffle=True)\n", "for e in range(epoch):\n", - " train_dataloader = DataLoader(train_set, batch_size=batch_size, shuffle=True)\n", + " epoch_loss = 0\n", " for i_batch, sample_batched in enumerate(train_dataloader):\n", " optimizer.zero_grad()\n", " train = sample_batched[0]\n", @@ -360,19 +354,482 @@ " # backward and optimize\n", " loss.backward()\n", " optimizer.step()\n", - " if i_batch % batch_size == 0:\n", - " print(\"Epoch\", e, \"batch:\",i_batch, ', loss =', '{:.6f}'.format(loss))\n", - " \n", - " \n", - " \n", - "\n" + " epoch_loss = epoch_loss + loss.item()\n", + " # if i_batch % batch_size == 0:\n", + " # print(\"Epoch\", e, \"batch:\",i_batch, ', loss =', '{:.6f}'.format(loss))\n", + " print(e+1, epoch_loss / len(sample_batched))" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.seq_relationship.weight', 'cls.predictions.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.bias']\n", + "- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n", + "- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Beginning making batch\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "100%|██████████| 408/408 [00:00<00:00, 774.16it/s]\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Finished with batches\n", + "Epoch: 0001 loss = 5.093835\n", + "Epoch: 0002 loss = 5.084588\n", + "Epoch: 0003 loss = 5.071274\n", + "Epoch: 0004 loss = 5.054411\n", + "Epoch: 0005 loss = 5.032239\n", + "Epoch: 0006 loss = 5.012146\n", + "Epoch: 0007 loss = 5.005000\n", + "Epoch: 0008 loss = 4.997761\n", + "Epoch: 0009 loss = 4.986701\n", + "Epoch: 0010 loss = 4.971669\n", + "Epoch: 0011 loss = 4.955543\n", + "Epoch: 0012 loss = 4.943308\n", + "Epoch: 0013 loss = 4.935583\n", + "Epoch: 0014 loss = 4.925481\n", + "Epoch: 0015 loss = 4.916763\n", + "Epoch: 0016 loss = 4.909473\n", + "Epoch: 0017 loss = 4.902980\n", + "Epoch: 0018 loss = 4.897297\n", + "Epoch: 0019 loss = 4.891988\n", + "Epoch: 0020 loss = 4.886408\n", + "Epoch: 0021 loss = 4.881417\n", + "Epoch: 0022 loss = 4.877658\n", + "Epoch: 0023 loss = 4.875204\n", + "Epoch: 0024 loss = 4.873054\n", + "Epoch: 0025 loss = 4.870307\n", + "Epoch: 0026 loss = 4.867515\n", + "Epoch: 0027 loss = 4.865225\n", + "Epoch: 0028 loss = 4.863073\n", + "Epoch: 0029 loss = 4.861112\n", + "Epoch: 0030 loss = 4.859608\n", + "Epoch: 0031 loss = 4.858322\n", + "Epoch: 0032 loss = 4.856856\n", + "Epoch: 0033 loss = 4.854882\n", + "Epoch: 0034 loss = 4.851583\n", + "Epoch: 0035 loss = 4.846420\n", + "Epoch: 0036 loss = 4.841257\n", + "Epoch: 0037 loss = 4.839985\n", + "Epoch: 0038 loss = 4.838554\n", + "Epoch: 0039 loss = 4.833128\n", + "Epoch: 0040 loss = 4.830694\n", + "Epoch: 0041 loss = 4.830802\n", + "Epoch: 0042 loss = 4.829382\n", + "Epoch: 0043 loss = 4.828467\n", + "Epoch: 0044 loss = 4.828149\n", + "Epoch: 0045 loss = 4.827055\n", + "Epoch: 0046 loss = 4.824977\n", + "Epoch: 0047 loss = 4.822845\n", + "Epoch: 0048 loss = 4.821745\n", + "Epoch: 0049 loss = 4.821719\n", + "Epoch: 0050 loss = 4.821740\n", + "Epoch: 0051 loss = 4.820979\n", + "Epoch: 0052 loss = 4.819626\n", + "Epoch: 0053 loss = 4.818414\n", + "Epoch: 0054 loss = 4.817791\n", + "Epoch: 0055 loss = 4.817641\n", + "Epoch: 0056 loss = 4.817585\n", + "Epoch: 0057 loss = 4.817320\n", + "Epoch: 0058 loss = 4.816803\n", + "Epoch: 0059 loss = 4.816196\n", + "Epoch: 0060 loss = 4.815702\n", + "Epoch: 0061 loss = 4.815412\n", + "Epoch: 0062 loss = 4.815280\n", + "Epoch: 0063 loss = 4.815196\n", + "Epoch: 0064 loss = 4.815063\n", + "Epoch: 0065 loss = 4.814850\n", + "Epoch: 0066 loss = 4.814575\n", + "Epoch: 0067 loss = 4.814219\n", + "Epoch: 0068 loss = 4.813494\n", + "Epoch: 0069 loss = 4.812033\n", + "Epoch: 0070 loss = 4.810763\n", + "Epoch: 0071 loss = 4.810414\n", + "Epoch: 0072 loss = 4.810355\n", + "Epoch: 0073 loss = 4.810412\n", + "Epoch: 0074 loss = 4.810295\n", + "Epoch: 0075 loss = 4.809524\n", + "Epoch: 0076 loss = 4.808568\n", + "Epoch: 0077 loss = 4.807861\n", + "Epoch: 0078 loss = 4.807343\n", + "Epoch: 0079 loss = 4.806979\n", + "Epoch: 0080 loss = 4.806736\n", + "Epoch: 0081 loss = 4.806551\n", + "Epoch: 0082 loss = 4.806396\n", + "Epoch: 0083 loss = 4.806274\n", + "Epoch: 0084 loss = 4.806180\n", + "Epoch: 0085 loss = 4.806106\n", + "Epoch: 0086 loss = 4.806038\n", + "Epoch: 0087 loss = 4.805974\n", + "Epoch: 0088 loss = 4.805913\n", + "Epoch: 0089 loss = 4.805856\n", + "Epoch: 0090 loss = 4.805807\n", + "Epoch: 0091 loss = 4.805765\n", + "Epoch: 0092 loss = 4.805728\n", + "Epoch: 0093 loss = 4.805696\n", + "Epoch: 0094 loss = 4.805665\n", + "Epoch: 0095 loss = 4.805635\n", + "Epoch: 0096 loss = 4.805604\n", + "Epoch: 0097 loss = 4.805574\n", + "Epoch: 0098 loss = 4.805547\n", + "Epoch: 0099 loss = 4.805521\n", + "Epoch: 0100 loss = 4.805498\n", + "Epoch: 0101 loss = 4.805474\n", + "Epoch: 0102 loss = 4.805451\n", + "Epoch: 0103 loss = 4.805429\n", + "Epoch: 0104 loss = 4.805408\n", + "Epoch: 0105 loss = 4.805386\n", + "Epoch: 0106 loss = 4.805366\n", + "Epoch: 0107 loss = 4.805346\n", + "Epoch: 0108 loss = 4.805329\n", + "Epoch: 0109 loss = 4.805310\n", + "Epoch: 0110 loss = 4.805292\n", + "Epoch: 0111 loss = 4.805275\n", + "Epoch: 0112 loss = 4.805256\n", + "Epoch: 0113 loss = 4.805240\n", + "Epoch: 0114 loss = 4.805222\n", + "Epoch: 0115 loss = 4.805207\n", + "Epoch: 0116 loss = 4.805192\n", + "Epoch: 0117 loss = 4.805176\n", + "Epoch: 0118 loss = 4.805163\n", + "Epoch: 0119 loss = 4.805148\n", + "Epoch: 0120 loss = 4.805134\n", + "Epoch: 0121 loss = 4.805120\n", + "Epoch: 0122 loss = 4.805106\n", + "Epoch: 0123 loss = 4.805093\n", + "Epoch: 0124 loss = 4.805080\n", + "Epoch: 0125 loss = 4.805068\n", + "Epoch: 0126 loss = 4.805055\n", + "Epoch: 0127 loss = 4.805042\n", + "Epoch: 0128 loss = 4.805030\n", + "Epoch: 0129 loss = 4.805019\n", + "Epoch: 0130 loss = 4.805007\n", + "Epoch: 0131 loss = 4.804996\n", + "Epoch: 0132 loss = 4.804984\n", + "Epoch: 0133 loss = 4.804973\n", + "Epoch: 0134 loss = 4.804961\n", + "Epoch: 0135 loss = 4.804952\n", + "Epoch: 0136 loss = 4.804941\n", + "Epoch: 0137 loss = 4.804930\n", + "Epoch: 0138 loss = 4.804919\n", + "Epoch: 0139 loss = 4.804910\n", + "Epoch: 0140 loss = 4.804900\n", + "Epoch: 0141 loss = 4.804890\n", + "Epoch: 0142 loss = 4.804880\n", + "Epoch: 0143 loss = 4.804871\n", + "Epoch: 0144 loss = 4.804861\n", + "Epoch: 0145 loss = 4.804852\n", + "Epoch: 0146 loss = 4.804842\n", + "Epoch: 0147 loss = 4.804834\n", + "Epoch: 0148 loss = 4.804825\n", + "Epoch: 0149 loss = 4.804816\n", + "Epoch: 0150 loss = 4.804807\n", + "Epoch: 0151 loss = 4.804799\n", + "Epoch: 0152 loss = 4.804790\n", + "Epoch: 0153 loss = 4.804782\n", + "Epoch: 0154 loss = 4.804773\n", + "Epoch: 0155 loss = 4.804766\n", + "Epoch: 0156 loss = 4.804757\n", + "Epoch: 0157 loss = 4.804749\n", + "Epoch: 0158 loss = 4.804741\n", + "Epoch: 0159 loss = 4.804733\n", + "Epoch: 0160 loss = 4.804725\n", + "Epoch: 0161 loss = 4.804718\n", + "Epoch: 0162 loss = 4.804710\n", + "Epoch: 0163 loss = 4.804703\n", + "Epoch: 0164 loss = 4.804695\n", + "Epoch: 0165 loss = 4.804688\n", + "Epoch: 0166 loss = 4.804681\n", + "Epoch: 0167 loss = 4.804673\n", + "Epoch: 0168 loss = 4.804665\n", + "Epoch: 0169 loss = 4.804657\n", + "Epoch: 0170 loss = 4.804648\n", + "Epoch: 0171 loss = 4.804638\n", + "Epoch: 0172 loss = 4.804619\n", + "Epoch: 0173 loss = 4.804549\n", + "Epoch: 0174 loss = 4.803915\n", + "Epoch: 0175 loss = 4.800674\n", + "Epoch: 0176 loss = 4.797853\n", + "Epoch: 0177 loss = 4.798222\n", + "Epoch: 0178 loss = 4.800125\n", + "Epoch: 0179 loss = 4.798518\n", + "Epoch: 0180 loss = 4.797715\n", + "Epoch: 0181 loss = 4.797562\n", + "Epoch: 0182 loss = 4.797585\n", + "Epoch: 0183 loss = 4.797699\n", + "Epoch: 0184 loss = 4.797858\n", + "Epoch: 0185 loss = 4.797929\n", + "Epoch: 0186 loss = 4.797824\n", + "Epoch: 0187 loss = 4.797550\n", + "Epoch: 0188 loss = 4.796398\n", + "Epoch: 0189 loss = 4.792130\n", + "Epoch: 0190 loss = 4.789983\n", + "Epoch: 0191 loss = 4.788803\n", + "Epoch: 0192 loss = 4.793661\n", + "Epoch: 0193 loss = 4.788590\n", + "Epoch: 0194 loss = 4.788193\n", + "Epoch: 0195 loss = 4.788942\n", + "Epoch: 0196 loss = 4.789340\n", + "Epoch: 0197 loss = 4.789372\n", + "Epoch: 0198 loss = 4.789063\n", + "Epoch: 0199 loss = 4.788374\n", + "Epoch: 0200 loss = 4.787567\n", + "Epoch: 0201 loss = 4.787129\n", + "Epoch: 0202 loss = 4.787015\n", + "Epoch: 0203 loss = 4.787010\n", + "Epoch: 0204 loss = 4.787023\n", + "Epoch: 0205 loss = 4.787029\n", + "Epoch: 0206 loss = 4.787025\n", + "Epoch: 0207 loss = 4.787012\n", + "Epoch: 0208 loss = 4.786981\n", + "Epoch: 0209 loss = 4.786938\n", + "Epoch: 0210 loss = 4.786892\n", + "Epoch: 0211 loss = 4.786852\n", + "Epoch: 0212 loss = 4.786819\n", + "Epoch: 0213 loss = 4.786791\n", + "Epoch: 0214 loss = 4.786764\n", + "Epoch: 0215 loss = 4.786734\n", + "Epoch: 0216 loss = 4.786704\n", + "Epoch: 0217 loss = 4.786675\n", + "Epoch: 0218 loss = 4.786652\n", + "Epoch: 0219 loss = 4.786634\n", + "Epoch: 0220 loss = 4.786625\n", + "Epoch: 0221 loss = 4.786621\n", + "Epoch: 0222 loss = 4.786622\n", + "Epoch: 0223 loss = 4.786623\n", + "Epoch: 0224 loss = 4.786623\n", + "Epoch: 0225 loss = 4.786622\n", + "Epoch: 0226 loss = 4.786618\n", + "Epoch: 0227 loss = 4.786611\n", + "Epoch: 0228 loss = 4.786601\n", + "Epoch: 0229 loss = 4.786594\n", + "Epoch: 0230 loss = 4.786586\n", + "Epoch: 0231 loss = 4.786580\n", + "Epoch: 0232 loss = 4.786575\n", + "Epoch: 0233 loss = 4.786572\n", + "Epoch: 0234 loss = 4.786569\n", + "Epoch: 0235 loss = 4.786566\n", + "Epoch: 0236 loss = 4.786561\n", + "Epoch: 0237 loss = 4.786557\n", + "Epoch: 0238 loss = 4.786552\n", + "Epoch: 0239 loss = 4.786547\n", + "Epoch: 0240 loss = 4.786541\n", + "Epoch: 0241 loss = 4.786537\n", + "Epoch: 0242 loss = 4.786531\n", + "Epoch: 0243 loss = 4.786526\n", + "Epoch: 0244 loss = 4.786522\n", + "Epoch: 0245 loss = 4.786518\n", + "Epoch: 0246 loss = 4.786515\n", + "Epoch: 0247 loss = 4.786512\n", + "Epoch: 0248 loss = 4.786508\n", + "Epoch: 0249 loss = 4.786504\n", + "Epoch: 0250 loss = 4.786500\n", + "Epoch: 0251 loss = 4.786497\n", + "Epoch: 0252 loss = 4.786492\n", + "Epoch: 0253 loss = 4.786488\n", + "Epoch: 0254 loss = 4.786485\n", + "Epoch: 0255 loss = 4.786481\n", + "Epoch: 0256 loss = 4.786478\n", + "Epoch: 0257 loss = 4.786475\n", + "Epoch: 0258 loss = 4.786472\n", + "Epoch: 0259 loss = 4.786469\n", + "Epoch: 0260 loss = 4.786465\n", + "Epoch: 0261 loss = 4.786463\n", + "Epoch: 0262 loss = 4.786459\n", + "Epoch: 0263 loss = 4.786456\n", + "Epoch: 0264 loss = 4.786452\n", + "Epoch: 0265 loss = 4.786449\n", + "Epoch: 0266 loss = 4.786446\n", + "Epoch: 0267 loss = 4.786443\n", + "Epoch: 0268 loss = 4.786441\n", + "Epoch: 0269 loss = 4.786438\n", + "Epoch: 0270 loss = 4.786434\n", + "Epoch: 0271 loss = 4.786431\n", + "Epoch: 0272 loss = 4.786428\n", + "Epoch: 0273 loss = 4.786425\n", + "Epoch: 0274 loss = 4.786422\n", + "Epoch: 0275 loss = 4.786419\n", + "Epoch: 0276 loss = 4.786417\n", + "Epoch: 0277 loss = 4.786414\n", + "Epoch: 0278 loss = 4.786411\n", + "Epoch: 0279 loss = 4.786408\n", + "Epoch: 0280 loss = 4.786404\n", + "Epoch: 0281 loss = 4.786402\n", + "Epoch: 0282 loss = 4.786399\n", + "Epoch: 0283 loss = 4.786396\n", + "Epoch: 0284 loss = 4.786394\n", + "Epoch: 0285 loss = 4.786390\n", + "Epoch: 0286 loss = 4.786388\n", + "Epoch: 0287 loss = 4.786385\n", + "Epoch: 0288 loss = 4.786382\n", + "Epoch: 0289 loss = 4.786379\n", + "Epoch: 0290 loss = 4.786377\n", + "Epoch: 0291 loss = 4.786375\n", + "Epoch: 0292 loss = 4.786372\n", + "Epoch: 0293 loss = 4.786369\n", + "Epoch: 0294 loss = 4.786366\n", + "Epoch: 0295 loss = 4.786364\n", + "Epoch: 0296 loss = 4.786361\n", + "Epoch: 0297 loss = 4.786359\n", + "Epoch: 0298 loss = 4.786356\n", + "Epoch: 0299 loss = 4.786353\n", + "Epoch: 0300 loss = 4.786350\n", + "Epoch: 0301 loss = 4.786348\n", + "Epoch: 0302 loss = 4.786345\n", + "Epoch: 0303 loss = 4.786343\n", + "Epoch: 0304 loss = 4.786341\n", + "Epoch: 0305 loss = 4.786338\n", + "Epoch: 0306 loss = 4.786335\n", + "Epoch: 0307 loss = 4.786334\n", + "Epoch: 0308 loss = 4.786330\n", + "Epoch: 0309 loss = 4.786327\n", + "Epoch: 0310 loss = 4.786325\n", + "Epoch: 0311 loss = 4.786323\n", + "Epoch: 0312 loss = 4.786321\n", + "Epoch: 0313 loss = 4.786318\n", + "Epoch: 0314 loss = 4.786316\n", + "Epoch: 0315 loss = 4.786313\n", + "Epoch: 0316 loss = 4.786311\n", + "Epoch: 0317 loss = 4.786307\n", + "Epoch: 0318 loss = 4.786306\n", + "Epoch: 0319 loss = 4.786304\n", + "Epoch: 0320 loss = 4.786301\n", + "Epoch: 0321 loss = 4.786299\n", + "Epoch: 0322 loss = 4.786296\n", + "Epoch: 0323 loss = 4.786294\n", + "Epoch: 0324 loss = 4.786293\n", + "Epoch: 0325 loss = 4.786289\n", + "Epoch: 0326 loss = 4.786287\n", + "Epoch: 0327 loss = 4.786284\n", + "Epoch: 0328 loss = 4.786283\n", + "Epoch: 0329 loss = 4.786281\n", + "Epoch: 0330 loss = 4.786278\n", + "Epoch: 0331 loss = 4.786276\n", + "Epoch: 0332 loss = 4.786273\n", + "Epoch: 0333 loss = 4.786272\n", + "Epoch: 0334 loss = 4.786268\n", + "Epoch: 0335 loss = 4.786267\n", + "Epoch: 0336 loss = 4.786265\n", + "Epoch: 0337 loss = 4.786263\n", + "Epoch: 0338 loss = 4.786261\n", + "Epoch: 0339 loss = 4.786258\n", + "Epoch: 0340 loss = 4.786256\n", + "Epoch: 0341 loss = 4.786253\n", + "Epoch: 0342 loss = 4.786252\n", + "Epoch: 0343 loss = 4.786249\n", + "Epoch: 0344 loss = 4.786247\n", + "Epoch: 0345 loss = 4.786245\n", + "Epoch: 0346 loss = 4.786243\n", + "Epoch: 0347 loss = 4.786241\n", + "Epoch: 0348 loss = 4.786238\n", + "Epoch: 0349 loss = 4.786237\n", + "Epoch: 0350 loss = 4.786234\n", + "Epoch: 0351 loss = 4.786232\n", + "Epoch: 0352 loss = 4.786230\n", + "Epoch: 0353 loss = 4.786228\n", + "Epoch: 0354 loss = 4.786226\n", + "Epoch: 0355 loss = 4.786223\n", + "Epoch: 0356 loss = 4.786222\n", + "Epoch: 0357 loss = 4.786221\n", + "Epoch: 0358 loss = 4.786217\n", + "Epoch: 0359 loss = 4.786215\n", + "Epoch: 0360 loss = 4.786213\n", + "Epoch: 0361 loss = 4.786211\n", + "Epoch: 0362 loss = 4.786209\n", + "Epoch: 0363 loss = 4.786207\n", + "Epoch: 0364 loss = 4.786203\n", + "Epoch: 0365 loss = 4.786200\n", + "Epoch: 0366 loss = 4.786190\n", + "Epoch: 0367 loss = 4.786129\n", + "Epoch: 0368 loss = 4.785011\n", + "Epoch: 0369 loss = 4.781053\n", + "Epoch: 0370 loss = 4.779747\n", + "Epoch: 0371 loss = 4.783240\n", + "Epoch: 0372 loss = 4.779751\n", + "Epoch: 0373 loss = 4.779325\n", + "Epoch: 0374 loss = 4.779717\n", + "Epoch: 0375 loss = 4.780351\n", + "Epoch: 0376 loss = 4.780504\n", + "Epoch: 0377 loss = 4.780063\n", + "Epoch: 0378 loss = 4.779569\n", + "Epoch: 0379 loss = 4.779338\n", + "Epoch: 0380 loss = 4.779263\n", + "Epoch: 0381 loss = 4.779239\n", + "Epoch: 0382 loss = 4.779237\n", + "Epoch: 0383 loss = 4.779246\n", + "Epoch: 0384 loss = 4.779265\n", + "Epoch: 0385 loss = 4.779281\n", + "Epoch: 0386 loss = 4.779284\n", + "Epoch: 0387 loss = 4.779267\n", + "Epoch: 0388 loss = 4.779233\n", + "Epoch: 0389 loss = 4.779195\n", + "Epoch: 0390 loss = 4.779158\n", + "Epoch: 0391 loss = 4.779129\n", + "Epoch: 0392 loss = 4.779109\n", + "Epoch: 0393 loss = 4.779094\n", + "Epoch: 0394 loss = 4.779084\n", + "Epoch: 0395 loss = 4.779078\n", + "Epoch: 0396 loss = 4.779074\n", + "Epoch: 0397 loss = 4.779072\n", + "Epoch: 0398 loss = 4.779070\n", + "Epoch: 0399 loss = 4.779066\n", + "Epoch: 0400 loss = 4.779061\n", + "Epoch: 0401 loss = 4.779056\n", + "Epoch: 0402 loss = 4.779051\n", + "Epoch: 0403 loss = 4.779047\n", + "Epoch: 0404 loss = 4.779043\n", + "Epoch: 0405 loss = 4.779040\n", + "Epoch: 0406 loss = 4.779038\n", + "Epoch: 0407 loss = 4.779037\n", + "Epoch: 0408 loss = 4.779036\n", + "Epoch: 0409 loss = 4.779035\n", + "Epoch: 0410 loss = 4.779033\n", + "Epoch: 0411 loss = 4.779032\n", + "Epoch: 0412 loss = 4.779031\n", + "Epoch: 0413 loss = 4.779028\n", + "Epoch: 0414 loss = 4.779026\n", + "Epoch: 0415 loss = 4.779021\n", + "Epoch: 0416 loss = 4.779011\n", + "Epoch: 0417 loss = 4.778957\n", + "Epoch: 0418 loss = 4.778023\n", + "Epoch: 0419 loss = 4.775119\n", + "Epoch: 0420 loss = 4.772221\n", + "Epoch: 0421 loss = 4.774364\n", + "Epoch: 0422 loss = 4.772817\n" + ] + }, + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "\u001b[1;32mc:\\Users\\Albin\\Documents\\TDDE19\\codebase\\Neural graph module\\ngm.ipynb Cell 11\u001b[0m in \u001b[0;36m<cell line: 13>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X35sZmlsZQ%3D%3D?line=17'>18</a>\u001b[0m loss \u001b[39m=\u001b[39m criterion(output, corr_indx)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X35sZmlsZQ%3D%3D?line=19'>20</a>\u001b[0m \u001b[39mif\u001b[39;00m (epoch \u001b[39m+\u001b[39m \u001b[39m1\u001b[39m) \u001b[39m%\u001b[39m \u001b[39m1\u001b[39m \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m:\n\u001b[1;32m---> <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X35sZmlsZQ%3D%3D?line=20'>21</a>\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39m'\u001b[39m\u001b[39mEpoch:\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39m\u001b[39m%04d\u001b[39;00m\u001b[39m'\u001b[39m \u001b[39m%\u001b[39m (epoch \u001b[39m+\u001b[39m \u001b[39m1\u001b[39m), \u001b[39m'\u001b[39m\u001b[39mloss =\u001b[39m\u001b[39m'\u001b[39m, \u001b[39m'\u001b[39;49m\u001b[39m{:.6f}\u001b[39;49;00m\u001b[39m'\u001b[39;49m\u001b[39m.\u001b[39;49mformat(loss))\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X35sZmlsZQ%3D%3D?line=21'>22</a>\u001b[0m \u001b[39m# Backward pass\u001b[39;00m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X35sZmlsZQ%3D%3D?line=22'>23</a>\u001b[0m loss\u001b[39m.\u001b[39mbackward()\n", + "File \u001b[1;32mb:\\Programs\\Miniconda\\envs\\tdde19\\lib\\site-packages\\torch\\_tensor.py:659\u001b[0m, in \u001b[0;36mTensor.__format__\u001b[1;34m(self, format_spec)\u001b[0m\n\u001b[0;32m 657\u001b[0m \u001b[39mreturn\u001b[39;00m handle_torch_function(Tensor\u001b[39m.\u001b[39m\u001b[39m__format__\u001b[39m, (\u001b[39mself\u001b[39m,), \u001b[39mself\u001b[39m, format_spec)\n\u001b[0;32m 658\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdim() \u001b[39m==\u001b[39m \u001b[39m0\u001b[39m \u001b[39mand\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mis_meta:\n\u001b[1;32m--> 659\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mitem()\u001b[39m.\u001b[39m\u001b[39m__format__\u001b[39m(format_spec)\n\u001b[0;32m 660\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mobject\u001b[39m\u001b[39m.\u001b[39m\u001b[39m__format__\u001b[39m(\u001b[39mself\u001b[39m, format_spec)\n", + "\u001b[1;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], "source": [ "model = NgmOne(device)\n", "\n", @@ -403,31 +860,18 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 1, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Beginning making batch\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "100%|██████████| 408/408 [00:00<00:00, 962.29it/s] \n", - "100%|██████████| 408/408 [00:00<00:00, 81687.72it/s]\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Finished with batches\n", - "lowest confidence 0.14628477\n", - "Accuracy: 0.5245098039215687\n" + "ename": "NameError", + "evalue": "name 'make_batch' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32mc:\\Users\\Albin\\Documents\\TDDE19\\codebase\\Neural graph module\\ngm.ipynb Cell 13\u001b[0m in \u001b[0;36m<cell line: 2>\u001b[1;34m()\u001b[0m\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X15sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39m# Predict\u001b[39;00m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X15sZmlsZQ%3D%3D?line=1'>2</a>\u001b[0m train, train_mask, corr_rels \u001b[39m=\u001b[39m make_batch()\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X15sZmlsZQ%3D%3D?line=2'>3</a>\u001b[0m \u001b[39mwith\u001b[39;00m torch\u001b[39m.\u001b[39mno_grad():\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/Albin/Documents/TDDE19/codebase/Neural%20graph%20module/ngm.ipynb#X15sZmlsZQ%3D%3D?line=3'>4</a>\u001b[0m output \u001b[39m=\u001b[39m model(train, train_mask)\n", + "\u001b[1;31mNameError\u001b[0m: name 'make_batch' is not defined" ] } ], @@ -443,23 +887,6 @@ "probability = [pred[np.argmax(pred)] for pred in output]\n", "correct_pred = [corr_rels[i] for i in range(len(output))]\n", "\n", - "\n", - "\n", - "preds = [\n", - " {\"pred\": relations[np.argmax(pred).item()], \n", - " \"prob\": pred[np.argmax(pred)],\n", - " \"correct\": corr_rels[count]} \n", - " for count, pred in enumerate(output)\n", - " ]\n", - "\n", - "\n", - "\n", - "# for pred in preds:\n", - "# print(\"pred\", pred[\"pred\"], \"prob\", pred[\"prob\"], \"correct\", pred[\"correct\"])\n", - "\n", - "# for pred, prob, correct_pred in zip(prediction, probability, correct_pred):\n", - "# print(\"pred:\", pred, \"prob:\", prob, \"| correct\", correct_pred)\n", - "\n", "print(\"lowest confidence\", min(probability))\n", "\n", "def accuracy_score(y_true, y_pred):\n", @@ -486,7 +913,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.9.11 64-bit", + "display_name": "Python 3.10.4 ('tdde19')", "language": "python", "name": "python3" }, @@ -500,12 +927,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.11" + "version": "3.10.4" }, "orig_nbformat": 4, "vscode": { "interpreter": { - "hash": "64e7cd3b4b88defe39dd61a4584920400d6beb2615ab2244e340c2e20eecdfe9" + "hash": "8e4aa0e1a1e15de86146661edda0b2884b54582522f7ff2b916774ba6b8accb1" } } }, diff --git a/Neural graph module/relations-query-qald-9-linked b/Neural graph module/relations-query-qald-9-linked new file mode 100644 index 0000000000000000000000000000000000000000..558989c96d2ea3c0963fedf76625317f4e9f4029 --- /dev/null +++ b/Neural graph module/relations-query-qald-9-linked @@ -0,0 +1,165 @@ +{ + "0": "dbo:developer", + "1": "dbo:child", + "2": "<http://dbpediaorg/property/beginningDate>", + "3": "<http://dbpediaorg/ontology/country>", + "4": "<http://dbpediaorg/property/fifaMin>", + "5": "<http://dbpediaorg/ontology/influencedBy>", + "6": "dbo:origin", + "7": "<http://dbpediaorg/property/birthName>", + "8": "<http://dbpediaorg/property/governor>", + "9": "dbo:class", + "10": "<http://dbpediaorg/ontology/architect>", + "11": "dbo:languageFamily", + "12": "dbo:vicePresident", + "13": "<http://dbpediaorg/property/leaderParty>", + "14": "dbo:creator", + "15": "dbo:mission", + "16": "<http://dbpediaorg/ontology/foundedBy>", + "17": "dbo:owner", + "18": "dbp:editor", + "19": "dbo:programmingLanguage", + "20": "dbo:composer", + "21": "<http://dbpediaorg/ontology/currency>", + "22": "<http://dbpediaorg/ontology/birthPlace>", + "23": "dbo:publisher", + "24": "<http://dbpediaorg/ontology/starring>", + "25": "dbo:birthName", + "26": "<http://dbpediaorg/property/highest>", + "27": "<http://dbpediaorg/ontology/foundationPlace>", + "28": "<http://dbpediaorg/ontology/manager>", + "29": "<http://dbpediaorg/ontology/director>", + "30": "dbp:date", + "31": "dbp:populationDensityRank", + "32": "dbo:restingPlace", + "33": "dbo:battle", + "34": "dbo:targetAirport", + "35": "<http://dbpediaorg/property/admittancedate>", + "36": "dbo:bandMember", + "37": "<http://dbpediaorg/property/residence>", + "38": "<http://dbpediaorg/ontology/elevation>", + "39": "<http://dbpediaorg/property/founded>", + "40": "dbo:foundationPlace", + "41": "dbo:series", + "42": "dbo:elevation", + "43": "dbo:budget", + "44": "<http://dbpediaorg/ontology/industry>", + "45": "<http://dbpediaorg/ontology/creator>", + "46": "dbp:species", + "47": "<http://dbpediaorg/property/largestmetro>", + "48": "dbo:abbreviation", + "49": "<http://dbpediaorg/property/author>", + "50": "<http://dbpediaorg/ontology/officialSchoolColour>", + "51": "<http://dbpediaorg/property/carbs>", + "52": "<http://dbpediaorg/ontology/genre>", + "53": "<http://dbpediaorg/ontology/type>", + "54": "dbo:location", + "55": "<http://dbpediaorg/ontology/ground>", + "56": "dbo:leader", + "57": "dbo:portrayer", + "58": "<http://dbpediaorg/ontology/alliance>", + "59": "<http://dbpediaorg/ontology/occupation>", + "60": "<http://dbpediaorg/ontology/owner>", + "61": "<http://dbpediaorg/property/ballpark>", + "62": "<http://dbpediaorg/property/borderingstates>", + "63": "dbo:runtime", + "64": "dbo:wineRegion", + "65": "dbo:mayor", + "66": "dbo:alias", + "67": "dbo:largestCity", + "68": "<http://dbpediaorg/property/burialPlace>", + "69": "dbo:influencedBy", + "70": "<http://dbpediaorg/ontology/deathDate>", + "71": "dbo:dissolutionDate", + "72": "dbo:crosses", + "73": "dbo:founder", + "74": "<http://dbpediaorg/property/children>", + "75": "<http://dbpediaorg/ontology/abbreviation>", + "76": "<http://dbpediaorg/property/programme>", + "77": "dbo:areaTotal", + "78": "dbo:birthPlace", + "79": "dbo:language", + "80": "<http://dbpediaorg/ontology/nationality>", + "81": "<http://dbpediaorg/property/breed>", + "82": "dbo:party", + "83": "dbo:capital", + "84": "<http://dbpediaorg/property/ethnicity>", + "85": "dbo:numberOfEpisodes", + "86": "<http://dbpediaorg/ontology/spokenIn>", + "87": "dbo:completionDate", + "88": "dbo:foundingDate", + "89": "<http://dbpediaorg/property/shipNamesake>", + "90": "<http://dbpediaorg/ontology/netIncome>", + "91": "dbo:deathDate", + "92": "<http://dbpediaorg/ontology/deathPlace>", + "93": "<http://dbpediaorg/ontology/locationCountry>", + "94": "dbo:influenced", + "95": "dbo:deathPlace", + "96": "dbo:ingredient", + "97": "dbo:editor", + "98": "dbo:architect", + "99": "<http://dbpediaorg/ontology/producer>", + "100": "dbo:numberOfLocations", + "101": "<http://dbpediaorg/ontology/numberOfEmployees>", + "102": "<http://dbpediaorg/ontology/profession>", + "103": "dbo:routeEnd", + "104": "dbo:state", + "105": "dbo:height", + "106": "dbo:successor", + "107": "<http://dbpediaorg/ontology/mission>", + "108": "<http://dbpediaorg/ontology/spouse>", + "109": "<http://dbpediaorg/property/speciality>", + "110": "dbo:timeZone", + "111": "dbo:governmentType", + "112": "dbo:maximumDepth", + "113": "<http://dbpediaorg/property/employees>", + "114": "dbo:award", + "115": "dbo:city", + "116": "dbo:date", + "117": "dbo:spouse", + "118": "<http://dbpediaorg/ontology/populationTotal>", + "119": "dbp:borders", + "120": "dbo:presenter", + "121": "dbo:manufacturer", + "122": "<http://dbpediaorg/property/launchPad>", + "123": "dbo:officialLanguage", + "124": "dbp:writer", + "125": "dbo:wikiPageRedirects", + "126": "dbo:writer", + "127": "dbo:deathCause", + "128": "dbo:leaderName", + "129": "dbo:author", + "130": "dbo:product", + "131": "dbo:populationTotal", + "132": "dbo:headquarter", + "133": "dbo:almaMater", + "134": "dbo:country", + "135": "<http://dbpediaorg/ontology/location>", + "136": "dbo:ethnicGroup", + "137": "dbo:team", + "138": "dbo:parent", + "139": "dbo:growingGrape", + "140": "<http://dbpediaorg/property/successor>", + "141": "<http://dbpediaorg/ontology/instrument>", + "142": "dbo:discoverer", + "143": "dbo:birthDate", + "144": "dbo:doctoralAdvisor", + "145": "dbo:starring", + "146": "<http://dbpediaorg/property/accessioneudate>", + "147": "dbo:musicComposer", + "148": "dbo:sourceCountry", + "149": "<http://dbpediaorg/ontology/portrayer>", + "150": "<http://dbpediaorg/ontology/child>", + "151": "dbo:activeYearsEndDate", + "152": "foaf:surname", + "153": "dbo:birthYear", + "154": "<http://dbpediaorg/ontology/developer>", + "155": "dbo:director", + "156": "dbo:currency", + "157": "dbo:knownFor", + "158": "a", + "159": "dbo:firstAscentPerson", + "160": "<http://dbpediaorg/property/title>", + "161": "dbo:numberOfPages", + "162": "dbo:type" +} diff --git a/data/relations-query-qald-9-linked.json b/data/relations-query-qald-9-linked.json index 3e305e9d35c7ddc8a9970de83ff4d99f0fdb9c80..be96d77503ae4878ce6ef6b7223d016308610832 100644 --- a/data/relations-query-qald-9-linked.json +++ b/data/relations-query-qald-9-linked.json @@ -1,139 +1,165 @@ [ + "dbo:developer", + "dbo:child", + "<http://dbpediaorg/property/beginningDate>", + "<http://dbpediaorg/ontology/country>", + "<http://dbpediaorg/property/fifaMin>", + "<http://dbpediaorg/ontology/influencedBy>", + "dbo:origin", + "<http://dbpediaorg/property/birthName>", + "<http://dbpediaorg/property/governor>", + "dbo:class", + "<http://dbpediaorg/ontology/architect>", + "dbo:languageFamily", + "dbo:vicePresident", + "<http://dbpediaorg/property/leaderParty>", + "dbo:creator", + "dbo:mission", + "<http://dbpediaorg/ontology/foundedBy>", + "dbo:owner", + "dbp:editor", + "dbo:programmingLanguage", + "dbo:composer", + "<http://dbpediaorg/ontology/currency>", + "<http://dbpediaorg/ontology/birthPlace>", + "dbo:publisher", + "<http://dbpediaorg/ontology/starring>", + "dbo:birthName", + "<http://dbpediaorg/property/highest>", + "<http://dbpediaorg/ontology/foundationPlace>", + "<http://dbpediaorg/ontology/manager>", + "<http://dbpediaorg/ontology/director>", + "dbp:date", + "dbp:populationDensityRank", + "dbo:restingPlace", + "dbo:battle", + "dbo:targetAirport", + "<http://dbpediaorg/property/admittancedate>", + "dbo:bandMember", + "<http://dbpediaorg/property/residence>", + "<http://dbpediaorg/ontology/elevation>", + "<http://dbpediaorg/property/founded>", "dbo:foundationPlace", - "dbo:founder", - "<http://dbpedia.org/ontology/officialSchoolColour>", - "<http://dbpedia.org/property/ethnicity>", - "<http://dbpedia.org/ontology/mission>", - "<http://dbpedia.org/property/admittancedate>", - "dbo:writer", - "<http://dbpedia.org/property/carbs>", - "<http://dbpedia.org/property/borderingstates>", - "dbo:party", - "dbo:growingGrape", - "<http://dbpedia.org/property/residence>", + "dbo:series", + "dbo:elevation", + "dbo:budget", + "<http://dbpediaorg/ontology/industry>", + "<http://dbpediaorg/ontology/creator>", + "dbp:species", + "<http://dbpediaorg/property/largestmetro>", + "dbo:abbreviation", + "<http://dbpediaorg/property/author>", + "<http://dbpediaorg/ontology/officialSchoolColour>", + "<http://dbpediaorg/property/carbs>", + "<http://dbpediaorg/ontology/genre>", + "<http://dbpediaorg/ontology/type>", + "dbo:location", + "<http://dbpediaorg/ontology/ground>", + "dbo:leader", + "dbo:portrayer", + "<http://dbpediaorg/ontology/alliance>", + "<http://dbpediaorg/ontology/occupation>", + "<http://dbpediaorg/ontology/owner>", + "<http://dbpediaorg/property/ballpark>", + "<http://dbpediaorg/property/borderingstates>", + "dbo:runtime", "dbo:wineRegion", - "dbo:language", - "dbo:officialLanguage", + "dbo:mayor", + "dbo:alias", + "dbo:largestCity", + "<http://dbpediaorg/property/burialPlace>", "dbo:influencedBy", + "<http://dbpediaorg/ontology/deathDate>", + "dbo:dissolutionDate", + "dbo:crosses", + "dbo:founder", + "<http://dbpediaorg/property/children>", + "<http://dbpediaorg/ontology/abbreviation>", + "<http://dbpediaorg/property/programme>", + "dbo:areaTotal", + "dbo:birthPlace", + "dbo:language", + "<http://dbpediaorg/ontology/nationality>", + "<http://dbpediaorg/property/breed>", + "dbo:party", + "dbo:capital", + "<http://dbpediaorg/property/ethnicity>", + "dbo:numberOfEpisodes", + "<http://dbpediaorg/ontology/spokenIn>", + "dbo:completionDate", + "dbo:foundingDate", + "<http://dbpediaorg/property/shipNamesake>", + "<http://dbpediaorg/ontology/netIncome>", + "dbo:deathDate", + "<http://dbpediaorg/ontology/deathPlace>", + "<http://dbpediaorg/ontology/locationCountry>", + "dbo:influenced", + "dbo:deathPlace", + "dbo:ingredient", + "dbo:editor", + "dbo:architect", + "<http://dbpediaorg/ontology/producer>", + "dbo:numberOfLocations", + "<http://dbpediaorg/ontology/numberOfEmployees>", + "<http://dbpediaorg/ontology/profession>", "dbo:routeEnd", - "<http://dbpedia.org/ontology/netIncome>", - "dbo:bandMember", - "dbo:team", - "dbo:origin", - "<http://dbpedia.org/property/launchPad>", - "dbp:species", - "dbo:composer", - "<http://dbpedia.org/property/author>", - "<http://dbpedia.org/ontology/creator>", - "dbo:developer", - "<http://dbpedia.org/ontology/owner>", - "<http://dbpedia.org/ontology/spouse>", + "dbo:state", + "dbo:height", + "dbo:successor", + "<http://dbpediaorg/ontology/mission>", + "<http://dbpediaorg/ontology/spouse>", + "<http://dbpediaorg/property/speciality>", "dbo:timeZone", - "<http://dbpedia.org/property/governor>", - "dbo:numberOfPages", - "dbo:deathCause", - "dbo:award", - "dbo:activeYearsEndDate", "dbo:governmentType", "dbo:maximumDepth", - "dbo:owner", - "dbo:leader", - "dbo:birthDate", - "dbo:editor", - "dbo:knownFor", - "dbo:starring", - "dbo:targetAirport", - "<http://dbpedia.org/property/founded>", - "<http://dbpedia.org/property/leaderParty>", - "<http://dbpedia.org/property/speciality>", - "dbo:country", - "dbo:runtime", - "<http://dbpedia.org/ontology/spokenIn>", - "dbo:battle", - "dbo:discoverer", - "dbo:portrayer", - "dbo:areaTotal", - "<http://dbpedia.org/ontology/portrayer>", - "dbo:height", - "dbo:spouse", - "dbo:abbreviation", - "<http://dbpedia.org/ontology/profession>", - "dbo:musicComposer", - "dbo:firstAscentPerson", - "dbo:publisher", - "<http://dbpedia.org/ontology/deathPlace>", - "<http://dbpedia.org/property/largestmetro>", - "dbp:writer", - "dbo:ingredient", - "dbo:class", - "<http://dbpedia.org/property/breed>", - "dbo:director", - "dbo:alias", - "<http://dbpedia.org/ontology/currency>", - "<http://dbpedia.org/ontology/populationTotal>", - "<http://dbpedia.org/property/successor>", - "<http://dbpedia.org/ontology/manager>", - "dbo:mayor", + "<http://dbpediaorg/property/employees>", + "dbo:award", + "dbo:city", "dbo:date", - "dbp:editor", - "a", - "<http://dbpedia.org/ontology/foundedBy>", - "dbo:completionDate", - "dbp:populationDensityRank", + "dbo:spouse", + "<http://dbpediaorg/ontology/populationTotal>", + "dbp:borders", "dbo:presenter", - "<http://dbpedia.org/ontology/instrument>", - "<http://dbpedia.org/ontology/numberOfEmployees>", - "dbo:series", - "dbo:creator", - "<http://dbpedia.org/ontology/producer>", + "dbo:manufacturer", + "<http://dbpediaorg/property/launchPad>", + "dbo:officialLanguage", + "dbp:writer", + "dbo:wikiPageRedirects", + "dbo:writer", + "dbo:deathCause", "dbo:leaderName", - "<http://dbpedia.org/property/children>", - "<http://dbpedia.org/property/title>", - "<http://dbpedia.org/property/fifaMin>", - "dbo:crosses", - "dbo:mission", - "dbo:architect", - "dbo:largestCity", - "dbo:budget", - "<http://dbpedia.org/property/birthName>", - "dbo:populationTotal", - "dbo:foundingDate", - "dbo:vicePresident", - "<http://dbpedia.org/ontology/genre>", + "dbo:author", "dbo:product", - "dbo:type", - "dbo:state", - "dbo:influenced", + "dbo:populationTotal", + "dbo:headquarter", + "dbo:almaMater", + "dbo:country", + "<http://dbpediaorg/ontology/location>", + "dbo:ethnicGroup", + "dbo:team", + "dbo:parent", + "dbo:growingGrape", + "<http://dbpediaorg/property/successor>", + "<http://dbpediaorg/ontology/instrument>", + "dbo:discoverer", + "dbo:birthDate", "dbo:doctoralAdvisor", - "dbo:numberOfLocations", - "dbo:successor", - "<http://dbpedia.org/property/ballpark>", - "<http://dbpedia.org/ontology/country>", + "dbo:starring", + "<http://dbpediaorg/property/accessioneudate>", + "dbo:musicComposer", "dbo:sourceCountry", - "dbo:birthPlace", - "<http://dbpedia.org/property/highest>", - "<http://dbpedia.org/ontology/child>", - "dbo:birthName", - "dbo:child", - "dbo:deathPlace", - "<http://dbpedia.org/ontology/abbreviation>", - "dbo:dissolutionDate", - "dbo:author", + "<http://dbpediaorg/ontology/portrayer>", + "<http://dbpediaorg/ontology/child>", + "dbo:activeYearsEndDate", + "foaf:surname", "dbo:birthYear", - "<http://dbpedia.org/property/beginningDate>", - "dbo:ethnicGroup", + "<http://dbpediaorg/ontology/developer>", + "dbo:director", "dbo:currency", - "<http://dbpedia.org/property/programme>", - "<http://dbpedia.org/property/shipNamesake>", - "dbo:capital", - "dbo:programmingLanguage", - "dbo:city", - "<http://dbpedia.org/ontology/deathDate>", - "dbo:almaMater", - "<http://dbpedia.org/property/employees>", - "dbo:location", - "<http://dbpedia.org/property/accessioneudate>", - "rdf:type", - "<http://dbpedia.org/ontology/developer>", - "dbo:restingPlace" + "dbo:knownFor", + "a", + "dbo:firstAscentPerson", + "<http://dbpediaorg/property/title>", + "dbo:numberOfPages", + "dbo:type" ]