Search code examples
deep-learningtime-serieslstmrecurrent-neural-networkforecasting

How to account for rare events at different time intervals while using LSTM neural networks?


I'm working on an interesting sequence-to-sequence (regression) time series problem where some static features/rare events can change the behavior of future time series. The problem is a forecasting problem, where I use previous time step values to forecast the next time step values and I try to integrate static features + rare events into time step t=0.

In my problem, there is always a rare event at t=0 in addition to some static features that should affect the future behavior of time series.

For clarity, My definition of "rare events": an event that happens at a specific time step (for ex: t=0) and another separate event can happen at any time in the future as well (for ex: t=n) in addition to the event that happened at t=0 but, it happens only once at that time and both events can affect the future time series behavior starting from the time they occurred.

Even though most of the static features don't change over time, the rare events can be different from each other (has different characteristics/features). The time of each event is usually known because it will be applied due to outside human intervention to optimize the future behavior (increase profit) but, they do not necessarily happen at the same time step for every sample/example.

These events are so rare that it kind of makes sense to me to treat them as static features at time=0 but, I can't think of a way to include a rare event that happens n timesteps later in the future and has different characteristics than the event at t=0.

Below is an example schematic of the problem. There may be multiple samples with varying time steps affected by these unique rare events but, if I don't account for these events, I believe my predictions may suffer.

Can anyone suggest any sources to look at for these types of problems? I may also be missing key words that are usually used with these types of problems and that may be one of the reasons why I'm still having difficulties finding good sources. I call it "rare events" but, it may be called something else in the literature... At this point, I appreciate any type of source that addresses this issue such as scientific papers/articles, github code or a code example provided by you, correct keywords to search for, etc.

Thank you.

Example image to describe the problem


Solution

  • I have seen your rare event in the picture you have mentioned from the little information present in the picture it could be observed that there is some seasonality present in the rare event . So if you using rare to point out a random event i think that is not correct because it has seasonality (periodic). In short words you are worried about the features that you using to train the model.

    1. normal events
    2. rare events

    There may be multiple samples with varying time steps affected by these unique rare events but, if I don't account for these events, I believe my predictions may suffer.

    If you are not certain whether your features rare ones you have mentioned are contributing/ or not etc.

    You must switch to attention based mechanism because :

    " Attention is all you need "

    These models such as Bert are much better then LSTM because they add a attention (Importance) feature to every feature so the model will learn automatically that how much weightage should be added to both rare and normal features. I am explaining in very general terms as your question was not too much specific. Have a nice day stay blessed !