我想在星火創建一個玩具文件運行一個可再現的代碼現在1.2
# cat data.txt
crazy crazy fox jumped
crazy fox jumped
fox is fast
fox is smart
dog is smart
>> lines = sc.textFile('data.txt', 1);
>> lines.collect()
[
u'crazy crazy fox jumped',
u'crazy fox jumped',
u'fox is fast',
u'fox is smart',
u'dog is smart'
]
from pyspark.mllib.feature import Word2Vec
model = Word2Vec().fit(lines)
,如果我跑dir(model)
輸出
['__class__',
'__del__',
'__delattr__',
'__dict__',
'__doc__',
'__format__',
'__getattribute__',
'__hash__',
'__init__',
'__module__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__weakref__',
'_java_model',
'_sc',
'call',
'findSynonyms',
'transform']
其中最後3的成員方法和getvectors()不是這個的一部分。
來源
2015-08-07 19:23:08
0xF
同樣的問題在這裏。 – 2016-08-26 22:50:41