A convolutional neural network (CNN) learns patterns from local neighborhoods in structured data. It is especially suited to images, where neighboring pixels often belong to the same object and useful patterns recur in different locations. Unlike a dense network that treats a flattened image as a vector, a CNN builds spatial structure into its architecture. section 3.4.2 section 3.4.7
A convolutional filter combines each local patch of an image into a value using a shared set of weights. The same filter slides across the image, detecting a pattern such as an edge, corner, or texture wherever it appears. Sharing weights reduces the number of parameters and allows the network to reuse what it learns across locations. section 3.4.2
Many CNNs follow convolution with pooling, which condenses small neighborhoods of a feature map. Pooling reduces spatial detail while retaining prominent signals, making representations more stable across small shifts or distortions. Stacked layers build a hierarchy: early layers respond to simple shapes, while deeper layers combine them into parts and recognizable objects. section 3.4.2
Figure 3.13 A convolutional neural network that splits image analysis into two stages. Convolutional filters scan the image for local patterns, while pooling layers reduce spatial detail while preserving the most informative features. Stacked together, these layers build a hierarchy of representations, moving from simple edges to increasingly complex shapes. The resulting feature maps are then flattened and passed to dense layers, which integrate these features to produce a final prediction, such as identifying the object in the image. Dense layers appear at the end because classification requires combining information from across the entire image, not just from local regions. A softmax activation converts the final scores into probabilities over the output categories.

The diagram traces image classification from local filtering and pooling through dense layers to output probabilities. section 3.4.2
The same local approach can also work on text. Filters applied across a sequence can capture short-range cues for sentiment, topic, and syntax. CNNs can process these patterns efficiently, but their limited local context makes distant dependencies harder to capture. Their suitability therefore depends on whether local structure carries enough information for the task. section 3.5.4 section 3.5.1
Sentence and character classification
A 2014 sentence-classification CNN outperformed more elaborate recurrent systems on several benchmarks. Later character-level CNNs learned directly from raw text, handling variation such as inflection and noisy spelling without predefined vocabularies. section 3.5.4




















