Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated words embedding application
  • Loading branch information
lisitsyn committed Dec 8, 2011
1 parent 52f7c5a commit f77788a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions applications/dimreduction/words_embedding.py
Expand Up @@ -40,10 +40,17 @@ def word_kernel(words):
embedding_matrix = embedding.get_feature_matrix()
fig = figure()
ax = fig.add_subplot(1,1,1)
ax.scatter(embedding_matrix[0,:],embedding_matrix[1,:],alpha=0.0)
ax.scatter(embedding_matrix[0,:],embedding_matrix[1,:],alpha=0.4,cmap=cm.Spectral,c=embedding_matrix[0,:]*embedding_matrix[1,:])

# hardcode ;)
words_to_show = ['finishing','publishing','standing',\
'shifted','insisted','tilted','blasted',\
'jumble','battle','gobble']

for i in xrange(0,200):
if words[i] in words_to_show:
ax.text(embedding_matrix[0,i]*1.1,1.25*embedding_matrix[1,i],words[i],fontsize=16,alpha=1.0)

for i,word in enumerate(words[:100]):
text(embedding_matrix[0,i],embedding_matrix[1,i],word,fontsize=8)
axis('off')
show()

0 comments on commit f77788a

Please sign in to comment.