23 — Deep Learning

CNN — Convolutions#

Architecture✓ Mathematical
◆ The PatternExploiting spatial structure with shared local filters

Convolutional layers apply a small learnable filter across the entire input — translational equivariance.

(f * g)[i,j] = Σₘ Σₙ f[m,n] · g[i−m, j−n]
f = filter/kernel  |  g = input  |  slide filter, compute dot product at each position
Output size = ⌊(W − K + 2P)/S⌋ + 1
W = input width  |  K = kernel size  |  P = padding  |  S = stride
// Convolution operation — kernel sliding over input
Kernel Size3×3
Stride1
self.conv1 = nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1)
self.pool  = nn.MaxPool2d(kernel_size=2, stride=2)
self.conv2 = nn.Conv2d(64, 128, kernel_size=3, padding=1)
Pattern bridge: Sliding a kernel across an image is the same operation as a moving average sliding across a price series. Both detect local patterns through shared weights.
← Previous
Cosine Similarity
Open in the full reader, with the topic sidebar →