MPGCN
MPGCN copied to clipboard
[about model arch] there's something different from the original paper?
Hi, author.
- In the original paper, there's three grpahs: adj, poi, corre. while your replica has only two grpahs.
Your replica:
MPGCN(
(branch_models): ModuleList(
(0): ModuleDict(
(temporal): LSTM(1, 32, batch_first=True)
(spatial): ModuleList(
(0): BDGCN(
(activation): ReLU()
)
(1): BDGCN(
(activation): ReLU()
)
(2): BDGCN(
(activation): ReLU()
)
)
(fc): Sequential(
(0): Linear(in_features=32, out_features=1, bias=True)
(1): ReLU()
)
)
(1): ModuleDict(
(temporal): LSTM(1, 32, batch_first=True)
(spatial): ModuleList(
(0): BDGCN(
(activation): ReLU()
)
(1): BDGCN(
(activation): ReLU()
)
(2): BDGCN(
(activation): ReLU()
)
)
(fc): Sequential(
(0): Linear(in_features=32, out_features=1, bias=True)
(1): ReLU()
)
)
)
)
- In the model input, what do the
O_dyn_GandD_dyn_Gmeans? it seems that you treat the origin and destination individually?
def construct_dyn_G(self, OD_data: np.array,
perceived_period: int = 7): # construct dynamic graphs based on OD history
train_len = int(OD_data.shape[0] * self.params['split_ratio'][0] / sum(self.params['split_ratio']))
num_periods_in_history = train_len // perceived_period # dump the remainder
OD_history = OD_data[:num_periods_in_history * perceived_period, :, :, :]
O_dyn_G, D_dyn_G = [], []
for t in range(perceived_period):
OD_t_avg = np.mean(OD_history[t::perceived_period, :, :, :], axis=0).squeeze(axis=-1)
O, D = OD_t_avg.shape
O_G_t = np.zeros((O, O)) # initialize O graph at t
for i in range(O):
for j in range(O):
O_G_t[i, j] = distance.cosine(OD_t_avg[i, :], OD_t_avg[j, :]) # eq (6)
D_G_t = np.zeros((D, D)) # initialize D graph at t
for i in range(D):
for j in range(D):
D_G_t[i, j] = distance.cosine(OD_t_avg[:, i], OD_t_avg[j, :]) # eq (7)
O_dyn_G.append(O_G_t), D_dyn_G.append(D_G_t)
return np.stack(O_dyn_G, axis=-1), np.stack(D_dyn_G, axis=-1)