I mention learn convolutional neural networks (CNN) for classification of sentences made by Yoonkim.
I am still confused about the size of the filter and how convolution works .
What do filter_h = 5
with filter_hs = [3,4,5]
, whether filter_h
is the maximum length for each filter_hs
?? how it works?
To get the image shape
, the longest maximum sentence in this case is 56 so 56 + 2 * (5-1) = 64 .., What does number 2 mean? Where is number 2 obtained?
Best Answer
Here is a great illustration from Stanford's deep learning tutorial (also nicely explained by Denny Britz).
The filter is the yellow sliding window, and its value is:
\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 1 \end{bmatrix}
Another neat visualization of convolutions (and deconvolutions a.k.a. transposed convolutions): https://github.com/vdumoulin/conv_arithmetic
Padding on the left and on the right of the sentence.