benedekrozemberczki / pytorch_geometric_temporal

PyTorch Geometric Temporal: Spatiotemporal Signal Processing with Neural Machine Learning Models (CIKM 2021)
MIT License
2.66k stars 377 forks source link

Separate periods in periods_in and periods_out when defining the model TemporalGNN. #171

Closed michelegentili93 closed 1 year ago

michelegentili93 commented 2 years ago

Hi, I've tried to have a prediction window longer then input window and the notebook doesn't work, i.e. num_timesteps_in=12< num_timesteps_out=14. Because in TemporalGNN you use periods for both the window of x and the window of the prediction (y).

I suggest this:

` class TemporalGNN(torch.nn.Module): def init(self, node_features, periods_in,periods_pred, batch_size): super(TemporalGNN, self).init()

Attention Temporal Graph Convolutional Cell

    self.tgnn = A3TGCN2(in_channels=node_features,  out_channels=32, periods=periods_in,batch_size=batch_size) # node_features=2, periods=12
    # Equals single-shot prediction
    self.linear = torch.nn.Linear(32, periods_pred)

def forward(self, x, edge_index):
    """
    x = Node features for T time steps
    edge_index = Graph edge indices
    """
    h = self.tgnn(x, edge_index) # x [b, 207, 2, 12]  returns h [b, 207, 12]
    h = F.relu(h) 
    h = self.linear(h)
    return h

`

Tiantiansayhi commented 2 years ago

Hello, I also want to change the period of input and output but don' t know how to do this. I see you suggestion, you just change the class TemporalGNN, i think may be the class A3TGCN also need to be change to achieve this goal. By the way, did you slove this problem now?

michelegentili93 commented 2 years ago

Hi Melody, yes it is working for me :)

Il giorno ven 29 lug 2022 alle ore 07:39 Melody_tt @.***> ha scritto:

Hello, I also want to change the period of input and output but don' t know how to do this. I see you suggestion, you just change the class TemporalGNN, i think may be the class A3TGCN also need to be change to achieve this goal. By the way, did you slove this problem now?

— Reply to this email directly, view it on GitHub https://github.com/benedekrozemberczki/pytorch_geometric_temporal/issues/171#issuecomment-1199178465, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS5W6YAD2VSXKX6JKKHUFLVWO7FPANCNFSM5XEKVDDQ . You are receiving this because you authored the thread.Message ID: <benedekrozemberczki/pytorch_geometric_temporal/issues/171/1199178465@ github.com>