AI engineering glossary · Feature engineering data prep
What is cyclical encoding?
Cyclical encoding (also called Sine-cosine encoding): Representing a cyclic feature, such as hour or month, with sine and cosine so the end of the cycle sits next to the start: sin(2*pi*x / period) and cos(2*pi*x / period). Otherwise a model treats hour 23 and hour 0 as far apart.
Cyclical encoding: an example
Hour 23 and hour 0 are 23 apart as plain numbers but almost identical after sine and cosine encoding with a period of 24.
Related terms
More Feature engineering data prep terms
- Datetime features
- Discretization
- Domain knowledge features
- Dummy variable
- Dummy variable trap
- Duplicate removal
- Embedded method
- Entity embedding
Where you learn it
Cyclical encoding is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.