nfmcclure / tensorflow_cookbook

Code for Tensorflow Machine Learning Cookbook

Home Page:https://www.packtpub.com/big-data-and-business-intelligence/tensorflow-machine-learning-cookbook-second-edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

07_NaturalLanguageProcessing_04_SkipGram: Question on Line 272 on -sim

ychong opened this issue · comments

Apologies for the simple question:

For Line 272, why do we multiply sim matrix by negative?

Why -sim[j, :]?

commented

Hi Thanks for the question. I'm just starting on updating the book and code for a version 2. When I get to chapter 7, I'll add an explanation.

commented

I'll add this to the notebook and next version of the book, but here is an explanation now:

The argsort() method sorts from least to greatest. Since we have a similarity matrix, we want to sort from greatest similarity to least similarity. If we take the negative of all the numbers before sorting, that will sort the indices of the numbers in the correct order. I hope that helps!