Tensorflow many-to-one RNN time series

Viewed 239

I am trying to implement a many-to-one RNN using time series data using tensorflow, similar to the example given https://www.tensorflow.org/tutorials/structured_data/time_series. The data looks similar to the one below

Time    Latitude    Longitude     Speed      Heading (deg)
0       20          20            5          180
1       19.9        20            5          180
2       19.8        20            5          180
3       19.7        20            5          180

Now my goal is to use the first 3 timesteps to predict the latitude of the next timestep. So my input would be

Latitude    Longitude     Speed      Heading (deg)
20          20            5          180
19.9        20            5          180
19.8        20            5          180

and my output would be

19.7

My inputs may be "numbers", but they're all really categorical. Ex. heading 359 deg and 1 deg is nearly identical. I have tried one-hot encoding the data, then concatenating it to create a "four hot encoding" of the data but with little success.

How do you encode the features I have in a format that makes sense?

1 Answers

You can set some boundaries for each of the areas. For example, if Latitude is less than 10, assign it to class 0, if 10 < Latitude < 20 - to class 1, and more than 20-to class 2. You can do it by simply adding columns to your dataframe.

Related