我想在星火创建一个玩具文件运行一个可再现的代码现在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