Skip to content

Instantly share code, notes, and snippets.

View yxtay's full-sized avatar

YuXuan Tay yxtay

View GitHub Profile
@yxtay
yxtay / tensorflow_word2vec_cbow_basic.py
Last active December 21, 2023 03:25
Basic implementation of CBOW word2vec with TensorFlow. Minimal modification to the skipgram word2vec implementation in the TensorFlow tutorials.
# References
# - https://www.tensorflow.org/versions/r0.10/tutorials/word2vec/index.html
# - https://github.com/tensorflow/tensorflow/blob/r0.10/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math