Handling a priori on covariate variables for RNN

Eyzzle: <p>I am currently building my own dataloader. The objective is to perform time series forecasting.</p>
<blockquote>
<p>Note: I could not use the builtin TimeSeriesDataSet from pytorch-forecasting due to the nature of my dataset.</p>
</blockquote>
<p>As an exemple, let’s assume I am forecasting weather, using the following dataframe:</p>
<pre><code class="lang-auto">X = pd.DataFrame(data={
    'temperature': np.random.random((1, 10)).ravel(),
    'pressure': np.random.random((1, 10)).ravel(),
    'humidity': np.random.random((1, 10)).ravel(),
})

print(X.to_markdown())
</code></pre>
<div class="md-table">
<table>
<thead>
<tr>
<th style="text-align:right"></th>
<th style="text-align:right">temperature</th>
<th style="text-align:right">pressure</th>
<th style="text-align:right">humidity</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right">0</td>
<td style="text-align:right">0.501873</td>
<td style="text-align:right">0.741631</td>
<td style="text-align:right">0.500776</td>
</tr>
<tr>
<td style="text-align:right">1</td>
<td style="text-align:right">0.639229</td>
<td style="text-align:right">0.716319</td>
<td style="text-align:right">0.846043</td>
</tr>
<tr>
<td style="text-align:right">2</td>
<td style="text-align:right">0.305061</td>
<td style="text-align:right">0.78736</td>
<td style="text-align:right">0.2809</td>
</tr>
<tr>
<td style="text-align:right">3</td>
<td style="text-align:right">0.666592</td>
<td style="text-align:right">0.241905</td>
<td style="text-align:right">0.534717</td>
</tr>
<tr>
<td style="text-align:right">4</td>
<td style="text-align:right">0.29799</td>
<td style="text-align:right">0.758383</td>
<td style="text-align:right">0.217077</td>
</tr>
<tr>
<td style="text-align:right">5</td>
<td style="text-align:right">0.398248</td>
<td style="text-align:right">0.537553</td>
<td style="text-align:right">0.524409</td>
</tr>
<tr>
<td style="text-align:right">6</td>
<td style="text-align:right">0.0699319</td>
<td style="text-align:right">0.706717</td>
<td style="text-align:right">0.74684</td>
</tr>
<tr>
<td style="text-align:right">7</td>
<td style="text-align:right">0.707643</td>
<td style="text-align:right">0.821382</td>
<td style="text-align:right">0.29689</td>
</tr>
<tr>
<td style="text-align:right">8</td>
<td style="text-align:right">0.620412</td>
<td style="text-align:right">0.788375</td>
<td style="text-align:right">0.512174</td>
</tr>
<tr>
<td style="text-align:right">9</td>
<td style="text-align:right">0.0802374</td>
<td style="text-align:right">0.804594</td>
<td style="text-align:right">0.231062</td>
</tr>
</tbody>
</table>
</div><p>I want to <strong>predict the temperature at t+1 using the features at t-7, t-6, …, t</strong>.<br>
Now in addition to that, let’s assume <strong>I have an a priori on the pressure data</strong>: I know it is relevant only for the past 2 days before the prediction (I only need the pressure at time t, t-1, t-2). Therefore, I do not want to add values of pressure prior to this because it will act as noise for the model. Additionally, my dataset is rather small which is why I want my data to be as useful as possible.</p>
<p>Since an RNN expects a dimension <code>( batch_size x n_timestep x feature_size )</code>, how should I fill the values for the pressure during the time (t-7, …, t-3).<br>
Should I do a simple backfill where the pressure value at (t-7, …, t-3) is equal to the pressure value at t-2 ?<br>
Should I zero out the values at (t-7, …, t-3) ?</p>
<p>Thanks in advance!</p>