10/07/26: Lect-06 (cont.)
Overview
Joseph Zambreno explains why deep MLPs require careful initialization to prevent exploding or vanishing activations and gradients, then uses Case Western Reserve University bearing data to connect domain-informed feature engineering with classification and data-leakage risks. He introduces convolutional neural networks as a more practical alternative to fully connected MLPs for images, motivated by parameter growth, translation robustness, and spatial locality, and describes how learned filters extend traditional image-processing kernels.
Key takeaways
- Deep MLPs can suffer exploding or vanishing values because forward activations and backpropagated gradients repeatedly pass through weight matrices; Xavier and Kaiming initialization scale weights according to layer size and activation behavior.
- Randomly splitting overlapping windows from one sensor sequence can leak near-duplicate observations into both training and validation sets, making reported generalization unreliable.
- Bearing-fault classification benefits from combining ML with signal-processing expertise: features such as RMS, kurtosis, and spectral energy in physically meaningful frequency bands can matter more than simply increasing MLP depth.
- A flattened 12-megapixel image mapped to 1,024 hidden units requires about 12 billion weights, approximately 48 GB at four bytes per weight, illustrating why fully connected image models scale poorly.
- Convolutional networks exploit spatial locality by applying compact filters to local patches, then learning the filter weights through backpropagation rather than hand-designing every kernel.
Chapters
- Adding layers extends linear models with more weight matrices and activation functions, but makes training numerically harder.
- Every layer affects both the forward computation and backpropagation, including gradients with respect to weights and layer inputs.
- Repeated matrix products can make values or gradients explode, producing infinities or NaNs, or vanish toward zero and stall training.
- Input normalization and parameter initialization both help prevent layer outputs from becoming excessively large or small.
- Xavier initialization scales weights using a layer’s input and output widths; Kaiming, also called He, initialization is designed for activations such as ReLU.
- ReLU zeros negative inputs and their gradients, so initialization must account for its asymmetric effect as signals pass through many layers.
- PyTorch initialization choices address the same stability problem that arbitrary standard deviations such as 0.1 or 0.01 only approximate.
- The Case Western Reserve University bearing dataset records accelerometer vibrations from an electric motor under normal and intentionally faulted conditions.
- Fault categories include defects in the inner race, outer race, and rolling-element bearings; each can change vibration patterns at characteristic frequencies.
- The task is to classify motor condition from sensor measurements, even though raw traces may look similar to visual inspection.
- Joseph Zambreno uses simulated traces for the in-class example after struggling to prepare the original data.
- A sequence can be divided into sliding windows and treated as many samples, but neighboring windows may contain nearly identical measurements.
- Splitting such windows randomly across training and validation sets creates data leakage because validation examples overlap with training data.
- Zambreno cites a meta-study reporting that 40 of 41 examined bearing-data papers handled this issue incorrectly.
- A valid evaluation must separate data so that test results measure generalization to genuinely unseen observations.
- Rather than feed 2,048 raw accelerometer values directly to an MLP, the example extracts a compact set of engineered features.
- Time-domain features include root mean square, kurtosis, skewness, and peak-to-peak amplitude; frequency-domain features include spectral energy in selected bands.
- Choosing useful frequency bands requires knowledge of motor speed and bearing geometry, not just a generic machine-learning model.
- A plot of two features, including kurtosis and energy near an inner-fault frequency, shows that engineered features can still leave classes overlapping.
- The comparison uses a softmax linear classifier, a one-hidden-layer MLP, and a three-hidden-layer MLP on the bearing features.
- All three reach roughly 68% to 71% validation accuracy, while more complex models reduce loss without a comparable accuracy increase.
- Cross-entropy loss reflects confidence in the correct class, whereas accuracy records whether the predicted class was correct.
- Confusion matrices show that normal-versus-abnormal detection can work better than identifying the precise fault; targeted feature analysis raised reported accuracy above 90%.
- An MLP can classify small MNIST images by flattening each 28-by-28 image into a feature vector.
- A larger example image, about 12 megapixels, becomes roughly 12 million input values when flattened.
- A single layer mapping 12 million inputs to 1,024 hidden units requires about 12 billion weights, or roughly 48 GB at four bytes per weight.
- The same MLP equations still apply, but their parameter and memory costs make this approach impractical for large images.
- An MLP trained on an object in one image location may fail when that object shifts, because each pixel position has its own learned connections.
- MNIST keeps digits relatively centered, while the SVHN example illustrates how location variation can undermine that assumption.
- Traditional augmentation addresses shifts by adding translated or otherwise transformed examples to the training set.
- Augmentation must preserve labels for the task: an upside-down stop sign may still be an octagon but may not present readable STOP text.
- A fully connected layer assigns weights to every input-output pair, even when distant image pixels are unlikely to be directly related.
- Natural images often exhibit spatial locality: neighboring pixels are more likely to belong to the same object or visual feature.
- This all-to-all connectivity contributes to the enormous parameter count and does not build translation robustness into the model.
- A locally connected operation focuses on a small region rather than learning every relationship across the full image.
- A sliding window processes one fixed-size patch at a time, then moves across image rows and columns.
- Applying the same small detector to multiple locations can reduce the parameters needed compared with a full-image MLP.
- Repeated local processing can also help detect an object in different positions, though a separate aggregation or classification step may still be needed.
- The window-by-window idea parallels extracting features from segments of the one-dimensional bearing signal.
- A filter, or kernel, is a small grid of weights applied to local image patches as a window moves across the image.
- A 3-by-3 box blur assigns each pixel a weight of one ninth, averaging the neighborhood and smoothing local variation.
- Gaussian blur weights the center more heavily, while sharpening and Sobel filters emphasize different image structures such as edges.
- These conventional image-processing filters are manually designed, with weight patterns chosen to produce a known effect.
- A convolutional neural network learns filter values from training data rather than relying only on hand-designed kernels.
- Backpropagation updates the kernel weights so that local patterns become useful for the classification objective.
- Early learned filters can resemble edge or texture detectors, while stacked layers build features from increasingly larger receptive fields.
- The core operation resembles traditional filtering, but the filters become trainable model parameters.
Transcript excerpt
0:00 In terms of where we left off on Monday, um I I think the important part to keep in mind is that the kind of mathematical underpinnings uh or the calculus of what we're doing with multi-layer perceptrons is a relatively straightforward extension of what we were already doing with our linear models. Instead of one layer, we have multiple layers. And we we quickly kind of went through the argument that you do need to add those nonlinearity the the activation functions between your layers. But otherwise in terms of what's happening in terms of a mathematical description uh it is a real relatively straightforward extension of what we were already doing. Where it starts to get interesting and where the answer to the question of how do I build a model is not just add more layers is when we get to the kind of underlying quantification the messy reality of what
0:48 that computation looks like in practice versus what the calculus looks like. and the it's an issue although we talked about it mostly at the end of Monday in terms of the backwards pass it's also equally an issue for the forwards path so I I didn't quite mentioned that on Monday but that is also the case and so when we look at the design of for example these activation functions they do seem a little arbitrary some are sshaped others are less so but we care actually about the behavior both of the forward path the the blue line in these graphs here as well as the dashed purple line the the gradient um the the gradient characteristics of that function as well. When it's just one layer, it's not that big of an issue. I think you can argue when it's two layers
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Joseph Zambreno.