A cyclical feature is one that has ordered values that cycle. Day of week is an example; you can express it as a value from 1 (Monday) to 7 (Sunday), where it cycles every 7 days. For purposes of training a model, we want 7 (Sunday) to be just as close to 1 (Monday) as 2 (Tuesday) is. We can do so by transforming the 1 to 7 integer value to a sine and cosine pair.
One way to accomplish the representation of day of week as a sine and cosine pair is to simply replace the day_of_week feature in the input data with two features: day_of_week_sin and day_of_week_cos. But is there a way to do it in a preprocessing layer so that the input is still day_of_week, but the preprocessing layer takes care of splitting it into the sine and cosine pair?
It seems having a preprocessing layer “hide” the encoding of cyclical features makes it easier for clients of the model to train and invoke it.