LibCity / Bigscity-LibCity

LibCity: An Open Library for Urban Spatial-temporal Data Mining
https://libcity.ai/
Apache License 2.0
937 stars 168 forks source link

One possible bug in the implementation of GTS #302

Closed SonghuaHu-UMD closed 2 years ago

SonghuaHu-UMD commented 2 years ago

I am reading the paper "DISCRETE GRAPH STRUCTURE LEARNING FOR FORECASTING MULTIPLE TIME SERIES". I compared it with the implemented model named "GTS" in LibCity and met one possible bug.

In LibCity.GTS, the adaptively learnable adjacent matrix seems to not be fed into the encoder and decoder, which means the learned adjacent matrix cannot affect the graph convolution in the following dcgru_layer():

https://github.com/LibCity/Bigscity-LibCity/blob/5852dcfd022fb4307be2da586029be9905a9b2ee/libcity/model/traffic_speed_prediction/GTS.py#L505

I traced back to the source code provided by the original author and found they have passed the adj into their encoder and decoder. The adj is not the same as the original adjacent matrix. It is a learned graph structure based on Gumbel-Softmax resampling.

        encoder_hidden_state = self.encoder(inputs, adj)
        self._logger.debug("Encoder complete, starting decoder")
        outputs = self.decoder(encoder_hidden_state, adj, labels, batches_seen=batches_seen)
        self._logger.debug("Decoder complete")

Looking forward to your response.

Thank you!

aptx1231 commented 2 years ago

We did have a problem with the implementation, I modified it, thanks for the feedback!