# Modelling Periodic Features

I am trying to do a simple regression (either polynomial or support vector regression) for solar power prediction, as a project to learn machine learning. However the data I have is time series data of the following format:

| Year | Month of Year | Day of Month | Hour of Day | Temperature | Solar Power

Currently,
Month of Year = 1 to 12
Day of Month = 1 to 31
Hour of Day = 0 to 23


How do I incorporate the knowledge that January this year is as close to December last year as is it to February this year? Same goes for the hour of the day. Even if incorporating this knowledge may not be required for this particular case for solar power, I would still love to learn how.

I searched previous questions and found that, for something like an angle, we could incorporate the knowledge that 359 degree is close to 0 degree, by applying a sine function on angle data. I could possibly apply the same to my time variables by first scaling them to lie within 0 to 360 range, but I fear that it will introduce extra un-warranted knowledges (its slope is not constant, and it is symmetrical).

Any suggestions/comments on how to do this properly? Thanks.

Edit: More details

If I scale the hours from 0,24 to 0,180 and apply sine, then 0 will be close to 24. However, 1 will also be close to 23, 2 with 22, 3 with 21 and so on, which is unwarranted. Also, the rate of change is much faster around 0 and 180 degrees for the sine function, than around 90 degrees, which means, the difference between 23 and 0 hours is much more than between 11 and 12 hours.

Ideally, I would like to lay 0-24 in a ring (like in a watch), and have some function convert it into some numbers such that, the numerical difference between those numbers would be equal to distance between those numbers around the ring. I read the answer about using both cosine and sine, but its still over my head. Maybe the answer lies there. If yes, could you please explain a bit in this context, how that might solve the problem. Thanks.

• You can clearly, for example, scale the hours of the day on the 0,23 interval in the same way as those other answers suggest to scale the degrees of the circle so I can't quite see where your difficulty is given you understand that technique. For example the second answer here - stats.stackexchange.com/questions/4783/… says exactly what to do, just make the wavelength variable 24 for hours of the day, etc. May 10 '16 at 11:31
• @RobertdeGraaf Thanks for your reply. I have edited the question and added details, to explain what I am looking for. Thanks. May 10 '16 at 13:04
• Use a periodic kernel.
– Sycorax
May 10 '16 at 14:31

All I needed to do was convert the linear 0-24 (for hours of the day) and 0-365 for days of the year, from linear coordinates into polar coordinates by x = r*cos(theta), y=r*sin(theta) transformation. So, each of those linear features will be split into two features, their x-coordinate and y-coordinate such that they lie in a circle.