Word2VecModel#
- class pyspark.mllib.feature.Word2VecModel(java_model)[source]#
class for Word2Vec model
Methods
call
(name, *a)Call method of java_model
findSynonyms
(word, num)Find synonyms of a word
Returns a map of words to their vector representations.
load
(sc, path)Load a model from the given path.
save
(sc, path)Save this model to the given path.
transform
(word)Transforms a word to its vector representation
Methods Documentation
- call(name, *a)#
Call method of java_model
- findSynonyms(word, num)[source]#
Find synonyms of a word
New in version 1.2.0.
- Parameters
- wordstr or
pyspark.mllib.linalg.Vector
a word or a vector representation of word
- numint
number of synonyms to find
- wordstr or
- Returns
collections.abc.Iterable
array of (word, cosineSimilarity)
Notes
Local use only
- save(sc, path)#
Save this model to the given path.
New in version 1.3.0.
- transform(word)[source]#
Transforms a word to its vector representation
New in version 1.2.0.
- Parameters
- wordstr
a word
- Returns
pyspark.mllib.linalg.Vector
vector representation of word(s)
Notes
Local use only