Comments (5)
@heisenbugfix I agree to what you mentioned in the previous comment. However, final attention is applied on hidden states and NOT projected vector.
As per my understanding, here are the steps apply attention:
- Collect 'hidden_states'
- Apply projection to get projected vector.
- Use projected vector and attention vector to find attention weights.
- Use attention weights and hidden_states to apply attention.
I find a mismatch in 4th step in your code. Please correct me if I am wrong.
from hierarchical-attention-networks.
@krayush07 you are right. Have you tested the implementation by changing the attention to the hidden vectors?
from hierarchical-attention-networks.
@krayush07 - In the paper this is how the projection is done:
Lets say your hidden state output is h_it. Then you first calculate u_it as:
u_it = tanh(W*h_it + b_w)
Then attention weights are calculated using u_it. So u_it here is the projected vector
from hierarchical-attention-networks.
@krayush07 Ah I get it. Thanks for clarifying.
P.S It is not my code :D although its an awesome code.
from hierarchical-attention-networks.
@krayush07 I think it's more of a personal choice where to apply attention weights. In the paper, the authors project the hidden state to the same dimension and then compute attention and apply it to the hidden state. However, in this implementation he projects the hidden state to a lower dimension to compute attention.
So I'm guessing he applies attention to the projected vector instead because he wants a lower dimension for the encoded sentence vector.
from hierarchical-attention-networks.
Related Issues (20)
- some error in yelp_prepare.py HOT 4
- ValueError in running worker.py HOT 12
- How to make `TensorBoard Projector` work.
- Why use orthogonal_initializer ?
- Error While Running yelp_prepare.py HOT 3
- Is the embedding initialized with a pre-trained one? HOT 2
- GRU VS LSTM HOT 1
- Are uw and us global weights? just to conform. HOT 1
- Mask for attention weight
- Getting same sentence level outputs for very different documents. Can someone please help.
- Embeddings for special tokens/padding?
- dev accuracy: nan???
- en-core-web-sm needs to be installed beforehand
- Same cell for word and sentence level HOT 3
- Performance on the paper's dataset HOT 6
- Won't the code leads to different input shape for different batch?
- Visualize word and sentence attention weight as color coded in the paper HOT 1
- Performance on Yelp 15
- Implementation using tf.contrib.seq2seq. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hierarchical-attention-networks.