liveBook · Manning

Local averaging

As explained in Math and Architectures of Deep Learning

A smoothing technique that reduces short-scale fluctuations by averaging nearby values in one dimension.

Local averaging smooths a one-dimensional signal by replacing each value with an average of nearby values. Uniform, normalized convolution weights preserve the broad trend while reducing short-term fluctuations and noise. section 10.1.1

A kernel with equal weights performs a weighted local average at every position. In one dimension, a three-value window illustrates the operation; in two dimensions, each output pixel averages neighboring pixels such as a 3 × 3 region. This behavior corresponds to low-pass filtering: high-frequency variation is reduced while longer-term structure remains. section 10.1.1 section 10.3.1

Local averaging is useful for:

  • Making broad trends easier to see by suppressing local fluctuations. section 10.1.1
  • Denoising images before analyzing meaningful content such as text. section 10.3.1

Fixed-weight 1D convolution

In PyTorch, a three-element weight tensor such as [0.33, 0.33, 0.33] can be assigned to Conv1d with stride 1 and no bias. Reshaping the input and weights supplies the convolution interface; disabling gradients makes the kernel a fixed averaging operator. section 10.1.4

Figure 10.5 Graph of the input array solid) and output array (dashed) from figure 10.1. Note that the averaged) version of the input. Such local soothing captures the low-frequency (long-term) broad trend of the function by eliminating high-frequency (short-term) noise.

Compare the fluctuating input curve with the smoother output curve to see local averaging capture the broad trend. section 10.1.1

How Math and Architectures of Deep Learning covers it

How deep it goes
Defines normalized uniform kernels, explains their averaging and low-pass behavior, and demonstrates fixed-weight PyTorch implementations in one and two dimensions.
Examples
Uses a three-value moving average, a fluctuating curve, and a salt-and-pepper-noisy text image as concrete demonstrations.
What you can do after
Apply it via PyTorch by configuring Conv1d or Conv2d with fixed uniform weights and correctly shaped tensors.
How it connects
Connects convolution with low-pass filtering, noise reduction, image processing, and edge detection through contrasting kernel weights.

Also explained in

Compare how 7 books explain local averaging →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math and Architectures of Deep Learning. The section links point to the parts of the book it draws on.