KalmanNet / KalmanNet_TSP

code for KalmanNet
270 stars 73 forks source link

Question on Updating self.h_Sigma in KalmanNet Code #40

Open ZhE1ShEn opened 3 months ago

ZhE1ShEn commented 3 months ago

Dear author,

I hope this message finds you well. I am writing to inquire about a specific implementation detail in the KGain_step method of the KalmanNet code, particularly concerning the update of self.h_Sigma.

In the KGain_step method, the hidden state self.h_Sigma is updated using the GRU layer self.GRU_Sigma. Here is the relevant code snippet: out_Sigma, self.h_Sigma = self.GRU_Sigma(in_Sigma, self.h_Sigma) This line correctly updates self.h_Sigma through the GRU layer. However, later in the code, self.h_Sigma is updated again with the output from a fully connected (FC) layer: # Updating hidden state of the Sigma-GRU self.h_Sigma = out_FC4 My understanding is that the hidden state should only be updated by the GRU layer to maintain the integrity of the sequence information. Updating it again using the output from the FC layer could potentially lead to inconsistencies or unintended behavior.

I would like to understand if there is a specific reason or purpose behind this additional update of self.h_Sigma with out_FC4. Is there a particular design consideration or benefit that this implementation aims to achieve?

Understanding the rationale behind this design choice would be highly beneficial for me. I appreciate your guidance on this matter and look forward to your insights.

Best regards.

Sjtu-hyg commented 1 week ago

Dear author, I would like to ask a question regarding the update of the error covariance matrix. In KalmanNet-nn.py, does out_FC4 represent the updated error covariance matrix?