TimDettmers / ConvE

Convolutional 2D Knowledge Graph Embeddings resources
MIT License
675 stars 163 forks source link

Question about "Number of Interactions for 1D vs 2D Convolutions" #28

Closed Xiaobenbenben closed 6 years ago

Xiaobenbenben commented 6 years ago

Hi,

Thanks for your remarkable paper! I am sorry to tell you that I could not quite catch “Number of Interactions for 1D vs 2D Convolutions”in your paper. Specifically, why the number of interactions for 1D convolution is proportional to k, and why n and k for 2D convolutions?So is the number of interactions for 3D convolutions. Sorry for my poor English.

Thanks, Benben

TimDettmers commented 6 years ago

I actually think I made a mistake here — good catch!

In the 1D case, the number of interactions between a and b is only determined by the filter size. If the filter is of size k=1, then we have no interactions between a and b. If we have a filter size of k=2 then there are 2 interactions (if the filter is between a and b); with k=4 we have 3 interactions: [a a b b] [a a a b] [a b b b]

All other filter positions will be either [a a a a] or [b b b b] — so no interactions.

In the 2D case, we can shift the filter both left/right as above, but also top/down and thus we have more interactions. For a filter of size 3x3=kxn where we concatenate the 2D reshaped vectors on both top and bottom, we have these configurations:

[ a a a] [ a a a] [ b b b]

[ b b b] [ a a a] [ a a a]

[ a a a] [ b b b] [ a a a]

And for left/right we have the same configuration and thus in total, we have 6 different interactions. The rest will be full of a or b. However, in this case, since we concatenate 2 matrices we have k+n interactions. If we want to have k*n interactions we would need an alternating pattern of a and b values.

Does this make sense?

Xiaobenbenben commented 6 years ago

Thanks for your reply!