-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Need some help in writing the code to obtain and visualize the attention weights like that in the HAN paper (heat map). To obtain the attention weights, I'm currently thinking of obtaining the hidden representations of the GRUs (h_it) and then manually using h_it to compute the attention weights using the equations from the call function of the attention layer.
layer_name = 'GRU'
intermediate_layer_model = Model(input=model.input, output=model.get_layer(layer_name).output)
intermediate_output = intermediate_layer_model.predict(input_variable)
h_it = intermediate_output
#use h_it from above to compute attention weights
If there is a more direct way (direct function call in Keras or some existing code available), it will be helpful.
Metadata
Metadata
Assignees
Labels
No labels