thuml / Koopa

Code release for "Koopa: Learning Non-stationary Time Series Dynamics with Koopman Predictors" (NeurIPS 2023), https://arxiv.org/abs/2305.18803
MIT License
179 stars 23 forks source link

About Code #22

Open igodrr opened 4 weeks ago

igodrr commented 4 weeks ago

Hello, I think there is a piece of code that does not match the description in the article: # Koopman Forecasting residual, forecast = x_enc, None for i in range(self.num_blocks): time_var_input, time_inv_input = self.disentanglement(residual) time_inv_output = self.time_inv_kps[i](time_inv_input) time_var_backcast, time_var_output = self.time_var_kps[i](time_var_input) residual = residual - time_var_backcast if forecast is None: forecast = (time_inv_output + time_var_output) else: forecast += (time_inv_output + time_var_output) Here, residual is not the residual of time_var_input, but rather time_var_input with the time-invariant part added. So, I think you should write residual = time_var_input before performing the subtraction. The article describes it this way: image I’m not sure if my understanding is correct, and I look forward to your response.

igodrr commented 4 weeks ago

Additionally, I have another point of confusion: Why is the same frequency mask used on the residual as the original data to separate time-variant and time-invariant information? The Fourier transform with the defined mask should have already stripped away the time-invariant information selected by the mask in the first layer. So, what is the intention behind applying it again to the residual? I look forward to your explanation.