Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion keras_word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def collect_data(vocabulary_size=10000):
context = Reshape((vector_dim, 1))(context)

# setup a cosine similarity operation which will be output in a secondary model
similarity = merge([target, context], mode='cos', dot_axes=0)
# similarity = merge([target, context], mode='cos', dot_axes=0)
# keras.layer.merge removed after 02/2017, use keras.layer.dot instead.
similarity = dot([target, context], axes=0,normalize=True)

# now perform the dot product operation to get a similarity measure
dot_product = merge([target, context], mode='dot', dot_axes=1)
Expand Down