liveBook · Manning

Sliding window

As explained in Deep Learning with Python, Third Edition

A technique that moves a fixed-size window across text or other data to create overlapping local segments.

A sliding window moves a fixed-size span across tokenized text, producing local sequences that overlap as the window advances. It turns one long stream into many model-ready examples. section 14.5.4 section 16.2

Nine-token CBOW windows

With a window size of nine and a context size of four, each window contains four tokens on the left, one middle token, and four tokens on the right. Remove the middle token to form an eight-token context bag, and use it as the label to predict the missing word. Advancing the window by one token repeats this process for the rest of the text. section 14.5.4

How Deep Learning with Python, Third Edition covers it

How deep it goes
Explains fixed-size extraction through worked token examples and TensorFlow preprocessing, stopping short of general windowing theory.
Examples
Uses nine-token CBOW windows with an eight-token context and one label, plus 256-token shifted Transformer sequences.
What it assumes
Assumes tokenized integer sequences and basic dataset pipelines; demonstrates tokenization setup before window construction.
What you can do after
Build it from scratch with TensorFlow, TextVectorization, tf.data, and Keras models.
How it connects
Connects sliding windows to tokenization, word embeddings, CBOW, language modeling, Transformer pretraining, and tf.data pipelines.

Also explained in

Compare how 8 books explain sliding window →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.