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.

Level: intermediateTopic: Feature engineering data prep

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.