Deep learning for signals
Learning the filters instead of designing them: 1-D convolutions, dilated stacks, spectrograms and the evaluation pitfalls of time-series models.
For decades, reading a biosignal meant hand-designing features: detect the R peak, measure the intervals, compute band powers, feed those to a classifier. Deep learning asks why we should design the filters at all. A one-dimensional convolutional network slides learnable kernels along the waveform and discovers the features itself — the same operation as the hand-designed FIR filter, but with weights found by backpropagation rather than chosen by an engineer.
The widget shows the forward pass concretely: a signal convolved with class templates, rectified, globally max-pooled and passed through a softmax.
A conv layer is a bank of learned filters
Each 1-D kernel is a small pattern matcher. Convolving it over the signal produces a feature map that is large wherever the pattern occurs. ReLU keeps positive matches, global max-pooling keeps "did it occur anywhere", and the classifier decides from those presence scores. Stacking layers lets later kernels compose earlier ones into complex morphology.
A tiny 1-D CNN: convolution → ReLU → global max-pool → softmax. Choose the signal class and noise level; invert the kernels to watch it fail.
3 Hz sine
template → feature map
pooled score 0.497
11 Hz sine
template → feature map
pooled score 0.964
3 Hz square
template → feature map
pooled score 0.474
predicted 11 Hz sine — correct
Real convolution, ReLU, max-pooling and softmax on a synthetic signal. Matched-filter templates are fixed; a trained 1-D CNN learns its kernels by backpropagation, but the forward pass you are watching is the same computation.
The 1-D convolution, layer by layer
A 1-D convolution of signal with kernel of length produces
and a downsampling layer halves or thirds the length to build invariance. With output channels the layer learns distinct filters, each looking for a different local pattern. A global max-pool collapses the time axis to one number per channel — a learned "did this pattern appear" feature — and a final linear layer maps those features to class scores.
The receptive field and dilation
A single layer of length sees only samples. Stacking layers grows the receptive field linearly with depth, so capturing a full heartbeat (hundreds of samples) would need a deep stack. Dilated convolutions insert gaps in the kernel, so layer with dilation reaches exponentially far with linear depth — the trick from WaveNet that made raw-audio modelling practical. Causal padding restricts each output to past inputs, which matters for real-time streaming.
Spectrograms and 2-D CNNs
An alternative to convolutions on raw time is to convert the signal to a spectrogram (a short-time Fourier transform whose columns are spectra) and treat it as an image. Image architectures then apply directly, and time–frequency structure becomes spatial texture. The trade-off is resolution: the window size that gives good frequency resolution gives poor time resolution, and vice versa. Raw-waveform 1-D CNNs avoid that choice but must learn the time–frequency transform themselves.
Evaluating a time-series model
- Split by time, not at random. Neighbouring windows are highly correlated; random splits leak information and inflate accuracy.
- Resample to a fixed rate. Devices and studies differ, and aliasing after naive resampling is a silent bug.
- Report per-class sensitivity at a clinical threshold, not just AUC, when the downstream action is an alert.
- Test on other devices and populations — domain shift is the norm in physiological data.
Leakage is the classic time-series mistake
If overlapping windows from the same recording appear in both train and test, the model can memorise the patient rather than the pathology and post spectacular, meaningless numbers. Group splits by subject and split along time before you believe any accuracy figure.
Illustrative vs real
The widget uses fixed matched-filter templates and a three-class synthetic signal; a trained 1-D CNN would learn its kernels by backpropagation and stack many channels and layers. Hannun et al. classify twelve ECG rhythms from a single lead with a deep 1-D CNN; WaveNet models raw audio with dilated causal convolutions. The convolution, ReLU, pooling and softmax shown here are the same forward operations those networks use.
Check yourself
Eduspheria wiki · Applied AI, Signals and images
0 / 5 answered
From the assignment paper
Modeled on NITJ AI-607, Assignment/Quiz
0 / 6 answered
Where next: this chapter closes the Applied AI domain. From here, the same convolution and attention primitives recur in the Deep Learning and LLM domains — the applied problems change, the machinery does not.