Bird
0
0

You wrote this code but get an error:

medium📝 Debug Q6 of 15
NLP - Word Embeddings
You wrote this code but get an error:
model = Word2Vec(sentences, size=100, window=5, min_count=1, workers=4)
model.train(sentences)
What is the main issue?
AThe parameter 'size' is deprecated; use 'vector_size' instead
BYou must call model.build_vocab() before training
CThe train method requires epochs parameter
DThe sentences variable is not tokenized
Step-by-Step Solution
Solution:
  1. Step 1: Check model initialization parameters

    The parameter size is deprecated in recent Gensim versions and causes an error or warning; use vector_size instead.
  2. Step 2: Validate other aspects

    Since sentences is passed at initialization, build_vocab() is called internally. train() does not require explicit epochs, and assume sentences are tokenized.
  3. Final Answer:

    The parameter 'size' is deprecated; use 'vector_size' instead -> Option A
  4. Quick Check:

    Deprecated size causes error = B [OK]
Quick Trick: Use 'vector_size' instead of deprecated 'size' [OK]
Common Mistakes:
MISTAKES
  • Ignoring build_vocab requirement
  • Assuming train auto builds vocab
  • Confusing size and vector_size parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NLP Quizzes