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

How to get attention weights #7

Open
gugudexiatian opened this issue Oct 1, 2019 · 3 comments
Open

How to get attention weights #7

gugudexiatian opened this issue Oct 1, 2019 · 3 comments

Comments

@gugudexiatian
Copy link

Thank you very much for your answer. I now know how to run your code. But I have an another question: how do I get input attention weights as the authors did in the original paper ( A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction), I tried but failed. Looking forward to your help.

@Angelogeb
Copy link
Collaborator

Hi,

In order to obtain the input weights (or the temporal attention weights) you would have to save the node of the attention alpha (analogously beta for temporal attention) as an attribute of the model, i.e. refactor that line of code to self.alpha and then when doing session.run pass such node to be evaluated in addition to the rest.

Hope this is helpful!

Let us know if you have any additional question.

@Angelogeb Angelogeb changed the title Additional request How to get attention weights Oct 15, 2019
@gugudexiatian
Copy link
Author

The last question, l have got it. Thanks! But l have another question. If I want to set the stride or horizon which is called in time series papers to 2,3,...7 rather than 1. I only changed the code in model.py by
for t in range(self.config.T):
if t<self.config.T:
if t<self.config.T-2 or -3 or -7 :
but the result is lagged. Maybe there is some wrong else or DA-rnn is not suitainable for prediction like this. I am really confusing. Because using the curent values to predict the target curent value is not significant in many cases.

@gugudexiatian
Copy link
Author

Thanks for your amazing code and your share, but how to cite it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants