4.0.1
4.0.1, 2021-04-01
Bugfix release to address issues with wheels on Windows due to Numpy binary incompatibility:
4.0.0, 2021-03-24
Gensim 4.0 is a major release with lots of performance & robustness improvements, and a new website.
Main highlights
-
Massively optimized popular algorithms the community has grown to love: fastText, word2vec, doc2vec, phrases:
a. Efficiency
model 3.8.3: wall time / peak RAM / throughput 4.0.0: wall time / peak RAM / throughput fastText 2.9h / 4.11 GB / 822k words/s 2.3h / 1.26 GB / 914k words/s word2vec 1.7h / 0.36 GB / 1685k words/s 1.2h / 0.33 GB / 1762k words/s In other words, fastText now needs 3x less RAM (and is faster); word2vec has 2x faster init (and needs less RAM, and is faster); detecting collocation phrases is 2x faster. (4.0 benchmarks)
b. Robustness. We fixed a bunch of long-standing bugs by refactoring the internal code structure (see 🔴 Bug fixes below)
c. Simplified OOP model for easier model exports and integration with TensorFlow, PyTorch &co.
These improvements come to you transparently aka "for free", but see Migration guide for some changes that break the old Gensim 3.x API. Update your code accordingly.
-
Dropped a bunch of externally contributed modules and wrappers: summarization, pivoted TFIDF, Mallet…
-
Code quality was not up to our standards. Also there was no one to maintain these modules, answer user questions, support them.
So rather than let them rot, we took the hard decision of removing these contributed modules from Gensim. If anyone's interested in maintaining them, please fork & publish into your own repo. They can live happily outside of Gensim.
-
-
Dropped Python 2. Gensim 4.0 is Py3.6+. Read our Python version support policy.
- If you still need Python 2 for some reason, stay at Gensim 3.8.3.
-
A new Gensim website – finally! 🙃
So, a major clean-up release overall. We're happy with this tighter, leaner and faster Gensim.
This is the direction we'll keep going forward: less kitchen-sink of "latest academic algorithms", more focus on robust engineering, targetting concrete NLP & document similarity use-cases.
👍 New features
- #2947: Bump minimum Python version to 3.6, by @gojomo
- #2300: Use less RAM in LdaMulticore, by @horpto
- #2698: Streamline KeyedVectors & X2Vec API, by @gojomo
- #2864: Speed up random number generation in word2vec, by @zygm0nt
- #2976: Speed up phrase (collocation) detection, by @piskvorky
- #2979: Allow skipping common English words in multi-word phrases, by @piskvorky
- #2867: Expose
max_final_vocab
parameter in fastText constructor, by @mpenkov - #2931: Clear up job queue parameters in word2vec, by @lunastera
- #2939: X2Vec SaveLoad improvements, by @piskvorky
- #3060: Record lifecycle events in Gensim models, by @piskvorky
- #3073: Make WMD normalization optional, by @piskvorky
- #3065: Default to pickle protocol 4 when saving models, by @piskvorky
- #3069: Add Github sponsor + donation nags, by @piskvorky
📚 Tutorials and docs
- #3082: Make LDA tutorial read NIPS data on the fly, by @jonaschn
- #2954: New theme for the Gensin website, by @dvorakvaclav
- #2960: Added Gensim and Compatibility Wiki page, by @piskvorky
- #2960: Reworked & simplified the Developer Wiki page, by @piskvorky
- #2968: Migrate tutorials & how-tos to 4.0.0, by @piskvorky
- #2899: Clean up of language and formatting of docstrings, by @piskvorky
- #2899: Added documentation for NMSLIB indexer, by @piskvorky
- #2832: Clear up LdaModel documentation, by @FyzHsn
- #2871: Clarify that license is LGPL-2.1, by @pombredanne
- #2896: Make docs clearer on
alpha
parameter in LDA model, by @xh2 - #2897: Update Hoffman paper link for Online LDA, by @xh2
- #2910: Refresh docs for run_annoy tutorial, by @piskvorky
- #2935: Fix "generator" language in word2vec docs, by @polm
- #3077: Fix various documentation warnings, by @mpenkov
- #2991: Fix broken link in run_doc How-To, by @sezanzeb
- #3003: Point WordEmbeddingSimilarityIndex documentation to gensim.similarities, by @Witiko
- #2996: Make the website link to the old Gensim 3.8.3 documentation dynamic, by @Witiko
- #3063: Update link to papers in LSI model, by @jonaschn
- #3080: Fix some of the warnings/deprecated functions, by @FredHappyface)
🔴 Bug fixes
- #2891: Fix fastText word-vectors with ngrams off, by @gojomo
- #2907: Fix doc2vec crash for large sets of doc-vectors, by @gojomo
- #2899: Fix similarity bug in NMSLIB indexer, by @piskvorky
- #2899: Fix deprecation warnings in Annoy integration, by @piskvorky
- #2901: Fix inheritance of WikiCorpus from TextCorpus, by @jenishah
- #2940: Fix deprecations in SoftCosineSimilarity, by @Witiko
- #2944: Fix
save_facebook_model
failure after update-vocab & other initialization streamlining, by @gojomo - #2846: Fix for Python 3.9/3.10: remove
xml.etree.cElementTree
, by @hugovk - #2973: phrases.export_phrases() doesn't yield all bigrams, by @piskvorky
- #2942: Segfault when training doc2vec, by @gojomo
- #3041: Fix RuntimeError in export_phrases (change defaultdict to dict), by @thalishsajeed
- #3059: Fix race condition in FastText tests, by @sleepy-owl
⚠️ Removed functionality & deprecations
- Removed all code, methods, attributes and functions marked as deprecated in Gensim 3.8.3.
- #6: No more binary wheels for x32 platforms, by @menshikh-iv
- #2899: Renamed overly broad
similarities.index
to the more appropriatesimilarities.annoy
, by @piskvorky - #2958: Remove gensim.summarization subpackage, docs and test data, by @mpenkov
- #2926: Rename
num_words
totopn
in dtm_coherence, by @MeganStodel - #2937: Remove Keras dependency, by @piskvorky
- #3078: Remove
on_batch_begin
andon_batch_end
callbacks, by @mpenkov - #3012: Remove
pattern
dependency, by @mpenkov - #3055: Remove
gensim.viz
subpackage, by @mpenkov
🔮 Testing, CI, housekeeping
- #2939 + #2984: Code style & py3 migration clean up, by @piskvorky
- #3058: Add py39 wheels to Travis/Azure, by @FredHappyface
- #3035: Update repos before trying to install gdb, by @janaknat
- #3026: Move x86 tests from Travis to GHA, add aarch64 wheel build to Travis, by @janaknat
- #3033: Transformed camelCase to snake_case test names, by @sezanzeb
- #3024: Add Github Actions x86 and mac jobs to build python wheels, by @janaknat
4.0.0.rc1, 2021-03-19
Gensim 4.0 is a major release with lots of performance & robustness improvements and a new website.
Main highlights (see also 👍 Improvements below)
-
Massively optimized popular algorithms the community has grown to love: fastText, word2vec, doc2vec, phrases:
a. Efficiency
model 3.8.3: wall time / peak RAM / throughput 4.0.0: wall time / peak RAM / throughput fastText 2.9h / 4.11 GB / 822k words/s 2.3h / 1.26 GB / 914k words/s word2vec 1.7h / 0.36 GB / 1685k words/s 1.2h / 0.33 GB / 1762k words/s In other words, fastText now needs 3x less RAM (and is faster); word2vec has 2x faster init (and needs less RAM, and is faster); detecting collocation phrases is 2x faster. (4.0 benchmarks)
b. Robustness. We fixed a bunch of long-standing bugs by refactoring the internal code structure (see 🔴 Bug fixes below)
c. Simplified OOP model for easier model exports and integration with TensorFlow, PyTorch &co.
These improvements come to you transparently aka "for free", but see Migration guide for some changes that break the old Gensim 3.x API. Update your code accordingly.
-
Dropped a bunch of externally contributed modules: summarization, pivoted TFIDF normalization, FIXME.
-
Code quality was not up to our standards. Also there was no one to maintain them, answer user questions, support these modules.
So rather than let them rot, we took the hard decision of removing these contributed modules from Gensim. If anyone's interested in maintaining them please fork into your own repo, they can live happily outside of Gensim.
-
-
Dropped Python 2. Gensim 4.0 is Py3.6+. Read our Python version support policy.
- If you still need Python 2 for some reason, stay at Gensim 3.8.3.
-
A new Gensim website – finally! 🙃
So, a major clean-up release overall. We're happy with this tighter, leaner and faster Gensim.
This is the direction we'll keep going forward: less kitchen-sink of "latest academic algorithms", more focus on robust engineering, targetting common concrete NLP & document similarity use-cases.
🌟 New Features
- Default to pickle protocol 4 when saving models (piskvorky, #3065)
- Record lifecycle events in Gensim models (piskvorky, #3060)
- Make WMD normalization optional (piskvorky, #3073)
🔴 Bug fixes
- fix RuntimeError in export_phrases (change defaultdict to dict) (thalishsajeed, #3041)
📚 Tutorial and doc improvements
- fix various documentation warnings (mpenkov, #3077)
- Fix broken link in run_doc how-to (sezanzeb, #2991)
- Point WordEmbeddingSimilarityIndex documentation to gensim.similarities (Witiko, #3003)
- Make the link to the Gensim 3.8.3 documentation dynamic (Witiko, #2996)
⚠️ Removed functionality
- remove on_batch_begin and on_batch_end callbacks (mpenkov, #3078)
- remove pattern dependency (mpenkov, #3012)
- rm gensim.viz submodule (mpenkov, #3055)
🔮 Miscellaneous
- [MRG] Add Github sponsor + donation nags (piskvorky, #3069)
- Update URLs (jonaschn, #3063)
- Fix race condition in FastText tests (sleepy-owl, #3059)
- Add py39 wheels to travis/azure (FredHappyface, #3058)
- Update repos before trying to install gdb (janaknat, #3035)
- transformed camelCase to snake_case test names (sezanzeb, #3033)
- move x86 tests from Travis to GHA, add aarch64 wheel build to Travis (janaknat, #3026)
- Add Github Actions x86 and mac jobs to build python wheels (janaknat, #3024)
4.0.0beta, 2020-10-31
Gensim 4.0 is a major release with lots of performance & robustness improvements and a new website.
Main highlights (see also 👍 Improvements below)
-
Massively optimized popular algorithms the community has grown to love: fastText, word2vec, doc2vec, phrases:
a. Efficiency
model 3.8.3: wall time / peak RAM / throughput 4.0.0: wall time / peak RAM / throughput fastText 2.9h / 4.11 GB / 822k words/s 2.3h / 1.26 GB / 914k words/s word2vec 1.7h / 0.36 GB / 1685k words/s 1.2h / 0.33 GB / 1762k words/s In other words, fastText now needs 3x less RAM (and is faster); word2vec has 2x faster init (and needs less RAM, and is faster); detecting collocation phrases is 2x faster. (4.0 benchmarks)
b. Robustness. We fixed a bunch of long-standing bugs by refactoring the internal code structure (see 🔴 Bug fixes below)
c. Simplified OOP model for easier model exports and integration with TensorFlow, PyTorch &co.
These improvements come to you transparently aka "for free", but see Migration guide for some changes that break the old Gensim 3.x API. Update your code accordingly.
-
Dropped a bunch of externally contributed modules: summarization, pivoted TFIDF normalization, FIXME.
-
Code quality was not up to our standards. Also there was no one to maintain them, answer user questions, support these modules.
So rather than let them rot, we took the hard decision of removing these contributed modules from Gensim. If anyone's interested in maintaining them please fork into your own repo, they can live happily outside of Gensim.
-
-
Dropped Python 2. Gensim 4.0 is Py3.6+. Read our Python version support policy.
- If you still need Python 2 for some reason, stay at Gensim 3.8.3.
-
A new Gensim website – finally! 🙃
So, a major clean-up release overall. We're happy with this tighter, leaner and faster Gensim.
This is the direction we'll keep going forward: less kitchen-sink of "latest academic algorithms", more focus on robust engineering, targetting common concrete NLP & document similarity use-cases.
Why pre-release?
This 4.0.0beta pre-release is for users who want the cutting edge performance and bug fixes. Plus users who want to help out, by testing and providing feedback: code, documentation, workflows… Please let us know on the mailing list!
Install the pre-release with:
pip install --pre --upgrade gensim
What will change between this pre-release and a "full" 4.0 release?
Production stability is important to Gensim, so we're improving the process of upgrading already-trained saved models. There'll be an explicit model upgrade script between each 4.n
to 4.(n+1)
Gensim release. Check progress here.
👍 Improvements
- #2947: Bump minimum Python version to 3.6, by @gojomo
- #2939 + #2984: Code style & py3 migration clean up, by @piskvorky
- #2300: Use less RAM in LdaMulticore, by @horpto
- #2698: Streamline KeyedVectors & X2Vec API, by @gojomo
- #2864: Speed up random number generation in word2vec, by @zygm0nt
- #2976: Speed up phrase (collocation) detection, by @piskvorky
- #2979: Allow skipping common English words in multi-word phrases, by @piskvorky
- #2867: Expose
max_final_vocab
parameter in fastText constructor, by @mpenkov - #2931: Clear up job queue parameters in word2vec, by @lunastera
- #2939: X2Vec SaveLoad improvements, by @piskvorky
📚 Tutorials and docs
- #2954: New theme for the Gensin website, @dvorakvaclav
- #2960: Added Gensim and Compatibility Wiki page, by @piskvorky
- #2960: Reworked & simplified the Developer Wiki page, by @piskvorky
- #2968: Migrate tutorials & how-tos to 4.0.0, by @piskvorky
- #2899: Clean up of language and formatting of docstrings, by @piskvorky
- #2899: Added documentation for NMSLIB indexer, by @piskvorky
- #2832: Clear up LdaModel documentation by @FyzHsn
- #2871: Clarify that license is LGPL-2.1, by @pombredanne
- #2896: Make docs clearer on
alpha
parameter in LDA model, by @xh2 - #2897: Update Hoffman paper link for Online LDA, by @xh2
- #2910: Refresh docs for run_annoy tutorial, by @piskvorky
- #2935: Fix "generator" language in word2vec docs, by @polm
🔴 Bug fixes
- #2891: Fix fastText word-vectors with ngrams off, by @gojomo
- #2907: Fix doc2vec crash for large sets of doc-vectors, by @gojomo
- #2899: Fix similarity bug in NMSLIB indexer, by @piskvorky
- #2899: Fix deprecation warnings in Annoy integration, by @piskvorky
- #2901: Fix inheritance of WikiCorpus from TextCorpus, by @jenishah
- #2940; Fix deprecations in SoftCosineSimilarity, by @Witiko
- #2944: Fix
save_facebook_model
failure after update-vocab & other initialization streamlining, by @gojomo - #2846: Fix for Python 3.9/3.10: remove
xml.etree.cElementTree
, by @hugovk - #2973: phrases.export_phrases() doesn't yield all bigrams
- #2942: Segfault when training doc2vec
⚠️ Removed functionality & deprecations
- #6: No more binary wheels for x32 platforms, by menshikh-iv
- #2899: Renamed overly broad
similarities.index
to the more appropriatesimilarities.annoy
, by @piskvorky - #2958: Remove gensim.summarization subpackage, docs and test data, by @mpenkov
- #2926: Rename
num_words
totopn
in dtm_coherence, by @MeganStodel - #2937: Remove Keras dependency, by @piskvorky
- Removed all code, methods, attributes and functions marked as deprecated in Gensim 3.8.3.
- Removed pattern dependency (PR #3012, @mpenkov). If you need to lemmatize, do it prior to passing the corpus to gensim.
3.8.3, 2020-05-03
This is primarily a bugfix release to bring back Py2.7 compatibility to gensim 3.8.
🔴 Bug fixes
- Bring back Py27 support (PR #2812, @mpenkov)
- Fix wrong version reported by setup.py (Issue #2796)
- Fix missing C extensions (Issues #2794 and #2802)
👍 Improvements
- Wheels for Python 3.8 (@menshikh-iv)
- Prepare for removal of deprecated
lxml.etree.cElementTree
(PR #2777, @tirkarthi)
📚 Tutorial and doc improvements
- Update test instructions in README (PR #2814, @piskvorky)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.FastText.load_fasttext_format
: use load_facebook_vectors to load embeddings only (faster, less CPU/memory usage, does not support training continuation) and load_facebook_model to load full model (slower, more CPU/memory intensive, supports training continuation)gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.8.2, 2020-04-10
🔴 Bug fixes
- Pin
smart_open
version for compatibility with Py2.7
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.FastText.load_fasttext_format
: use load_facebook_vectors to load embeddings only (faster, less CPU/memory usage, does not support training continuation) and load_facebook_model to load full model (slower, more CPU/memory intensive, supports training continuation)gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.8.1, 2019-09-23
🔴 Bug fixes
- Fix usage of base_dir instead of BASE_DIR in _load_info in downloader. (movb, #2605)
- Update the version of smart_open in the setup.py file (AMR-KELEG, #2582)
- Properly handle unicode_errors arg parameter when loading a vocab file (wmtzk, #2570)
- Catch loading older TfidfModels without smartirs (bnomis, #2559)
- Fix bug where a module import set up logging, pin doctools for Py2 (piskvorky, #2552)
📚 Tutorial and doc improvements
👍 Improvements
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.FastText.load_fasttext_format
: use load_facebook_vectors to load embeddings only (faster, less CPU/memory usage, does not support training continuation) and load_facebook_model to load full model (slower, more CPU/memory intensive, supports training continuation)gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.8.0, 2019-07-08
🌟 New Features
- Enable online training of Poincare models (koiizukag, #2505)
- Make BM25 more scalable by adding support for generator inputs (saraswatmks, #2479)
- Allow the Gensim dataset / pre-trained model downloader
gensim.downloader
to run offline, by introducing a local file cache (mpenkov, #2545) - Make the
gensim.downloader
target directory configurable (mpenkov, #2456) - Add
nmslib
indexer (masa3141, #2417)
🔴 Bug fixes
- Fix
smart_open
deprecation warning globally (itayB, #2530) - Fix AppVeyor issues with Windows and Py2 (mpenkov, #2546)
- Fix
topn=0
versustopn=None
bug inmost_similar
, accepttopn
of any integer type (Witiko, #2497) - Fix Python version check (charsyam, #2547)
- Fix typo in FastText documentation (Guitaricet, #2518)
- Fix "Market Matrix" to "Matrix Market" typo. (Shooter23, #2513)
- Fix auto-generated hyperlinks in
CHANGELOG.md
(mpenkov, #2482)
📚 Tutorial and doc improvements
- Generate documentation for the
gensim.similarities.termsim
module (Witiko, #2485) - Simplify the
Support
section in README (piskvorky, #2542)
👍 Improvements
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.FastText.load_fasttext_format
: use load_facebook_vectors to load embeddings only (faster, less CPU/memory usage, does not support training continuation) and load_facebook_model to load full model (slower, more CPU/memory intensive, supports training continuation)gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.7.3, 2019-05-06
🔴 Bug fixes
- Fix fasttext model loading from gzip files (mpenkov, #2476)
- Fix misleading
Doc2Vec.docvecs
comment (gojomo, #2472) - NMF bugfix (mpenkov, #2466)
- Fix
WordEmbeddingsKeyedVectors.most_similar
(Witiko, #2461) - Fix LdaSequence model by updating to num_documents (Bharat123rox, #2410)
- Make termsim matrix positive definite even with negative similarities (Witiko, #2397)
- Fix the off-by-one bug in the TFIDF model. (AMR-KELEG, #2392)
- Update legacy model loading (mpenkov, #2454, #2457)
- Make
matutils.unitvec
always return float norm when requested (Witiko, #2419)
📚 Tutorial and doc improvements
👍 Improvements
- Adding type check for corpus_file argument (saraswatmks, #2469)
- Clean up FastText Cython code, fix division by zero (mpenkov, #2382)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.FastText.load_fasttext_format
: use load_facebook_vectors to load embeddings only (faster, less CPU/memory usage, does not support training continuation) and load_facebook_model to load full model (slower, more CPU/memory intensive, supports training continuation)gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.7.2, 2019-04-06
🌟 New Features
gensim.models.fasttext.load_facebook_model
function: load full model (slower, more CPU/memory intensive, supports training continuation)gensim.models.fasttext.load_facebook_vectors
function: load embeddings only (faster, less CPU/memory usage, does not support training continuation)
🔴 Bug fixes
- Fix unicode error when loading FastText vocabulary (@mpenkov, #2390)
- Avoid division by zero in fasttext_inner.pyx (@mpenkov, #2404)
- Avoid incorrect filename inference when loading model (@mpenkov, #2408)
- Handle invalid unicode when loading native FastText models (@mpenkov, #2411)
- Avoid divide by zero when calculating vectors for terms with no ngrams (@mpenkov, #2411)
📚 Tutorial and doc improvements
- Add link to bindr (rogueleaderr, #2387)
👍 Improvements
⚠️ Changes in FastText behavior
Out-of-vocab word handling
To achieve consistency with the reference implementation from Facebook,
a FastText
model will now always report any word, out-of-vocabulary or
not, as being in the model, and always return some vector for any word
looked-up. Specifically:
'any_word' in ft_model
will always returnTrue
. Previously, it
returnedTrue
only if the full word was in the vocabulary. (To test if a
full word is in the known vocabulary, you can consult thewv.vocab
property:'any_word' in ft_model.wv.vocab
will returnFalse
if the full
word wasn't learned during model training.)ft_model['any_word']
will always return a vector. Previously, it
raisedKeyError
for OOV words when the model had no vectors
for any ngrams of the word.- If no ngrams from the term are present in the model,
or when no ngrams could be extracted from the term, a vector pointing
to the origin will be returned. Previously, a vector of NaN (not a number)
was returned as a consequence of a divide-by-zero problem. - Models may use more more memory, or take longer for word-vector
lookup, especially after training on smaller corpuses where the previous
non-compliant behavior discarded some ngrams from consideration.
Loading models in Facebook .bin format
The gensim.models.FastText.load_fasttext_format
function (deprecated) now loads the entire model contained in the .bin file, including the shallow neural network that enables training continuation.
Loading this NN requires more CPU and RAM than previously required.
Since this function is deprecated, consider using one of its alternatives (see below).
Furthermore, you must now pass the full path to the file to load, including the file extension.
Previously, if you specified a model path that ends with anything other than .bin, the code automatically appended .bin to the path before loading the model.
This behavior was confusing, so we removed it.
⚠️ Deprecations (will be removed in the next major release)
Remove:
gensim.models.FastText.load_fasttext_format
: use load_facebook_vectors to load embeddings only (faster, less CPU/memory usage, does not support training continuation) and load_facebook_model to load full model (slower, more CPU/memory intensive, supports training continuation)
3.7.1, 2019-01-31
👍 Improvements
- NMF optimization & documentation (@anotherbugmaster, #2361)
- Optimize
FastText.load_fasttext_model
(@mpenkov, #2340) - Add warning when string is used as argument to
Doc2Vec.infer_vector
(@tobycheese, #2347) - Fix light linting issues in
LdaSeqModel
(@horpto, #2360) - Move out
process_result_queue
from cycle inLdaMulticore
(@horpto, #2358)
🔴 Bug fixes
- Fix infinite diff in
LdaModel.do_mstep
(@horpto, #2344) - Fix backward compatibility issue: loading
FastTextKeyedVectors
usingKeyedVectors
(missing attributecompatible_hash
) (@menshikh-iv, #2349) - Fix logging issue (conda-forge related) (@menshikh-iv, #2339)
- Fix
WordEmbeddingsKeyedVectors.most_similar
(@Witiko, #2356) - Fix issues of
flake8==3.7.1
(@horpto, #2365)
📚 Tutorial and doc improvements
- Improve
FastText
documentation (@mpenkov, #2353) - Minor corrections and improvements in
Any*Vec
docstrings (@tobycheese, #2345) - Fix the example code for SparseTermSimilarityMatrix (@Witiko, #2359)
- Update
poincare
documentation to indicate the relation format (@AMR-KELEG, #2357)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.7.0, 2019-01-18
🌟 New features
-
Fast Online NMF (@anotherbugmaster, #2007)
-
Benchmark
wiki-english-20171001
Model Perplexity Coherence L2 norm Train time (minutes) LDA 4727.07 -2.514 7.372 138 NMF 975.74 -2.814 7.265 73 NMF (with regularization) 985.57 -2.436 7.269 441 -
Simple to use (same interface as
LdaModel
)from gensim.models.nmf import Nmf from gensim.corpora import Dictionary import gensim.downloader as api text8 = api.load('text8') dictionary = Dictionary(text8) dictionary.filter_extremes() corpus = [ dictionary.doc2bow(doc) for doc in text8 ] nmf = Nmf( corpus=corpus, num_topics=5, id2word=dictionary, chunksize=2000, passes=5, random_state=42, ) nmf.show_topics() """ [(0, '0.007*"km" + 0.006*"est" + 0.006*"islands" + 0.004*"league" + 0.004*"rate" + 0.004*"female" + 0.004*"economy" + 0.003*"male" + 0.003*"team" + 0.003*"elections"'), (1, '0.006*"actor" + 0.006*"player" + 0.004*"bwv" + 0.004*"writer" + 0.004*"actress" + 0.004*"singer" + 0.003*"emperor" + 0.003*"jewish" + 0.003*"italian" + 0.003*"prize"'), (2, '0.036*"college" + 0.007*"institute" + 0.004*"jewish" + 0.004*"universidad" + 0.003*"engineering" + 0.003*"colleges" + 0.003*"connecticut" + 0.003*"technical" + 0.003*"jews" + 0.003*"universities"'), (3, '0.016*"import" + 0.008*"insubstantial" + 0.007*"y" + 0.006*"soviet" + 0.004*"energy" + 0.004*"info" + 0.003*"duplicate" + 0.003*"function" + 0.003*"z" + 0.003*"jargon"'), (4, '0.005*"software" + 0.004*"games" + 0.004*"windows" + 0.003*"microsoft" + 0.003*"films" + 0.003*"apple" + 0.003*"video" + 0.002*"album" + 0.002*"fiction" + 0.002*"characters"')] """
-
See also:
-
-
Massive improvement
FastText
compatibilities (@mpenkov, #2313)from gensim.models import FastText # 'cc.ru.300.bin' - Russian Facebook FT model trained on Common Crawl # Can be downloaded from https://s3-us-west-1.amazonaws.com/fasttext-vectors/word-vectors-v2/cc.ru.300.bin.gz model = FastText.load_fasttext_format("cc.ru.300.bin") # Fixed hash-function allow to produce same output as FB FastText & works correctly for non-latin languages (for example, Russian) assert "мяу" in m.wv.vocab # 'мяу' - vocab word model.wv.most_similar("мяу") """ [('Мяу', 0.6820122003555298), ('МЯУ', 0.6373013257980347), ('мяу-мяу', 0.593108594417572), ('кис-кис', 0.5899622440338135), ('гав', 0.5866007804870605), ('Кис-кис', 0.5798211097717285), ('Кис-кис-кис', 0.5742273330688477), ('Мяу-мяу', 0.5699705481529236), ('хрю-хрю', 0.5508339405059814), ('ав-ав', 0.5479759573936462)] """ assert "котогород" not in m.wv.vocab # 'котогород' - out-of-vocab word model.wv.most_similar("котогород", topn=3) """ [('автогород', 0.5463314652442932), ('ТагилНовокузнецкНовомосковскНовороссийскНовосибирскНовотроицкНовочеркасскНовошахтинскНовый', 0.5423436164855957), ('областьНовосибирскБарабинскБердскБолотноеИскитимКарасукКаргатКуйбышевКупиноОбьТатарскТогучинЧерепаново', 0.5377570390701294)] """ # Now we load full model, for this reason, we can continue an training from gensim.test.utils import datapath from smart_open import smart_open with smart_open(datapath("crime-and-punishment.txt"), encoding="utf-8") as infile: # russian text corpus = [line.strip().split() for line in infile] model.train(corpus, total_examples=len(corpus), epochs=5)
-
Similarity search improvements (@Witiko, #2016)
-
Add similarity search using the Levenshtein distance in
gensim.similarities.LevenshteinSimilarityIndex
-
Performance optimizations to
gensim.similarities.SoftCosineSimilarity
(full benchmark)dictionary size corpus size speed 1000 100 1.0× 1000 1000 53.4× 1000 100000 156784.8× 100000 100 3.8× 100000 1000 405.8× 100000 100000 66262.0× -
See updated soft-cosine tutorial for more information and usage examples
-
-
Add
python3.7
support (@menshikh-iv, #2211)- Wheels for Window, OSX and Linux platforms (@menshikh-iv, MacPython/gensim-wheels/#12)
- Faster installation
👍 Improvements
Optimizations
- Reduce
Phraser
memory usage (drop frequencies) (@jenishah, #2208) - Reduce memory consumption of summarizer (@horpto, #2298)
- Replace inline slow equivalent of mean_absolute_difference with fast (@horpto, #2284)
- Reuse precalculated updated prior in
ldamodel.update_dir_prior
(@horpto, #2274) - Improve
KeyedVector.wmdistance
(@horpto, #2326) - Optimize
remove_unreachable_nodes
ingensim.summarization
(@horpto, #2263) - Optimize
mz_entropy
fromgensim.summarization
(@horpto, #2267) - Improve
filter_extremes
methods inDictionary
andHashDictionary
(@horpto, #2303)
Additions
- Add
KeyedVectors.relative_cosine_similarity
(@rsdel2007, #2307) - Add
random_seed
toLdaMallet
(@Zohaggie & @menshikh-iv, #2153) - Add
common_terms
parameter tosklearn_api.PhrasesTransformer
(@pmlk, #2074) - Add method for patch
corpora.Dictionary
based on special tokens (@Froskekongen, #2200)
Cleanup
- Improve
six
usage (xrange
,map
,zip
) (@horpto, #2264) - Refactor
line2doc
methods ofLowCorpus
andMalletCorpus
(@horpto, #2269) - Get rid most of warnings in testing (@menshikh-iv, #2191)
- Fix non-deterministic test failures (pin
PYTHONHASHSEED
) (@menshikh-iv, #2196) - Fix "aliasing chunkize to chunkize_serial" warning on Windows (@aquatiko, #2202)
- Remove
getitem
code duplication ingensim.models.phrases
(@jenishah, #2206) - Add
flake8-rst
for docstring code examples (@kataev, #2192) - Get rid
py26
stuff (@menshikh-iv, #2214) - Use
itertools.chain
instead ofsum
to concatenate lists (@Stigjb, #2212) - Fix flake8 warnings W605, W504 (@horpto, #2256)
- Remove unnecessary creations of lists at all (@horpto, #2261)
- Fix extra list creation in
utils.get_max_id
(@horpto, #2254) - Fix deprecation warning
np.sum(generator)
(@rsdel2007, #2296) - Refactor
BM25
(@horpto, #2275) - Fix pyemd import (@ramprakash-94, #2240)
- Set
metadata=True
formake_wikicorpus
script by default (@Xinyi2016, #2245) - Remove unimportant warning from
Phrases
(@rsdel2007, #2331) - Replace
open()
bysmart_open()
ingensim.models.fasttext._load_fasttext_format
(@rsdel2007, #2335)
🔴 Bug fixes
- Fix overflow error for
*Vec
corpusfile-based training (@bm371613, #2239) - Fix
malletmodel2ldamodel
conversion (@horpto, #2288) - Replace custom epsilons with numpy equivalent in
LdaModel
(@horpto, #2308) - Add missing content to tarball (@menshikh-iv, #2194)
- Fixes divided by zero when w_star_count==0 (@allenyllee, #2259)
- Fix check for callbacks (@allenyllee, #2251)
- Fix
SvmLightCorpus.serialize
iflabels
instance of numpy.ndarray (@aquatiko, #2243) - Fix poincate viz incompatibility with
plotly>=3.0.0
(@jenishah, #2226) - Fix
keep_n
behavior forDictionary.filter_extremes
(@johann-petrak, #2232) - Fix for
sphinx==1.8.1
(last r (@menshikh-iv, #None) - Fix
np.issubdtype
warnings (@marioyc, #2210) - Drop wrong key
-c
fromgensim.downloader
description (@horpto, #2262) - Fix gensim build (docs & pyemd issues) (@menshikh-iv, #2318)
- Limit visdom version (avoid py2 issue from the latest visdom release) (@menshikh-iv, #2334)
- Fix visdom integration (using
viz.line()
instead ofviz.updatetrace()
) (@allenyllee, #2252)
📚 Tutorial and doc improvements
- Add gensim-data repo to
gensim.downloader
& fix rendering of code examples (@menshikh-iv, #2327) - Fix typos in
gensim.models
(@rsdel2007, #2323) - Fixed typos in notebooks (@rsdel2007, #2322)
- Update
Doc2Vec
documentation: how tags are assigned incorpus_file
mode (@persiyanov, #2320) - Fix typos in
gensim/models/keyedvectors.py
(@rsdel2007, #2290) - Add documentation about ranges to scoring functions for
Phrases
(@jenishah, #2242) - Update return sections for
KeyedVectors.evaluate_word_*
(@Stigjb, #2205) - Fix return type in
KeyedVector.evaluate_word_analogies
(@Stigjb, #2207) - Fix
WmdSimilarity
documentation (@jagmoreira, #2217) - Replace
fify -> fifty
ingensim.parsing.preprocessing.STOPWORDS
(@coderwassananmol, #2220) - Remove
alpha="auto"
fromLdaMulticore
(not supported yet) (@johann-petrak, #2225) - Update Adopters in README (@piskvorky, #2234)
- Fix broken link in
tutorials.md
(@rsdel2007, #2302)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.6.0, 2018-09-20
🌟 New features
-
File-based training for
*2Vec
models (@persiyanov, #2127 & #2078 & #2048)New training mode for
*2Vec
models (word2vec, doc2vec, fasttext) that allows model training to scale linearly with the number of cores (full GIL elimination). The result of our Google Summer of Code 2018 project by Dmitry Persiyanov.Benchmark
- Dataset:
full English Wikipedia
- Cloud:
GCE
- CPU:
Intel(R) Xeon(R) CPU @ 2.30GHz 32 cores
- BLAS:
MKL
Model Queue-based version [sec] File-based version [sec] speed up Accuracy (queue-based) Accuracy (file-based) Word2Vec 9230 2437 3.79x 0.754 (± 0.003) 0.750 (± 0.001) Doc2Vec 18264 2889 6.32x 0.721 (± 0.002) 0.683 (± 0.003) FastText 16361 10625 1.54x 0.642 (± 0.002) 0.660 (± 0.001) Usage:
import gensim.downloader as api from multiprocessing import cpu_count from gensim.utils import save_as_line_sentence from gensim.test.utils import get_tmpfile from gensim.models import Word2Vec, Doc2Vec, FastText # Convert any corpus to the needed format: 1 document per line, words delimited by " " corpus = api.load("text8") corpus_fname = get_tmpfile("text8-file-sentence.txt") save_as_line_sentence(corpus, corpus_fname) # Choose num of cores that you want to use (let's use all, models scale linearly now!) num_cores = cpu_count() # Train models using all cores w2v_model = Word2Vec(corpus_file=corpus_fname, workers=num_cores) d2v_model = Doc2Vec(corpus_file=corpus_fname, workers=num_cores) ft_model = FastText(corpus_file=corpus_fname, workers=num_cores)
- Dataset:
👍 Improvements
- Add scikit-learn wrapper for
FastText
(@mcemilg, #2178) - Add multiprocessing support for
BM25
(@Shiki-H, #2146) - Add
name_only
option for downloader api (@aneesh-joshi, #2143) - Make
word2vec2tensor
script compatible withpython3
(@vsocrates, #2147) - Add custom filter for
Wikicorpus
(@mattilyra, #2089) - Make
similarity_matrix
support non-contiguous dictionaries (@Witiko, #2047)
🔴 Bug fixes
- Fix memory consumption in
AuthorTopicModel
(@philipphager, #2122) - Correctly process empty documents in
AuthorTopicModel
(@probinso, #2133) - Fix ZeroDivisionError
keywords
issue with short input (@LShostenko, #2154) - Fix
min_count
handling in phrases detection usingnpmi_scorer
(@lopusz, #2072) - Remove duplicate count from
Phraser
log message (@robguinness, #2151) - Replace
np.integer
->np.int
inAuthorTopicModel
(@menshikh-iv, #2145)
📚 Tutorial and doc improvements
- Update docstring with new analogy evaluation method (@akutuzov, #2130)
- Improve
prune_at
parameter description forgensim.corpora.Dictionary
(@yxonic, #2128) - Fix
default
->auto
prior parameter in documentation for lda-related models (@Laubeee, #2156) - Use heading instead of bold style in
gensim.models.translation_matrix
(@nzw0301, #2164) - Fix quote of vocabulary from
gensim.models.Word2Vec
(@nzw0301, #2161) - Replace deprecated parameters with new in docstring of
gensim.models.Doc2Vec
(@xuhdev, #2165) - Fix formula in Mallet documentation (@Laubeee, #2186)
- Fix minor semantic issue in docs for
Phrases
(@RunHorst, #2148) - Fix typo in documentation (@KenjiOhtsuka, #2157)
- Additional documentation fixes (@piskvorky, #2121)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.5.0, 2018-07-06
This release comprises a glorious 38 pull requests from 28 contributors. Most of the effort went into improving the documentation—hence the release code name "Docs 💬"!
Apart from the massive overhaul of all Gensim documentation (including docstring style and examples—you asked for it), we also managed to sneak in some new functionality and a number of bug fixes. As usual, see the notes below for a complete list, with links to pull requests for more details.
Huge thanks to all contributors! Nobody loves working on documentation. 3.5.0 is a result of several months of laborious, unglamorous, and sometimes invisible work. Enjoy!
📚 Documentation improvements
- Overhaul documentation for
*2vec
models (@steremma & @piskvorky & @menshikh-iv, #1944, #2087) - Fix documentation for LDA-related models (@steremma & @piskvorky & @menshikh-iv, #2026)
- Fix documentation for utils, corpora, inferfaces (@piskvorky & @menshikh-iv, #2096)
- Update non-API docs (about, intro, license etc) (@piskvorky & @menshikh-iv, #2101)
- Refactor documentation for
gensim.models.phrases
(@CLearERR & @menshikh-iv, #1950) - Fix HashDictionary documentation (@piskvorky, #2073)
- Fix docstrings for
gensim.models.AuthorTopicModel
(@souravsingh & @menshikh-iv, #1907) - Fix docstrings for HdpModel, lda_worker & lda_dispatcher (@gyanesh-m & @menshikh-iv, #1912)
- Fix format & links for
gensim.similarities.docsim
(@CLearERR & @menshikh-iv, #2030) - Remove duplication of class documentation for
IndexedCorpus
(@darindf, #2033) - Refactor documentation for
gensim.models.coherencemodel
(@CLearERR & @menshikh-iv, #1933) - Fix docstrings for
gensim.sklearn_api
(@steremma & @menshikh-iv, #1895) - Disable google-style docstring support (@menshikh-iv, #2106)
- Fix docstring of
gensim.models.KeyedVectors.similarity_matrix
(@Witiko, #1971) - Consistently use
smart_open()
instead ofopen()
in notebooks (@sharanry, #1812)
🌟 New features:
- Add
add_entity
method toKeyedVectors
to allow adding word vectors manually (@persiyanov, #1957) - Add inference for new unseen author to
AuthorTopicModel
(@Stamenov, #1766) - Add
evaluate_word_analogies
(will replaceaccuracy
) method toKeyedVectors
(@akutuzov, #1935) - Add Pivot Normalization to
TfidfModel
(@markroxor, #1780)
👍 Improvements
- Allow initialization with
max_final_vocab
in lieu ofmin_count
inWord2Vec
(@aneesh-joshi, #1915) - Add
dtype
argument forchunkize_serial
inLdaModel
(@darindf, #2027) - Increase performance in
Phrases.analyze_sentence
(@JonathanHourany, #2070) - Add
ns_exponent
parameter to control the negative sampling distribution for*2vec
models (@fernandocamargoti, #2093)
🔴 Bug fixes:
- Fix
Doc2Vec.infer_vector
+ notebook cleanup (@gojomo, #2103) - Fix linear decay for learning rate in
Doc2Vec.infer_vector
(@umangv, #2063) - Fix negative sampling floating-point error for `gensim.models.Poincare (@jayantj, #1959)
- Fix loading
word2vec
anddoc2vec
models saved using old Gensim versions (@manneshiva, #2012) - Fix
SoftCosineSimilarity.get_similarities
on corpora ssues/1955) (@Witiko, #1972) - Fix return dtype for
matutils.unitvec
according to input dtype (@o-P-o, #1992) - Fix passing empty dictionary to
gensim.corpora.WikiCorpus
(@steremma, #2042) - Fix bug in
Similarity.query_shards
in multiprocessing case (@bohea, #2044) - Fix SMART from TfidfModel for case when
df == "n"
(@PeteBleackley, #2021) - Fix OverflowError when loading a large term-document matrix in compiled MatrixMarket format (@arlenk, #2001)
- Update rules for removing table markup from Wikipedia dumps (@chaitaliSaini, #1954)
- Fix
_is_single
fromPhrases
for case when corpus is a NumPy array (@rmalouf, #1987) - Fix tests for
EuclideanKeyedVectors.similarity_matrix
(@Witiko, #1984) - Fix deprecated parameters in
D2VTransformer
andW2VTransformer
(@MritunjayMohitesh, #1945) - Fix
Doc2Vec.infer_vector
after loading oldDoc2Vec
(gensim<=3.2
)(@manneshiva, #1974) - Fix inheritance chain for
load_word2vec_format
(@DennisChen0307, #1968) - Update Keras version (avoid bug from
keras==2.1.5
) (@menshikh-iv, #1963)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.4.0, 2018-03-01
🌟 New features:
-
Massive optimizations of
gensim.models.LdaModel
: much faster training, using Cython. (@arlenk, #1767)-
Training benchmark 💥
dataset old LDA [sec] optimized LDA [sec] speed up nytimes 3473 1975 1.76x enron 774 437 1.77x -
This change affects all models that depend on
LdaModel
, such asLdaMulticore
,LdaSeqModel
,AuthorTopicModel
.
-
-
Huge speed-ups to corpus I/O with
MmCorpus
(Cython) (@arlenk, #1825)-
File reading benchmark
dataset file compressed? old MmReader [sec] optimized MmReader [sec] speed up enron no 22.3 2.6 8.7x yes 37.3 14.4 2.6x nytimes no 419.3 49.2 8.5x yes 686.2 275.1 2.5x text8 no 25.4 2.5 10.1x yes 41.9 17.0 2.5x -
Overall, a 2.5x speedup for compressed
.mm.gz
input and 8.5x 🔥🔥🔥 for uncompressed plaintext.mm
.
-
-
Performance and memory optimization to
gensim.models.FastText
🚀 (@jbaiter, #1916)-
Benchmark (first 500,000 articles from English Wikipedia)
Metric old FastText optimized FastText improvement Training time (1 epoch) 4823.4s (80.38 minutes) 1873.6s (31.22 minutes) 2.57x Training time (full) 1h 26min 13s 36min 43s 2.35x Training words/sec 72,781 187,366 2.57x Training peak memory 5.2 GB 3.7 GB 1.4x -
Overall, a 2.5x speedup & memory usage reduced by 30%.
-
-
Implemented Soft Cosine Measure (@Witiko, #1827)
-
New method for assessing document similarity, a nice faster alternative to WMD, Word Mover's Distance
-
Benchmark
Technique MAP score Duration softcossim 45.99 1.24 sec wmd-relax 44.48 12.22 sec cossim 44.22 4.39 sec wmd-gensim 44.08 98.29 sec -
Soft Cosine notebook with detailed description, examples & benchmarks
-
Related papers:
-
👍 Improvements:
- New method to show the Gensim installation parameters:
python -m gensim.scripts.package_info --info
. Use this when reporting problems, for easier debugging. Fix #1902 (@sharanry, #1903) - Added a flag to optionally skip network-related tests, to help maintainers avoid network issues with CI services (@menshikh-iv, #1930)
- Added
license
field tosetup.py
, allowing the use of tools likepip-licenses
(@nils-werner, #1909)
🔴 Bug fixes:
- Fix Python 3 compatibility for
gensim.corpora.UciCorpus.save_corpus
(@darindf, #1875) - Add
wv
property to KeyedVectors for backward compatibility. Fix #1882 (@manneshiva, #1884) - Fix deprecation warning from
inspect.getargspec
. Fix #1878 (@aneesh-joshi, #1887) - Add
LabeledSentence
togensim.models.doc2vec
for backward compatibility. Fix #1886 (@manneshiva, #1891) - Fix empty output bug in
Phrases
(when usingmodel[tokens]
twice). Fix #1401 (@sj29-innovate, #1853) - Fix type problems for
D2VTransformer.fit_transform
. Fix #1834 (@Utkarsh-Mishra-CIC, #1845) - Fix
datatype
parameter forKeyedVectors.load_word2vec_format
. Fix #1682 (@pushpankar, #1819) - Fix deprecated parameters in
doc2vec-lee
notebook (@TheFlash10, #1918) - Fix file-like closing bug in
gensim.corpora.MmCorpus
. Fix #1869 (@sj29-innovate, #1911) - Fix precision problem in
test_similarities.py
, no more FP fails. (@menshikh-iv, #1928) - Fix encoding in Lee corpus reader. (@menshikh-iv, #1931)
- Fix OOV pairs counter in
WordEmbeddingsKeyedVectors.evaluate_word_pairs
. (@akutuzov, #1934)
📚 Tutorial and doc improvements:
- Fix example block for
gensim.models.Word2Vec
(@nzw0301, #1870) - Fix
doc2vec-lee
notebook (@numericlee, #1870) - Store images from
README.md
directly in repository. Fix #1849 (@ibrahimsharaf, #1861) - Add windows venv activate command to
CONTRIBUTING.md
(@aneesh-joshi, #1880) - Add anaconda-cloud badge. Partial fix #1901 (@sharanry, #1905)
- Fix docstrings for lsi-related code (@steremma, #1892)
- Fix parameter description of
sg
parameter forgensim.models.word2vec
(@mdcclv, #1919) - Refactor documentation for
gensim.similarities.docsim
andMmCorpus-related
. (@CLearERR & @menshikh-iv, #1910) - Fix docstrings for
gensim.test.utils
(@yurkai & @menshikh-iv, #1904) - Refactor docstrings for
gensim.scripts
. Partial fix #1665 (@yurkai & @menshikh-iv, #1792) - Refactor API reference
gensim.corpora
. Partial fix #1671 (@CLearERR & @menshikh-iv, #1835) - Fix documentation for
gensim.models.wrappers
(@kakshay21 & @menshikh-iv, #1859) - Fix docstrings for
gensim.interfaces
(@yurkai & @menshikh-iv, #1913)
⚠️ Deprecations (will be removed in the next major release)
-
Remove
gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.3.0, 2018-02-02
🌟 New features:
-
Re-designed all "*2vec" implementations (@manneshiva, #1777)
- Modular organization of
Word2Vec
,Doc2Vec
,FastText
, etc ..., making it easier to add new models in the future and re-use code - Fully backward compatible (even with loading models stored by a previous Gensim version)
- Detailed documentation for the *2vec refactoring project
- Modular organization of
-
Improve
gensim.scripts.segment_wiki
by retaining interwiki links. Fix #1712
(@steremma, PR #1839)-
Optionally extract interlinks from Wikipedia pages (use the
--include-interlinks
option). This will output one additional JSON dict for each article:{ "interlinks": { "article title 1": "interlink text 1", "article title 2": "interlink text 2", ... } }
-
Example: extract the Wikipedia graph with article links as edges, from a raw Wikipedia dump:
python -m gensim.scripts.segment_wiki --include-interlinks --file ~/Downloads/enwiki-latest-pages-articles.xml.bz2 --output ~/Desktop/enwiki-latest.jsonl.gz
- Read this field from the
segment_wiki
output:
import json from smart_open import smart_open with smart_open("enwiki-latest.jsonl.gz") as infile: for doc in infile: doc = json.loads(doc) src_node = doc['title'] dst_nodes = doc['interlinks'].keys() print(u"Source node: {}".format(src_node)) print(u"Destination nodes: {}".format(u", ".join(dst_nodes))) break """ OUTPUT: Source node: Anarchism Destination nodes: anarcha-feminist, Ivan Illich, Adolf Brand, Josiah Warren, will (philosophy), anarcha-feminism, Anarchism in Mexico, Lysander Spooner, English Civil War, G8, Sebastien Faure, Nihilist movement, Sébastien Faure, Left-wing politics, imamate, Pierre Joseph Proudhon, anarchist communism, Università popolare (Italian newspaper), 1848 Revolution, Synthesis anarchism, labour movement, anarchist communists, collectivist anarchism, polyamory, post-humanism, postcolonialism, anti war movement, State (polity), security culture, Catalan people, Stoicism, Progressive education, stateless society, Umberto I of Italy, German language, Anarchist schools of thought, NEFAC, Jacques Ellul, Spanish Communist Party, Crypto-anarchism, ruling class, non-violence, Platformist, The History of Sexuality, Revolutions of 1917–23, Federación Anarquista Ibérica, propaganda of the deed, William B. Greene, Platformism, mutually exclusive, Fraye Arbeter Shtime, Adolf Hitler, oxymoron, Paris Commune, Anarchism in Italy#Postwar years and today, Oranienburg, abstentionism, Free Society, Henry David Thoreau, privative alpha, George I of Greece, communards, Gustav Landauer, Lucifer the Lightbearer, Moses Harman, coercion, regicide, rationalist, Resistance during World War II, Christ (title), Bohemianism, individualism, Crass, black bloc, Spanish Revolution of 1936, Erich Mühsam, Empress Elisabeth of Austria, Free association (communism and anarchism), general strike, Francesc Ferrer i Guàrdia, Catalan anarchist pedagogue and free-thinker, veganarchism, Traditional knowledge, Japanese Anarchist Federation, Diogenes of Sinope, Hierarchy, sexual revolution, Naturism, Bavarian Soviet Republic, February Revolution, Eugene Varlin, Renaissance humanism, Mexican Liberal Party, Friedrich Engels, Fernando Tarrida del Mármol, Caliphate, Marxism, Jesus, John Cage, Umanita Nova, Anarcho-pacifism, Peter Kropotkin, Religious anarchism, Anselme Bellegarrigue, civilisation, moral obligation, hedonist, Free Territory (Ukraine), -ism, neo-liberalism, Austrian School, philosophy, freethought, Joseph Goebbels, Conservatism, anarchist economics, Cavalier, Maximilien de Robespierre, Comstockery, Dorothy Day, Anarchism in France, Fédération anarchiste, World Economic Forum, Amparo Poch y Gascón, Sex Pistols, women's rights, collectivisation, Taoism, common ownership, William Batchelder Greene, Collective farming, popular education, biphobia, targeted killings, Protestant Christianity, state socialism, Marie François Sadi Carnot, Stephen Pearl Andrews, World Trade Organization, Communist Party of Spain (main), Pluto Press, Levante, Spain, Alexander Berkman, Wilhelm Weitling, Kharijites, Bolshevik, Liberty (1881–1908), Anarchist Aragon, social democrats, Dielo Truda, Post-left anarchy, Age of Enlightenment, Blanquism, Walden, mutual aid (organization), Far-left politics, privative, revolutions of 1848, anarchism and nationalism, punk rock, Étienne de La Boétie, Max Stirner, Jacobin (politics), agriculture, anarchy, Confederacion General del Trabajo de España, toleration, reformism, International Anarchist Congress of Amsterdam, The Ego and Its Own, Ukraine, Civil Disobedience (Thoreau), Spanish Civil War, David Graeber, Anarchism and issues related to love and sex, James Guillaume, Insurrectionary anarchism, Political repression, International Workers' Association, Barcelona, Bulgaria, Voline, Zeno of Citium, anarcho-communists, organized religion, libertarianism, bisexuality, Ricardo Flores Magón, Henri Zisly, Eight-hour day, Freetown Christiania, heteronormativity, Mikhail Bakunin, Propagandaministerium, Ezra Heywood, individual reappropriation, Modern School (United States), archon, Confédération nationale du travail, socialist movement, History of Islam, Max Nettlau, Political Justice, Reichstag fire, Anti-Christianity, decentralised, Issues in anarchism#Communism, deschooling, Christian movement, squatter, Anarchism in Germany, Catalonia, Louise Michel, Solidarity Federation, What is Property?, European individualist anarchism, Pierre-Joseph Proudhon, Mexican Revolution, wikt:anarchism, Blackshirts, Jewish anarchism, Russian Civil War, property rights, anti-authoritarian, individual reclamation, propaganda by the deed, from each according to his ability, to each according to his need, Feminist movement, Confiscation, social anarchism, Anarchism in Russia, Daniel Guérin, Uruguayan Anarchist Federation, Anarcha-feminism, Enragés, Cynicism (philosophy), workers' council, The Word (free love), Allen Ginsberg, Campaign for Nuclear Disarmament, antimilitarism, Workers' self-management, Federación Obrera Regional Argentina, self-governance, free market, Carlos I of Portugal, Simon Critchley, Anti-clericalism, heterosexual, Layla AbdelRahim, Mexican Anarchist Federation, Anarchism and Marxism, October Revolution, Anti-nuclear movement, Joseph Déjacque, Bolsheviks, Luigi Fabbri, morality, Communist party, Sam Dolgoff, united front, Ammon Hennacy, social ecology, commune (intentional community), Oscar Wilde, French Revolution, egoist anarchism, Comintern, transphobia, anarchism without adjectives, social control, means of production, Michel Onfray, Anarchism in France#The Fourth Republic (1945–1958), syndicalism, Anarchism in Spain, Iberian Anarchist Federation, International of Anarchist Federations, Emma Goldman, Netherlands, anarchist free school, International Workingmen's Association, Queer anarchism, Cantonal Revolution, trade unionism, Karl Marx, LGBT community, humanism, Anti-fascism, Carrara, political philosophy, Anarcho-transhumanism, libertarian socialist, Russian Revolution (1917), Two Cheers for Anarchism: Six Easy Pieces on Autonomy, Dignity, and Meaningful Work and Play, Emile Armand, insurrectionary anarchism, individual, Zhuang Zhou, Free Territory, White movement, Greenwich Village, Virginia Bolten, transcendentalist, public choice theory, wikt:brigand, Issues in anarchism#Participation in statist democracy, free love, Mutualism (economic theory), Anarchist St. Imier International, censorship, federalist, 6 February 1934 crisis, biennio rosso, anti-clerical, centralism, Anarchism: A Documentary History of Libertarian Ideas, minarchism, James C. Scott, First International, homosexuality, political theology, spontaneous order, Oranienburg concentration camp, anarcho-communism, negative liberty, post-modernism, Anarchism in Italy, Leopold Kohr, union of egoists, counterculture, Miguel Gimenez Igualada, philosophical anarchism, International Libertarian Solidarity, homosexual, Counterculture of the 1960s, Errico Malatesta, strikebreaker, Workers' Party of Marxist Unification, Clifford Harper, Reification (fallacy), patriarchy, anarchist law, Apostle (Christian), market (economics), Summerhill School, positive liberty, socialism, feminism, Direct action, Melchor Rodríguez García, William Godwin, Nazi concentration camps, Synthesist anarchism, Margaret Anderson, Han Ryner, Federation of Organized Trades and Labor Unions, technology, Workers Solidarity Movement, Edmund Burke, Encyclopædia Britannica, state (polity), Herbert Read, Park Güell, utilitarian, far right leagues, Limited government, self-ownership, Pejorative, homophobia, Industrial Workers of the World, The Dispossessed, Hague Congress (1872), Stalinism, Reciprocity (cultural anthropology), Fernand Pelloutier, individualist anarchism in France, The False Principle of our Education, individualist anarchism, Pierre Monatte, Soviet Union, counter-economics, Rudolf Rocker, Anarchism and capitalism, Parma, Black Rose Books, lesbian, Arditi del Popolo, Emile Armand (1872–1962), who propounded the virtues of free love in the Parisian anarchist milieu of the early 20th century, collectivism, Development criticism, John Henry Mackay, Benoît Broutchoux, Illegalism, Laozi, feminist, Christiaan Cornelissen, Syndicalist Workers' Federation, anarcho-syndicalism, Andalusia, Renzo Novatore, trade union, autonomist marxism, dictatorship of the proletariat, Mujeres Libres, Voltairine de Cleyre, Post-anarchism, participatory economics, Confederación Nacional del Trabajo, Syncretic politics, direct democracy, Jean-Jacques Rousseau, Green anarchism, Surrealism, labour unions, A. S. Neill, christian anarchist, Bonnot Gang, Anti-capitalism, Anarchism in Brazil, simple living, enlightened self-interest, Confédération générale du travail, class conflict, International Workers' Day, Hébertists, Gerrard Winstanley, Francoism, anarcho-pacifist, Andrej Grubacic, individualist anarchist and social anarchist thinkers., April Carter, private property, penal colonies, Libertarian socialism, Camillo Berneri, Christian anarchism, transhumanism, Lucifer, the Light-Bearer, Edna St. Vincent Millay, unschooling, Leo Tolstoy, M. E. Lazarus, Spanish Anarchists, Buddhist anarchism, ideology, William McKinley, anarcho-primitivism, Francesc Pi i Margall, :Category:Anarchism by country, International Workers Association, Anarcho-capitalism, Lois Waisbrooker, wikt:Solidarity, Baja California, social revolution, Unione Sindacale Italiana, Lev Chernyi, Alex Comfort, Sonnenburg, Leon Czolgosz, Volin, utopian, Argentine Libertarian Federation, Nudism, Left-wing market anarchism, insurrection, definitional concerns in anarchist theory, infinitive, affinity group, World Trade Organization Ministerial Conference of 1999 protest activity, class struggle, nonviolence, John Zerzan, poststructuralist, Noam Chomsky, Second Fitna, Julian Beck, Philadelphes, League of Peace and Freedom, Fédération Anarchiste, Kronstadt rebellion, Cold War, André Breton, Silvio Gesell, libertarian anarchism, voluntary association, anti-globalisation movement, birth control, L. Susan Brown, anarcho-naturism, personal property, Roundhead, Harold Barclay, The Joy of Sex, Council communism, Lucía Sánchez Saornil, tyrannicide, Neopaganism, lois scélérates, Johann Most, Anarchist Catalonia, Albert Camus, Protests of 1968, Alexander II of Russia, Spain's economy, Federazione Anarchica Italiana, Cuba, German Revolution of 1918–1919, stirner, Property is theft, Situationist International, law and economics
- Read this field from the
-
-
Add support for SMART notation for
TfidfModel
. Fix #1785 (@markroxor, #1791)- Natural extension of
TfidfModel
to allow different weighting and normalization schemesfrom gensim.corpora import Dictionary from gensim.models import TfidfModel import gensim.downloader as api data = api.load("text8") dct = Dictionary(data) corpus = [dct.doc2bow(line) for line in data] # Train Tfidf model using the SMART notation, smartirs="ntc" where # 'n' - natural term frequency # 't' - idf document frequency # 'c' - cosine normalization # # More information about possible values available in documentation or https://nlp.stanford.edu/IR-book/html/htmledition/document-and-query-weighting-schemes-1.html model = TfidfModel(corpus, id2word=dct, smartirs="ntc") vectorized_corpus = list(model[corpus])
- SMART Information Retrieval System (wiki)
- Natural extension of
-
Add CircleCI for building Gensim documentation. Fix #1807 (@menshikh-iv, #1822)
- An easy way to preview the rendered documentation (especially, if don't use Linux)
- Go to "Details" link of CircleCI in your PR, click on the "Artifacts" tab, choose the HTML file that you want to view; a new tab will open with the rendered HTML page
- Integration with Github, to see the documentation directly from the pull request page
- Install a user-script plugin: greasemonkey (for firefox) or tampermonkey (for chrome)
- Add this user-script to the plugin
- Now you’ll see a new button "See CircleCI doc for this PR" in each PR in the Gensim repository. Click it to see the full rendered documentation.
- An easy way to preview the rendered documentation (especially, if don't use Linux)
🔴 Bug fixes:
- Fix import in
get_my_ip
. Fix #1771 (@darindf, #1772) - Fix tox.ini/setup.cfg configuration (@menshikh-iv, #1815)
- Fix formula in
gensim.summarization.bm25
. Fix #1828 (@sj29-innovate, #1833) - Fix the train method of
TranslationMatrix
(@robotcator, #1838) - Fix positional params used for
gensim.models.CoherenceModel
ingensim.models.callbacks
(@Alexjmsherman, #1823) - Fix parameter setting for
FastText.train
. Fix #1818 (@sj29-innovate, #1837) - Pin python2 explicitly for building documentation (@menshikh-iv, #1840)
- Remove dispatcher deadlock for distributed LDA (@darindf, #1817)
- Fix
score_function
fromLexicalEntailmentEvaluation
. Fix #1858 (@hachibaka, #1863) - Fix symmetrical case for hellinger distance. Fix #1854 (@caiyulun, #1860)
- Remove wrong logging at import. Fix #1706 (@menshikh-iv, #1871)
📚 Tutorial and doc improvements:
- Refactor documentation API Reference for
gensim.summarization
(@yurkai & @menshikh-iv, #1709) - Fix docstrings for
gensim.similarities.index
. Partial fix #1666 (@menshikh-iv, #1681) - Fix docstrings for
gensim.models.translation_matrix
(@KokuKUSIAKU & @menshikh-iv, #1806) - Fix docstrings for
gensim.models.rpmodel
(@jazzmuesli & @menshikh-iv, #1802) - Fix docstrings for
gensim.utils
(@kakshay21 & @menshikh-iv, #1797) - Fix docstrings for
gensim.matutils
(@Cheukting & @menshikh-iv, #1804) - Fix docstrings for
gensim.models.logentropy_model
(@minggli & @menshikh-iv, #1803) - Fix docstrings for
gensim.models.normmodel
(@AustenLamacraft & @menshikh-iv, #1805) - Refactor API reference
gensim.topic_coherence
. Fix #1669 (@CLearERR & @menshikh-iv, #1714) - Fix documentation for
gensim.corpora.dictionary
andgensim.corpora.hashdictionary
. Partial fix #1671 (@CLearERR & @menshikh-iv, #1814) - Fix documentation for
gensim.corpora
. Partial fix #1671 (@anotherbugmaster & @menshikh-iv, #1729) - Update banner in doc pages (@piskvorky, #1865)
- Fix errors in the doc2vec-lee notebook (@PeterHamilton, #1841)
- Add wordnet mammal train file for Poincare notebook (@jayantj, #1781)
- Update Poincare notebooks (#1774) (@jayantj, #1774)
- Update contributing guide. Fix #1786 (@menshikh-iv, #1793)
- Add
model_to_dict
one-liner to word2vec notebook. Fix #1269 (@kakshay21, #1776) - Add word embedding viz to word2vec notebook. Fix #1419 (@markroxor, #1800)
- Fix description of
sg
parameter forgensim.models.FastText
(@akutuzov, #1801) - Fix typo in
doc2vec-IMDB
. Fix #1788 (@apoorvaeternity, #1796) - Remove outdated bz2 examples from tutorials[2] (@menshikh-iv, #1868)
- Remove outdated
bz2
+MmCorpus
examples from tutorials (@menshikh-iv, #1867)
👍 Improvements:
-
Remove
gensim.models.wrappers.fasttext
(obsoleted by the new nativegensim.models.fasttext
implementation)gensim.examples
gensim.nosy
gensim.scripts.word2vec_standalone
gensim.scripts.make_wiki_lemma
gensim.scripts.make_wiki_online
gensim.scripts.make_wiki_online_lemma
gensim.scripts.make_wiki_online_nodebug
gensim.scripts.make_wiki
(all of these obsoleted by the new nativegensim.scripts.segment_wiki
implementation)- "deprecated" functions and attributes
-
Move
gensim.scripts.make_wikicorpus
➡gensim.scripts.make_wiki.py
gensim.summarization
➡gensim.models.summarization
gensim.topic_coherence
➡gensim.models._coherence
gensim.utils
➡gensim.utils.utils
(old imports will continue to work)gensim.parsing.*
➡gensim.utils.text_utils
3.2.0, 2017-12-09
🌟 New features:
-
New download API for corpora and pre-trained models (@chaitaliSaini & @menshikh-iv, #1705 & #1632 & #1492)
- Download large NLP datasets in one line of Python, then use with memory-efficient data streaming:
import gensim.downloader as api for article in api.load("wiki-english-20171001"): pass
- Don’t waste time searching for good word embeddings, use the curated ones we included:
import gensim.downloader as api model = api.load("glove-twitter-25") model.most_similar("engineer") # [('specialist', 0.957542896270752), # ('developer', 0.9548177123069763), # ('administrator', 0.9432312846183777), # ('consultant', 0.93915855884552), # ('technician', 0.9368376135826111), # ('analyst', 0.9342101216316223), # ('architect', 0.9257484674453735), # ('engineering', 0.9159940481185913), # ('systems', 0.9123805165290833), # ('consulting', 0.9112802147865295)]
- Blog post introducing the API and design decisions.
- Notebook with examples
- Download large NLP datasets in one line of Python, then use with memory-efficient data streaming:
-
New model: Poincaré embeddings (@jayantj, #1696 & #1700 & #1757 & #1734)
- Embed a graph (taxonomy) in the same way as word2vec embeds words:
from gensim.models.poincare import PoincareRelations, PoincareModel from gensim.test.utils import datapath data = PoincareRelations(datapath('poincare_hypernyms.tsv')) model = PoincareModel(data) model.kv.most_similar("cat.n.01") # [('kangaroo.n.01', 0.010581353439700418), # ('gib.n.02', 0.011171531439892076), # ('striped_skunk.n.01', 0.012025106076442395), # ('metatherian.n.01', 0.01246679759214648), # ('mammal.n.01', 0.013281303506525968), # ('marsupial.n.01', 0.013941330203709653)]
- Tutorial notebook on Poincaré embeddings
- Model introduction and the journey of its implementation
- Original paper on arXiv
- Embed a graph (taxonomy) in the same way as word2vec embeds words:
-
Optimized FastText (@manneshiva, #1742)
- New fast multithreaded implementation of FastText, natively in Python/Cython. Deprecates the existing wrapper for Facebook’s C++ implementation.
import gensim.downloader as api from gensim.models import FastText model = FastText(api.load("text8")) model.most_similar("cat") # [('catnip', 0.8538144826889038), # ('catwalk', 0.8136177062988281), # ('catchy', 0.7828493118286133), # ('caf', 0.7826495170593262), # ('bobcat', 0.7745151519775391), # ('tomcat', 0.7732658386230469), # ('moat', 0.7728310823440552), # ('caye', 0.7666271328926086), # ('catv', 0.7651021480560303), # ('caveat', 0.7643581628799438)]
- New fast multithreaded implementation of FastText, natively in Python/Cython. Deprecates the existing wrapper for Facebook’s C++ implementation.
-
Binary pre-compiled wheels for Windows, OSX and Linux (@menshikh-iv, MacPython/gensim-wheels/#7)
- Users no longer need to have a C compiler for using the fast (Cythonized) version of word2vec, doc2vec, etc.
- Faster Gensim pip installation
-
Added
DeprecationWarnings
to deprecated methods and parameters, with a clear schedule for removal.
👍 Improvements:
- Add Montemurro and Zanette's entropy based keyword extraction algorithm. Fix #665 (@PeteBleackley, #1738)
- Fix flake8 E731, E402, refactor tests & sklearn API code. Partial fix #1644 (@horpto, #1689)
- Reduce distribution size. Fix #1698 (@menshikh-iv, #1699)
- Improve
scan_vocab
speed,build_vocab_from_freq
method (@jodevak, #1695) - Improve
segment_wiki
script (@piskvorky, #1707) - Add custom
dtype
support forLdaModel
. Partially fix #1576 (@xelez, #1656) - Add
doc2idx
method forgensim.corpora.Dictionary
. Fix #1634 (@roopalgarg, #1720) - Add tox and pytest to gensim, integration with Travis and Appveyor. Fix #1613, #1644 (@menshikh-iv, #1721)
- Add flag for hiding outdated data for
gensim.downloader.info
(@menshikh-iv, #1736) - Add reproducible order between python versions for
gensim.corpora.Dictionary
(@formi23, #1715) - Update
tox.ini
,setup.cfg
,README.md
(@menshikh-iv, #1741) - Add custom
logsumexp
forLdaModel
(@arlenk, #1745)
🔴 Bug fixes:
- Fix ranking formula in
gensim.summarization.bm25
. Fix #1718 (@souravsingh, #1726) - Fixed incompatibility in persistence for
FastText
wrapper. Fix #1642 (@chinmayapancholi13, #1723) - Fix
gensim.sklearn_api
bug withdocuments_columns
parameter. Fix #1676 (@chinmayapancholi13, #1704) - Fix slowdown of CI, remove pytest-cov (@menshikh-iv, #1728)
- Replace outdated packages in Dockerfile (@rbahumi, #1730)
- Replace
num_words
totopn
inLdaMallet.show_topics
. Fix #1747 (@apoorvaeternity, #1749) - Fix
os.rename
fromgensim.downloader
when 'src' and 'dst' on different partitions (@anotherbugmaster, #1733) - Fix
DeprecationWarning
fromlogsumexp
(@dreamgonfly, #1703) - Fix backward compatibility problem in
Phrases.load
. Fix #1751 (@alexgarel, #1758) - Fix
load_word2vec_format
fromFastText
. Fix #1743 (@manneshiva, #1755) - Fix ipython kernel version in
Dockerfile
. Fix #1762 (@rbahumi, #1764) - Fix writing in
segment_wiki
(@horpto, #1763) - Fix write method of file requires byte-like object in
segment_wiki
(@horpto, #1750) - Fix incorrect vectors learned during online training for
FastText
. Fix #1752 (@manneshiva, #1756) - Fix
dtype
ofmodel.wv.syn0_vocab
on updatingvocab
forFastText
. Fix #1759 (@manneshiva, #1760) - Fix hashing-trick from
FastText.build_vocab
. Fix #1765 (@manneshiva, #1768) - Add explicit
DeprecationWarning
for all outdated stuff. Fix #1753 (@menshikh-iv, #1769) - Fix epsilon according to
dtype
inLdaModel
(@menshikh-iv, #1770)
📚 Tutorial and doc improvements: