Commit 9319c47a authored by Niels-Oliver Walkowski's avatar Niels-Oliver Walkowski
Browse files

upd: Solve wrong gensim version for word2vec model

parent e7961121
......@@ -305,30 +305,30 @@
word2vec_model.wv.most_similar("car", topn=20)
```
%%%% Output: execute_result
[('driver', 0.7839363217353821),
('taxi', 0.7524467706680298),
('cars', 0.725511908531189),
('motorcycle', 0.7036831378936768),
('vehicle', 0.698715090751648),
('truck', 0.6913774609565735),
('passenger', 0.661078155040741),
('automobile', 0.6501474380493164),
('audi', 0.6245964169502258),
('glider', 0.6229903101921082),
('tire', 0.6213281154632568),
('cab', 0.6198135018348694),
('engine', 0.6183426380157471),
('volkswagen', 0.6164752840995789),
('engined', 0.6096624732017517),
('airplane', 0.6076435446739197),
('bmw', 0.6070380210876465),
('elevator', 0.6061339974403381),
('racing', 0.6031301617622375),
('stock', 0.6030023097991943)]
[('driver', 0.7908318638801575),
('taxi', 0.7431166768074036),
('cars', 0.7197413444519043),
('motorcycle', 0.7111701369285583),
('truck', 0.6926654577255249),
('racing', 0.6854234933853149),
('vehicle', 0.6607434749603271),
('passenger', 0.6477780342102051),
('glider', 0.6365007758140564),
('volkswagen', 0.6300870776176453),
('automobile', 0.6175932288169861),
('crash', 0.6141278147697449),
('bmw', 0.6093124151229858),
('rifle', 0.6080166101455688),
('motor', 0.6056495308876038),
('audi', 0.60340416431427),
('racer', 0.598192036151886),
('factory', 0.5972516536712646),
('tire', 0.5950882434844971),
('cab', 0.5927387475967407)]
%% Cell type:markdown id: tags:
Another advantage of word2vec compared to count vectors is that it can capture various concepts and analogies.
Perhaps the most famous example in that regard is as follows: If you subtract the vector of the word *man* from the vector of the word *king* and add the vector of the word *woman* it should result in a vector very close to that of the word *queen*. We can evaluate whether this is the case with our pretrained model through Gensim very easily:
......@@ -339,11 +339,11 @@
word2vec_model.wv.most_similar(positive=["woman", "king"], negative=["man"], topn=1)
```
%%%% Output: execute_result
[('queen', 0.6670934557914734)]
[('queen', 0.7112579345703125)]
%% Cell type:markdown id: tags:
We observe that, indeed, the trained word embedding correctly reflects this analogy.
Can you think of any other concepts or analogies to test? Feel free to try it with other word vectors.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment