February 2018
Intermediate to advanced
378 pages
10h 14m
English
The straightforward way to transform dates and time into numerical features is by replacing them with integers. For example, days of the week (assuming that Sunday is the first day) can be encoded as numbers from 0 to 6, and hours as integers from 0 to 23:
Monday, 11:45 pm, alarm tab → [1, 23, 45, 1]Thursday, 1:15 am, alarm tab → [4, 1, 15, 1]Saturday, 10:55 am, timer tab → [6, 10, 55, 0]Tuesday, 5:30 pm, timer tab → [2, 17, 30, 0]
To explain why this is a bad approach, take a look at the following diagram. The samples 11:45 pm and 1:15 am are close to each other, but this will not be obvious to our model if we encode them in a straightforward way. We can fix this situation by projecting the day of the week (d) together with ...
Read now
Unlock full access