Intermediate level · Module 3 of 8 · 12 guided hours
Word Embeddings and Word2Vec
Dense word representations: the distributional idea, training Word2Vec with Gensim, exploring similarities and analogies, using pretrained vectors, and the biases embeddings learn.
Learning objectives
- Explain the distributional idea behind word embeddings
- Train and explore Word2Vec embeddings with Gensim
- Use embeddings as features and recognise their biases
Topics
- one-hot vs dense vectors
- the distributional hypothesis
- Word2Vec skip-gram and CBOW
- training with Gensim
- pretrained vectors and GloVe
- bias in embeddings
Lessons
-
Lesson 1 From Counts to Dense Word Vectors
Learners see why counts treat every word as unrelated and how dense vectors place words with similar contexts close together.
one-hot vectordense vectordistributional hypothesiscontext windowembedding dimension
-
Lesson 2 Training Word2Vec with Gensim
Learners train Word2Vec on the project corpus with Gensim, explore nearest neighbours and see how corpus size and parameters change the results.
Word2Vec(sentences, vector_size, window, min_count, sg)model.wv.most_similarcorpus sizerandom seedintrinsic evaluation
-
Lesson 3 Using Embeddings and Their Biases
Learners average word vectors to represent documents, compare them with TF-IDF in a classifier, and examine the social biases embeddings learn from text.
document averagingpretrained vectorsout-of-vocabulary wordsembedding biasassociation tests
Practical activity
Train Word2Vec on the project corpus, compare embedding and TF-IDF features for classification, and document out-of-vocabulary rates and a bias check.
Expected outcomes
- Practical understanding of word embeddings
- Awareness of data needs and embedding bias
Assessment
Notebook review (70%) and a short written explanation of the distributional hypothesis (30%).
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.