I need to add an hour feature to my data.
Assigning "dummy variables" (which is what I usually do) does not work in this case, apparently (wouldn't elaborate - but believe me this is so).
At first, I simply assigned the hour itself (13:00 - 13, 14:00 - 14, etc...)
But then I realized this means 23:00=23 is radically different in value from 00:00=0, which is clearly undesirable since they are quite close in reality.
I read in google and found there's the following transformation: sin(2*pi / 24 * hour) which would result in hour 23:00 and hour 00:00 both giving close values.
However, I have several issues with the new method:
- hours 5 and 7 (for instance) are indistinguishable to the algorithm as they have the same value (0.965)
- Another problem is that, for instance, the difference in value between hour 6 (1.0) and 7 (0.965) is different from the different of 7 (0.965) to 8 (0.877) - which, of course, does not reflect reality (at least not in my case).
Is there any other, better solution to this problem than I raise above?