Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[about model arch] there's something different from the original paper? #3

Open
mokeeqian opened this issue Nov 13, 2023 · 0 comments

Comments

@mokeeqian
Copy link

Hi, author.

  1. 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()
      )
    )
  )
)
  1. In the model input, what do the O_dyn_G and D_dyn_G means? 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant