if i wanted to train an lstm to predict the next date in a sequence of dates, how would i do that since lstm require a scaled value?
example of data:
date | next date |
---|---|
2012-05-12 | 2012-05-13 |
2012-05-13 | 2012-05-19 |
2012-05-19 | 2012-05-20 |
2012-05-20 | 2012-05-22 |
2012-05-22 | 2012-05-26 |
2012-05-26 | 2012-05-27 |
2012-05-27 | 2012-05-30 |
2012-05-30 | 2012-06-12 |
2012-06-12 | 2012-05-19 |
2012-06-19 | 2012-06-25 |
CodePudding user response:
You could hand over the date split into three inputs: One would then be the year, the other the month, and the last the day. While normalizing your inputs definitely makes sense, however I would entirely agree with your "LSTM reqires".
Day and month are already a limited to a range of values which can be scaled
- day (1 - 31)
- month (1 - 12)
For year you need to make an educated assumption based on your application. So that year can then also be transferred to a scaled value. Jusging from your data, it might be that year is constant at 2012 is is not needed to begin with.
- year (2012 - 2013(?))
Note: Ask yourself whether you give the neural network enough system information to be able to predict the next date - meaning, is there already enough of a pattern in your data? Otherwise you might end up training a random predictor.