Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative Sampling #150

Open
tuananhhedspibk opened this issue Feb 8, 2021 · 0 comments
Open

Negative Sampling #150

tuananhhedspibk opened this issue Feb 8, 2021 · 0 comments

Comments

@tuananhhedspibk
Copy link
Owner

tuananhhedspibk commented Feb 8, 2021

Pick a context word, make the first row of list is the positive row and from the second row, we pick "target word" randomly. For the "positive example" we label it "1" and "0" for the "negative example". And here we have a supervised learning problem. With the pair of words (context, target) we will predict the respond label (1 or 0) for that pair.

Screen Shot 2021-02-09 at 9 29 10

We have k "negative examples" to train the model. After the embedding vector, we have possible 10,000 logistic regression classification problems, one of these is a classifier "is the target word: juice or not ?" or "king or not ?"... But we can just train with 10,000 binary classifiers (1 positive example and k negative examples for each of them) rather than 10,000 softmax classifiers.

Screen Shot 2021-02-09 at 9 40 02

One thing you could do is sample according to empirical frequency of words in your corpus, but the problem is we will end-up with the representation of the words like: "the", "a", "of", ...

f(wi): heuristic value - frequency

Screen Shot 2021-02-09 at 9 45 33

Ref: https://www.coursera.org/learn/nlp-sequence-models/lecture/Iwx0e/negative-sampling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant