the-deep-learners / deep-learning-illustrated

Deep Learning Illustrated (2020)
https://www.deeplearningillustrated.com
MIT License
708 stars 355 forks source link

natural_language_preprocessing.ipynb uses older attributes with gensim library for training word2vec #8

Closed tmmsagheer closed 3 years ago

tmmsagheer commented 3 years ago
  1. In section Run Word2Vec of notebook natural_language_preprocessing.ipynb model = Word2Vec(sentences=clean_sents, size=64, sg=1, window=10, iter=5, min_count=10, workers=4) is given, instead it should be model = Word2Vec(sentences=clean_sents, vector_size=64, sg=1, window=10, epochs=5, min_count=10, workers=4)

  2. model.wv.vocab should be replaced with model.wv.vectors

  3. model.wv.vocab.keys should be replaced with model.wv.index_to_key I believe the author used Gensim 3.x and the latest Gensim is 4.x

jonkrohn commented 3 years ago

Hi @tmmsagheer — thank you for your contribution, but I'm afraid this not a bug. This is deliberate.

I cannot change the code or library version in a physical, printed book, so we had to freeze the library versions in time. As specified in the Dockerfile for this repository by gensim==3.4.0, we have fixed the Gensim library at 3.4.0 in the book and in this repo indefinitely.