I am fairly new to RNNs and Im having trouble setting up the desired output from RNN using Keras library. Each datapoint in my dataset consist of a pattern of labels and timestamp of occurrence of each label and based on the pattern of label I want to predict what the next label in the pattern be. I have developed the model which takes series of label as input and outputs the next label in the series but now I want to input labels as well as their timestamp and receive output the next label as well as the timestamp of its occurrence. How can I achieve this with a single model?
-
1$\begingroup$ How many labels are there (E.g.: 10s, 100s , 100s ). $\endgroup$– Shamit VermaDec 5, 2018 at 14:03
-
$\begingroup$ What is the granularity of timestamps (seconds, days, months...)? Answer to these questions might make some options feasible or not. $\endgroup$– Shamit VermaDec 5, 2018 at 14:07
-
$\begingroup$ around 200 labels, granularity is day (note a label doesn't show up every day. A new label could show up a week after the last one or the very next day) based on last 6 labels im trying to predict the 7th one. $\endgroup$– Ammar AhmedDec 6, 2018 at 6:29
1 Answer
You can convert input to vectors of labels + day number . E.g:
(First column is day-number, rest of the columns indicate presence/absence of a label)
[[ 1 0 1 0 0 0 0 .......] [ 2 1 0 0 1 0 0 .......] [ 3 1 1 1 1 0 0 .......] [ 4 1 0 1 1 0 0 .......] [ 5 1 1 0 1 0 0 .......]] (5000, 201)
Output should be a vector of probabilities for individual labels.
This article has an example :
https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/