Skip to content

LSTM - Doing my own version of words2vec - how do I get *hidden* outputs? #208

Open
@josiahbryan

Description

@josiahbryan

Pretty picture:
image

Based on this article [1], the words2vec algo basically trains an LSTM to predict a word given the context, then (here's the key part for me), to get the vector for a given word, they feed to word to the trained LSTM model and take the output "at the hidden layer [as] the ‘word embedding’ of the input word."

My question therefore is, how can I get the "output at the hidden layer" of my lovely trained LSTM?

And WHY would I even want to do this? Well, my application has nothing to do with words, but still has to do with comparing contexts. I have a sequence of actions - for example, potty training a pet: "Wine" -> "Go Outside" -> "Go Potty" -> "Come Inside" -> "Get Rewarded". My hope is to be able to train the LSTM to predict the next action - great, lovely. But what I really want is to get the "vector embedding" of the input action - a vector representing the action, like words2vec has vectors representing words. Hence my desire to get the output at the hidden layer of the LSTM.

Dooable - yay/nay?

[1] Reference article: https://towardsdatascience.com/word2vec-a-baby-step-in-deep-learning-but-a-giant-leap-towards-natural-language-processing-40fe4e8602ba

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions