Gramian Angular Field Explained Clearly for Time Series Feature Transformation
The Gramian Angular Field, often shortened to GAF, converts one dimensional time series data into two dimensional images. Researchers use GAF to feed time series into image based machine learning models. The method helps models pick up temporal patterns through visual textures rather than raw sequences. GAF works well for classification and anomaly detection problems when convolutional neural networks outperform classical time series models.
Core Idea
GAF transforms a real valued time series into polar coordinates. The method encodes each time step as an angle. It then computes pairwise trigonometric relations between every point. This creates a matrix that stores global interactions across the sequence. The resulting matrix resembles an image. The idea is that spatial relationships in this image capture the dynamics of the original sequence.
Steps in Construction
First, normalize the time series to the range minus one to one. This keeps arccos well defined.
Second, convert each value into an angle using arccos. The radius can be set as a function of time index.
Third, compute the Gramian matrix. The GAF formula uses either cosine sum or cosine difference. Cosine sum produces the Gramian Angular Summation Field. Cosine difference produces the Gramian Angular Difference Field.
Fourth, interpret the final matrix as an image. The model sees temporal changes through the intensity patterns.
Two Major Variants
The summation field uses cosine of the sum of two angles. This highlights global correlation structure.
The difference field uses cosine of the difference of two angles. This highlights local transitions and changes.
Key Advantages
GAF preserves temporal order in both axes.
GAF creates structured images that suit convolutional networks.
GAF can reveal hidden periodicity and trend changes through color or intensity gradients.
GAF enriches the feature space without hand crafted engineering.
Limitations
GAF can become large for long sequences.
GAF may include redundant interactions.
GAF loses some interpretability, since images do not map directly back to raw values.
GAF requires careful normalization since improper scaling distorts angle mapping.
Common Use Cases
Human activity recognition
Financial time series pattern recognition
Sensor anomaly detection
Physiological signal analysis
Electric load forecasting
Comparison to Other Image Encodings
Recurrence plots show recurrence structure rather than trigonometric relations.
Markov transition fields use state transitions rather than angular geometry.
Spectrograms work in the frequency domain, while GAF works in the original time domain through angular mapping.
Summary
The Gramian Angular Field transforms a time series into an image that captures pairwise temporal geometry. It improves performance in models that thrive on spatial pattern recognition. Although GAF adds computational cost, many applications gain accuracy from its structured, information dense representation.
High value source links
https://arxiv.org/abs/1506.00327
https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0134864
https://www.sciencedirect.com/science/article/pii/S0165168418302908



