# TGN: A Temporal Graph Network for Physics Prediction
## 4 Experiments
### Model Analysis
Since our sequence models are all based on linear transformation or attention mechanisms for prediction, the weights of the linear layer and attention can directly reveal how the sequence models work. We min-max normalize the weights of the historical time series and plot them in Figure 8 (right). As can be seen from the weight distributions of the three models, the Linear model focuses only on the last history time step, meaning that it basically relies only on the information in the most recent time step to make predictions, and is therefore sensitive to noise. The Transformer model assigns a greater weight to history time steps that are closer to the output, and is able to utilize the information in a larger number of time steps compared to the Linear model for prediction, which helps to capture periodicity and trends in the series and improves the model's resistance to noise. TGN, in addition to focusing on the most recent time steps, also assigns a larger weight to some of the more distant time steps. We hypothesize that TGN can identify periodic phenomena in the flow process and directly query the information of the previous cycle in the prediction stage to make stable and accurate predictions. For airfoil flow, we add Gaussian noise to both velocity and density. Even though its historical time series are short, the long-term prediction error of our model is still lower than that of the comparison model. This demonstrates the strong ability of our model to encode temporal information. A complete analysis of this can be found in Appendix A.4. Figure 7: Comparison of relative positions of nodes in the cylinder flow (\(Re=300,t=500\)). The state field does not preserve the relative positions of nodes in the two-dimensional latent subspace, whereas GSE is capable of learning the relative positions between nodes. The encoded nodes in the two-dimensional latent subspace of GSE closely resemble the actual scenario. **Longer rollouts. ** We designed an experiment to test whether our model maintains superior performance beyond the training range. We trained the model on cylinder flow trajectories of 500 time steps and evaluated its performance on trajectories of 900 steps. Figure 9 illustrates the difference in the long-term prediction ability of all models. For cylinder flow, TGN and Transformer are able to preserve velocity magnitude and phase information. On the other hand, Linear and MeshGraphNets show drift, and MeshGraphNets especially have significantly different velocity magnitudes from the real situation. Table 2 quantitatively compares the performance of the models when rolling out longer time steps. We find that TGN remains stable and outperforms all comparison models for rollouts outside the training range. Figure 8: **(left)** The averaged error of all state variables with different noise distributions for entire trajectory forecasting on the cylinder flow. **(right)** The weight distribution of the sequential model on the cylinder flow. Figure 9: Comparison of the velocity field predicted by four models with the ground truth (CFD) for the cylinder flow with Reynolds number = 330 and steps = 900. **Key hyperparameters. ** We tested the model under different hyperparameters and found that our method is not very sensitive to most of the hyperparameters, such as the dimensionality of the feature vectors, the number of layers of the MLPs, and the number and type of aggregators. However, we still found a key hyperparameter that affects the performance of the model (Figure 10). The number of history time steps usually greatly affects the prediction accuracy as it determines how much we can learn from the historical data. In general, models with strong temporal information extraction capabilities should be able to obtain better results with more history time steps. We found that the model performs best given as many history time steps as possible. This is in contrast to MeshGraphNets, which leads to overfitting given additional history time steps.