KalmanNet / KalmanNet_TSP

code for KalmanNet
287 stars 76 forks source link

Each iteration does not update the information of the previous moment #10

Closed minionschen closed 1 year ago

minionschen commented 2 years ago

for j in range(0, self.N_B): n_e = random.randint(0, self.N_E - 1) y_training = train_input[n_e, :, :] self.model.InitSequence(self.ssModel.m1x_0)

As mentioned above, each cycle will do a InitSequence, so has the information of the previous moment retained? The paper shows that at the i-th iteration, xt is put into the network. Following the above code, the initial unit vector should be put into the network.So could you please answer this question? I've been bothered by this for a long time.

XiaoyongNI commented 2 years ago

If I understand correctly, I think your question comes from what this outer "FOR" loop iterates through.

This outer "FOR" loop that you copied iterates through N_B numbers of sequences, each having length T.

At the beginning of each iteration, we init the model with x_0, using "self.model.InitSequence(self.ssModel.m1x_0)". This x0 is the init state for the chosen n_e th sequence.

Then there's a inner "FOR" loop that iterates from time 0 to time T of this chosen sequence. At each time slot t, our model calculates a Kalman Gain K_t based on the current input at time t, which is y_t instead of x_t, see Fig.2 in our TSP paper.

If this does not answer your question, please let me know.

Kind regards, Xiaoyong