d-ailin / GDN

Implementation code for the paper "Graph Neural Network-Based Anomaly Detection in Multivariate Time Series" (AAAI 2021)
MIT License
467 stars 140 forks source link

questions about GDN.py #16

Closed JMSAnita closed 2 years ago

JMSAnita commented 2 years ago

Hello, I am very interested in your research. When I was trying to understand the code, I had some questions, which are summarized as follows:

  1. You mentioned in section 3.4 of the paper(Graph Structure Learning) that you designed a flexible framework that can construct an adjacency matrix without knowing the relationship between nodes and the known node relationship. I noticed that you are publishing the code Set the initial network structure in "fc_struc = get_fc_graph_struc(dataset)”, do you also assume that the initial graph structure is fully connected on the swat data set and the wadi data set?
  2. At the beginning of training, your node embedding vector is randomly initialized, and the adjacency matrix is ​​calculated based on the distance between the embedding vectors. I have not seen how you use the initial network structure. If I want to use,How should I modify the code to take advantage of the prior information about the relationship between nodes?
  3. I set the hyperparameters according to the parameters suggested in your paper. However, whether it is the swap data set or the wadi data set, it will jump out after training for about 20 epochs. Do you know the reason? I'm trying to understand your code, can you help me solve these questions? Thank you very much
d-ailin commented 2 years ago

Hi, thanks for your interest in our work.

  1. Yes, we assume the initial graph structure is fully connected and later could be learned in the training phase.
  2. If you want to fusion your prior information, one way is to replace the "fc_struc" with your predefined relationship. Then you could select the top-K most relative relationship(edges) which is in your predefined edges.

For specific, you should first define your new graph structure with a similar format as the "fc_struc". Then you could modify the code around here https://github.com/d-ailin/GDN/blob/9853899da860682669a134e4af315d036aab4eca/models/GDN.py#L157

For example, you could filter the edges which do not exist in your prior structure by setting these items in cos_ji_mat as 0. In this way, the final adjacency matrix(topk_indices_ji) is only taking the top-K relationship under your predefined prior graph.

  1. For we have used the early stop and the whole model architecture is relatively simple, the training might stop to avoid overfitting. So if the trained model has already got a good accuracy or performance, I think that should be fine.
JMSAnita commented 2 years ago

ok, i understand what you mean, thank you for your patience

Hi, thanks for your interest in our work.

  1. Yes, we assume the initial graph structure is fully connected and later could be learned in the training phase.
  2. If you want to fusion your prior information, one way is to replace the "fc_struc" with your predefined relationship. Then you could select the top-K most relative relationship(edges) which is in your predefined edges.

For specific, you should first define your new graph structure with a similar format as the "fc_struc". Then you could modify the code around here

https://github.com/d-ailin/GDN/blob/9853899da860682669a134e4af315d036aab4eca/models/GDN.py#L157

For example, you could filter the edges which do not exist in your prior structure by setting these items in cos_ji_mat as 0. In this way, the final adjacency matrix(topk_indices_ji) is only taking the top-K relationship under your predefined prior graph.

  1. For we have used the early stop and the whole model architecture is relatively simple, the training might stop to avoid overfitting. So if the trained model has already got a good accuracy or performance, I think that should be fine.

ok, i understand what you mean, thank you for your patience