0
$\begingroup$

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?

$\endgroup$

2 Answers 2

3
$\begingroup$

I am still confused about the size of the filter, how convolution it works

Here is a great illustration from Stanford's deep learning tutorial (also nicely explained by Denny Britz).

enter image description here

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

enter image description here

enter image description here

to get the image shape, the longest maximum sentence in this case is 56 so 56 + 2 * (5-1) = 64 .., what does it mean number 2 ?? where number 2 is obtained?

Padding on the left and on the right of the sentence.

$\endgroup$
2
  • $\begingroup$ what is the use of padding on the left and on the right of the sentence? whereas before the sentence is already on the padding with Max sentence length? how the filter with different size region can do convolution? in the above example there is only one filter with a size of 3x3. $\endgroup$ Commented Sep 13, 2016 at 16:08
  • $\begingroup$ @RiskaNanda Sounds like many questions, which on Stack Exchange should be posted separately. But the first step for you is to make sure you understand the basics of CNN. $\endgroup$ Commented Sep 13, 2016 at 16:12
1
$\begingroup$

Referring to your question regarding '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?'

In CNN step $1$ ,we target to create a $1D$ convoluted feature. In the research paper by Yoon Kim, there are $6$ filters applied, $2$ filters for each sliding window size [$3,4,5$].

So the convoluted layer would be of the dimension : $(S-W +1)\times 1$ , where $S$ means length of the sentence and $W$ mean sliding window size chosen.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.