cchallu / n-hits

170 stars 27 forks source link

Clarification regarding data pre-processing #4

Closed vageeshmaiya closed 2 years ago

vageeshmaiya commented 2 years ago

Hello,

I was trying to run N-HiTS. Can you please let me know the motivation behind this data preprocessing step: https://github.com/cchallu/n-hits/blob/main/src/data/datasets/ett.py#L45

Could you also provide some insight on the usage of the above mentioned code in the program.

Thank you

kdgutier commented 2 years ago

Hi @vageeshmaiya,

If you want to try the method in your own data, I suggest to use the NeuralForecast library where we maintain it. Here is an N-HiTS example Open In Colab .

Regarding your question, our code operates with Y_df with 'unique_id' and 'ds' columns DataFrame in long format.

Here is the pandas' stack documentation.

vageeshmaiya commented 2 years ago

Thank you @kdgutier for your reply.

I have one more question.

d3.csv My custom dataset attached above has Voltage, Current, Charge Capacity as parameters. When I select series_idx = 0 I get the folowing plots: plot_for_d3_data.pdf

This is the code used to get the plot:

`fig, axs = plt.subplots(nrows=3, ncols=1, figsize=(10, 11)) fig.tight_layout()

series = ['Voltage','Current','Charge Capacity'] series_idx = 0

for idx, w_idx in enumerate([200, 300, 400]): axs[idx].plot(y_true[w_idx,series_idx,:],label='True') axs[idx].plot(y_hat[w_idx,series_idx,:],label='Forecast') axs[idx].grid() axs[idx].set_ylabel(series[series_idx]+f' window {w_idx}', fontsize=17) if idx==2: axs[idx].set_xlabel('Forecast Horizon', fontsize=17) plt.legend()

plt.savefig('plot_for_d3_data.pdf',bbox_inches='tight')

plt.show() plt.close()`

My understanding is that for series_idx = 0 the plots obtained should be for the parameter voltage. But in this case it is not so.

d3_v.csv I have also run the code with just Voltage as the parameter (dataset attached above), and have got this plot: plot_for_d3_v_data.pdf

Could you please provide some insight on the plotting mechanism. Thank you.