Multivariate time series forecasting and LSTM: When should I separate time series in different inputs

zaratruta: <p>Let us suppose that I have a multivariate time series with two variables that vary together in time: var1 and var 2. And let us suppose that I want to forecast the n-ith value of var 2, by considering a window with the n-1 past values of var1 and var2.</p>
<p>I would like to use a LSTM in the first layer.</p>
<p>I’m not sure if it would be better to consider a single input with 2 dimensions (providing the n-1 values of both variables) or if it would be better to separate both variables in two different inputs.</p>
<p>Is there any rule or heuristic for guiding this decision?</p>
<p>Best regards.</p>

blueeagle: <p>What do you mean with „two different inputs“?</p>
<p>You can consider your multivariate time-series a sequence, and both variables a Feature of it. Then, you can use this sequence as input for your LSTM, i.e. during each time-step i the LSTM receives a vector of the values of var1 and var2 at time i as input.</p>
<p>You can initialize your LSTM to produce a single value as output, wich is var2 at time i+1.</p>
<p>This would allow you to train the LSTM in a straightforward way, as your labels are just the var2 channel of your time-series shifted by one time-step. During Inference you could only use the last generated output of your LSTM, which is the prediction of var2 at time-step N.</p>
<p>And just for the sake of completeness: Training of LSTMs can be rather slow as you will need an algorithm named Backpropagation through time, that is computationally costly. If you always want to make your predictions based on time-windows of same length, you could also consider using a regular CNN</p>

somayyeh_hasanzadeh: <p>Hi dear <a class="mention" href="/u/ptrblck">@ptrblck</a><br>
I confused, I have a CSV dataset that has 47 columns, and I want to predict glucose after 30 minutes. every glucose level measures for 5 minutes by CGM. Only the glucose change with time and others are static. now I don’t know what should I do for my model. can you help me please?<br>
Thank regards<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/c/7c313486ee6432647bf08a9cf57a67c456f673f4.png" data-download-href="https://discuss.pytorch.org/uploads/default/7c313486ee6432647bf08a9cf57a67c456f673f4" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/c/7c313486ee6432647bf08a9cf57a67c456f673f4_2_690x234.png" alt="image" data-base62-sha1="hIECVRuh0iE61CX4pDloKy1lAbi" width="690" height="234" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/c/7c313486ee6432647bf08a9cf57a67c456f673f4_2_690x234.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/c/7c313486ee6432647bf08a9cf57a67c456f673f4_2_1035x351.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/7/c/7c313486ee6432647bf08a9cf57a67c456f673f4_2_1380x468.png 2x" data-dominant-color="F4F4F4"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1380×468 45.4 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
this is the schema of my data</p>