fixed typos in max pool figure and size of tensors after convolutional filters (#35)
This commit is contained in:
parent
61093d819c
commit
807ec2082a
@ -202,7 +202,7 @@
|
||||
" conved_1 = F.relu(self.conv_1(embedded).squeeze(3))\n",
|
||||
" conved_2 = F.relu(self.conv_2(embedded).squeeze(3))\n",
|
||||
" \n",
|
||||
" #conv_n = [batch size, n_filters, sent len - filter_sizes[n]]\n",
|
||||
" #conved_n = [batch size, n_filters, sent len - filter_sizes[n] + 1]\n",
|
||||
" \n",
|
||||
" pooled_0 = F.max_pool1d(conved_0, conved_0.shape[2]).squeeze(2)\n",
|
||||
" pooled_1 = F.max_pool1d(conved_1, conved_1.shape[2]).squeeze(2)\n",
|
||||
@ -240,6 +240,8 @@
|
||||
" \n",
|
||||
" super().__init__()\n",
|
||||
" \n",
|
||||
" print(filter_sizes)\n",
|
||||
" \n",
|
||||
" self.embedding = nn.Embedding(vocab_size, embedding_dim, padding_idx = pad_idx)\n",
|
||||
" \n",
|
||||
" self.convs = nn.ModuleList([\n",
|
||||
@ -271,7 +273,7 @@
|
||||
" \n",
|
||||
" conved = [F.relu(conv(embedded)).squeeze(3) for conv in self.convs]\n",
|
||||
" \n",
|
||||
" #conv_n = [batch size, n_filters, sent len - filter_sizes[n]]\n",
|
||||
" #conved_n = [batch size, n_filters, sent len - filter_sizes[n] + 1]\n",
|
||||
" \n",
|
||||
" pooled = [F.max_pool1d(conv, conv.shape[2]).squeeze(2) for conv in conved]\n",
|
||||
" \n",
|
||||
@ -336,7 +338,7 @@
|
||||
" \n",
|
||||
" conved = [F.relu(conv(embedded)) for conv in self.convs]\n",
|
||||
" \n",
|
||||
" #conv_n = [batch size, n_filters, sent len - filter_sizes[n] - 1]\n",
|
||||
" #conved_n = [batch size, n_filters, sent len - filter_sizes[n] + 1]\n",
|
||||
" \n",
|
||||
" pooled = [F.max_pool1d(conv, conv.shape[2]).squeeze(2) for conv in conved]\n",
|
||||
" \n",
|
||||
@ -373,7 +375,7 @@
|
||||
"PAD_IDX = TEXT.vocab.stoi[TEXT.pad_token]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"model = CNN(INPUT_DIM, EMBEDDING_DIM, N_FILTERS, FILTER_SIZES, OUTPUT_DIM, DROPOUT, PAD_IDX)"
|
||||
"model = CNN1d(INPUT_DIM, EMBEDDING_DIM, N_FILTERS, FILTER_SIZES, OUTPUT_DIM, DROPOUT, PAD_IDX)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -634,21 +636,21 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Epoch: 01 | Epoch Time: 0m 12s\n",
|
||||
"\tTrain Loss: 0.644 | Train Acc: 62.23%\n",
|
||||
"\t Val. Loss: 0.487 | Val. Acc: 78.46%\n",
|
||||
"Epoch: 02 | Epoch Time: 0m 12s\n",
|
||||
"\tTrain Loss: 0.419 | Train Acc: 80.98%\n",
|
||||
"\t Val. Loss: 0.360 | Val. Acc: 84.72%\n",
|
||||
"Epoch: 03 | Epoch Time: 0m 12s\n",
|
||||
"\tTrain Loss: 0.302 | Train Acc: 87.17%\n",
|
||||
"\t Val. Loss: 0.345 | Val. Acc: 85.25%\n",
|
||||
"Epoch: 04 | Epoch Time: 0m 12s\n",
|
||||
"\tTrain Loss: 0.218 | Train Acc: 91.27%\n",
|
||||
"\t Val. Loss: 0.318 | Val. Acc: 87.04%\n",
|
||||
"Epoch: 05 | Epoch Time: 0m 12s\n",
|
||||
"\tTrain Loss: 0.155 | Train Acc: 94.35%\n",
|
||||
"\t Val. Loss: 0.339 | Val. Acc: 86.56%\n"
|
||||
"Epoch: 01 | Epoch Time: 0m 7s\n",
|
||||
"\tTrain Loss: 0.656 | Train Acc: 60.82%\n",
|
||||
"\t Val. Loss: 0.521 | Val. Acc: 77.40%\n",
|
||||
"Epoch: 02 | Epoch Time: 0m 7s\n",
|
||||
"\tTrain Loss: 0.432 | Train Acc: 80.00%\n",
|
||||
"\t Val. Loss: 0.369 | Val. Acc: 84.44%\n",
|
||||
"Epoch: 03 | Epoch Time: 0m 7s\n",
|
||||
"\tTrain Loss: 0.307 | Train Acc: 86.99%\n",
|
||||
"\t Val. Loss: 0.344 | Val. Acc: 85.22%\n",
|
||||
"Epoch: 04 | Epoch Time: 0m 7s\n",
|
||||
"\tTrain Loss: 0.224 | Train Acc: 91.09%\n",
|
||||
"\t Val. Loss: 0.321 | Val. Acc: 86.77%\n",
|
||||
"Epoch: 05 | Epoch Time: 0m 7s\n",
|
||||
"\tTrain Loss: 0.157 | Train Acc: 94.17%\n",
|
||||
"\t Val. Loss: 0.331 | Val. Acc: 87.02%\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -693,7 +695,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Test Loss: 0.339 | Test Acc: 85.28%\n"
|
||||
"Test Loss: 0.345 | Test Acc: 85.06%\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -752,7 +754,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0.1023554727435112"
|
||||
"0.15394726395606995"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
@ -779,7 +781,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0.9818674325942993"
|
||||
"0.9749677777290344"
|
||||
]
|
||||
},
|
||||
"execution_count": 20,
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@ -1 +1 @@
|
||||
<mxfile modified="2019-03-10T16:16:01.548Z" host="www.draw.io" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36" etag="sVGsxv7Bxx3pTj04Bq9z" version="10.4.1" type="device"><diagram id="SksJatzgLejQSg5PRCuB" name="Page-1">7VxZb+M2EP41flxDJHU+Nk68DdotFkjRbh8ZibHUlUWDpq/++pIWZR10HJ+hANMv8Yx4id/MN+SQzgCNpuuvDM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ss7DZzD1yyv7aHOMHLDhod+cT500Ytd7Vwfv6KLRu7RLgovdNH99ydQdazd3W5UTZQju9kVicjmdjXfN55GjGxuVwfF9D48srldDZQeLGSBBsItwuRpse7MuFbH4tBrxuJd5N2/Ur7tIrYy+w8jZHSbC4YIdq4edwPkO3cI90TaLqF0xnLrSKvn8cSiq0cUMh7LK5q3phDUPYkwv9LWMxTOUP/xwt0B4xoHRl+bOkNkgTEfdI9IGMxTPJNf4wXLNw8Mxz9l9PgInhpLcGC6LwORUS4CEpU6ST5XwciFXgcjT8MI7sEIgNuBtC/e9Ml7CEg8EuzznsgPEPavhEw37N+O1oRY/3y/XDbU/wQBPf0P</diagram></mxfile>
|
||||
<mxfile modified="2019-04-22T12:19:08.699Z" host="www.draw.io" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36" etag="yLUK2JPrD2Zsq16P4yMj" version="10.6.3" type="device"><diagram id="SksJatzgLejQSg5PRCuB" name="Page-1">7Vxbc9sqEP41fqxHgK6PjROnmZ6e6Uw6vTwSiVg6lYUH41t/fcFC1gXHcRz7oBnjl3gXkIBv91tYcAZoNF3fMzxLv9CE5APoJOsBuh1ACBAMxB+p2ZSaAIalYsKyRFWqFY/ZH6KUjtIusoTMWxU5pTnPZm1lTIuCxLylw4zRVbvaM83bb53hCdEUjzHOde2PLOFpqQ2rYUn9J5JN0urNwI/KkimuKquRzFOc0FVDhe4GaMQo5eW36XpEcjl51byU7cYvlO46xkjBj2lw735LojH4/jBbfs43D4vR3Rf/Q+iqzvFNNWKSiAlQImU8pRNa4Pyu1t7EC7Yk8qlACIwuimQrOUKqG/xD6UxV+Y9wvlHQ4gWnQpXyaa5KyTrjPxvff8lHDT0l3a7Vk7fCphIKzjY/m0KjlRTrZlupavdMCz7G0yyXihFdsIwwMfp/yUoVql5CWVmf4MoAMZsQfmBWfWUdciobLRUu94ROieiVqMBIjnm2bNsaViY72dXbNf1KM9E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