7/16 Convolutional Neural Networks II
Yesterday, we noted that an affine map
is equivariant under cyclical shifts of the matrix rows if and only if the following conditions hold:
- The matrix \(B\) is constant along rows.
- There exist matrices \(W_1,\dotsc,W_s\in\mathbf R^{d\times d'}\) such that for \(X\in\mathbf R^{s\times d}\), we have
We can similarly form equivariant affine maps \(\mathbf R^{s_1\times\dotsb\times s_r\times d}\xrightarrow A\mathbf R^{s_1\times\dotsb\times s_r\times d'}\).
Locality and Kernels
Inspired by cats, we want our model to only consider local connections. This means to fix a kernel, that is selecting a collection of sequence index displacements that will get nonzero weights and disabling modular equivalence of indices.
To help understand convolution kernels, let's write up the exact formula for \(r=1\):
-
(Hyper)parameters:
- Sequence size \(s\)
- Kernel size \(k\)
- Dilation \(l\)
- Padding \(p_1,p_2\)
- Stride \(q\)
-
Displacements: \(I=\{0, l, \dotsc, l(k-1)\}\).
- Base indices: \(J=\{-p_1,-p_1 + q,\dotsc,q(s'-1)\rfloor\}\) where \(s'=\lfloor\frac{s-1+p_2}{q}\rfloor\).
- Then the matrices \(\{W_i\in\mathbf R^{d\times d'}:i=0,\dotsc,k-1\}\) determine a map \(\mathbf R^{s\times d}\xrightarrow L\mathbf R^{s'\times d'}\) where
Pooling
Local data can be aggregated by pooling operations. These have similar formulas as the kernel-based convolutions above, but:
- instead of summation, we usually use mean or maximum and
- the linear maps \(W_i\) are identities.