July 2019
Intermediate to advanced
512 pages
19h 39m
English
Let's now evaluate what our model has learned and how well our model has understood the semantics of the text. The genism library provides the most_similar function, which gives us the top similar words related to the given word.
As you can see in the following code, given san_diego as an input, we are getting all the other related city names that are most similar:
model.most_similar('san_diego')[(u'san_antonio', 0.8147615790367126), (u'indianapolis', 0.7657858729362488), (u'austin', 0.7620342969894409), (u'memphis', 0.7541092038154602), (u'phoenix', 0.7481759786605835), (u'seattle', 0.7471771240234375), (u'dallas', 0.7407466769218445), (u'san_francisco', 0.7373261451721191), (u'la', 0.7354192137718201), (u'boston', ...Read now
Unlock full access