Fourier Transform & Convolution Intuition
Useful for signals, vision, audio and some time-series work.
1. Plain English Intuition
The Fourier Transform breaks any complex signal or time series down into a combination of simple sine and cosine waves of different frequencies. Convolution slides a filter across an image or audio waveform to detect local features like edges or pitch. The Convolution Theorem reveals a deep connection: convolution in the time domain is equivalent to simple multiplication in the frequency domain (F(f * g) = F(f) · F(g)).
2. Where It Appears in ML & Deep Learning
- 1Audio processing: Spectrograms for speech-to-text models (Whisper, wav2vec)
- 2Signal processing and sensor time-series feature extraction
- 3Fast convolution algorithms in PyTorch using FFT kernels
- 4State-Space Models (Mamba, S4) utilizing frequency-domain representations
3. Inputs, Outputs, Shapes & Assumptions
4. What Can Go Wrong (Gotchas & Failures)
Aliasing: Frequencies higher than half the sampling rate (Nyquist frequency) fold over as fake low frequencies.
Spectral leakage: Fixed-length windowing causing frequency bleeding (requires Hanning windows).
5. Python in Practice
Engineered using: np.fft.fft, scipy.signal.spectrogram, torch.fft
import numpy as np
# Create a composite signal: 5 Hz wave + 20 Hz wave
sample_rate = 100
t = np.linspace(0, 1, sample_rate, endpoint=False)
signal = np.sin(2 * np.pi * 5 * t) + 0.5 * np.sin(2 * np.pi * 20 * t)
# Fast Fourier Transform (FFT)
fft_vals = np.fft.rfft(signal)
fft_freqs = np.fft.rfftfreq(len(signal), d=1/sample_rate)
magnitudes = np.abs(fft_vals)
# Find dominant frequency peaks
dominant = fft_freqs[np.argsort(magnitudes)[-2:]]
print("Dominant frequencies detected by FFT:", np.sort(dominant))Fast Study Loop
Complete these 3 steps to mark this topic understood: