When working with features in Machine learning and representing them in a matrix, what's the recommended way to represent hour of day and day of week as features for value prediction models?
Is using 0 for all hour values and 1 for the hour to represent the preferred way to represent these attributes as a feature? Same for day of week?
Thanks
In this case there is a periodic weekly trend and a long term upwards trend. So you would want to encode two time variables:
In general
There are several common time frames that trends occur over:
Look for trends in all of these.
Weird trends
Look for weird trends too. For example you may see rare but persistent time based trends:
These often require that you cross reference your data against some external source that maps events to time.
Why graph?
There are two reasons that I think graphing is so important.
Weird trends: While the general trends can be automated pretty easily (just add them every time), weird trends will often require a human eye and knowledge of the world to find. This is one reason that graphing is so important.
Data errors: All too often data has serious errors in it. For example, you may find that the dates were encoded in two formats and only one of them has been correctly loaded into your program. There are a myriad of such problems and they are surprisingly common. This is the other reason I think graphing is important, not just for time series, but for any data.
Answer from https://datascience.stackexchange.com/questions/2368/machine-learning-features-engineering-from-date-time-data