-
Book Overview & Buying
-
Table Of Contents
Time Series with PyTorch
By :
Following the brief introduction of CPC in the previous section, apart from building up the contrast using predictions, as shown in Figure 18.2, another key component of CPC is the contrastive loss function—often implemented as the InfoNCE loss—which will be discussed in depth shortly.

Figure 18.2: The structure of CPC
A CPC model encodes the input time series, then predicts next time steps on the encoded representation. Since the context is built using an autoregressive method, each element actually contains historical information up to the most recent time step contained in the sliding window.
Imagine we are trying to find mature bananas among a bunch of mixed raw and mature bananas in a blurry photo. One strategy is to look at the color of bananas. We try to tune the colors of the photo so that the yellow bananas are more distinguishable from the green bananas, just by color. This is similar to the idea of InfoNCE loss...