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

Questions about the time of day embedding #10

Open
mb-Ma opened this issue Aug 17, 2023 · 3 comments
Open

Questions about the time of day embedding #10

mb-Ma opened this issue Aug 17, 2023 · 3 comments

Comments

@mb-Ma
Copy link

mb-Ma commented Aug 17, 2023

I noticed that only the last time step of each sample is kept by the following code:

if self.if_time_in_day:
t_i_d_data = history_data[..., 1]
# In the datasets used in STID, the time_of_day feature is normalized to [0, 1]. We multiply it by 288 to get the index.
# If you use other datasets, you may need to change this line.
time_in_day_emb = self.time_in_day_emb[(t_i_d_data[:, -1, :] * self.time_of_day_size).type(torch.LongTensor)]
else:
time_in_day_emb = None
if self.if_day_in_week:
d_i_w_data = history_data[..., 2]
day_in_week_emb = self.day_in_week_emb[(
d_i_w_data[:, -1, :]).type(torch.LongTensor)]
else:
day_in_week_emb = None

More specifically, the operation "t_i_d_data[:, -1, :]" is used to get the last time step from input data.

Could you please provide more interpretations?

@zezhishao
Copy link
Owner

Thanks for your interests.
For more details, you can refer to the discussion below the blog of STID in Zhihu:
image

@mb-Ma
Copy link
Author

mb-Ma commented Aug 18, 2023

Thank you for your fast response. I did not see these comments. :-)

Yeah. It seems an efficient solution. The purpose is just to identify different times when the current sample is, only one time step is okay which meets Ockham's Razor. From another perspective, (B, [all time step concat], N) compared to (B, [single time step embedding], N) is more redundant since all nodes are same time embedding in one sample.

@zezhishao
Copy link
Owner

Thank you very much for your acknowledgment! Any further discussions are welcome~

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

2 participants