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

Patch neg sampling #1796

Merged
merged 2 commits into from
Jun 16, 2021
Merged
Changes from 1 commit
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
Next Next commit
change md file for get_negatives function
  • Loading branch information
armingh2000 committed Jun 14, 2021
commit 9c7687b33bc317ac3bd23380e53663c8ecf87f84
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ generator = RandomGenerator([2, 3, 4])
#@save
def get_negatives(all_contexts, corpus, K):
counter = d2l.count_corpus(corpus)
sampling_weights = [counter[i]**0.75 for i in range(len(counter))]
sampling_weights = [counter[key]**0.75 for key in counter.keys()]
all_negatives, generator = [], RandomGenerator(sampling_weights)
for contexts in all_contexts:
negatives = []
Expand Down