Tensorflow - Convert timestamp to day of the week

417 Views Asked by At

I have a model that operates on features, one of which is an array of timestamp of previous events.

I would like to compute for each element of this array, the day of the week for each timestamp ("Monday" to "Sunday" or a integer in [0, 7))

I would like to do that in the graph because I want my model to be able to replicate this transformation when I'm making prediction on device.

Day of the week is just one of the information I would like to extract from the timestamp, ideally I would also get year, month, etc... The closest I found so far is the tfa.parse_time which does nearly the exact opposite of what I'd like to achieve.

Is there an existing implementation of such an operator? If not, how could I go about implementing this taking into account leap years, time zones, daylight saving times, etc...?

0

There are 0 best solutions below