我不知道为什么收到这条消息
WARN KMeans: The input data is not directly cached, which may hurt performance if its parent RDDs are also uncached.
当我尝试使用Spark KMeans时
df_Part = assembler.transform(df_Part)
df_Part.cache()
while (k<=max_cluster) and (wssse > seuilStop):
kmeans = KMeans().setK(k)
model = kmeans.fit(df_Part)
wssse = model.computeCost(df_Part)
k=k+1
它说我的输入(Dataframe)没有被缓存!
我试图打印df_Part.is_cached并且我收到了True,这意味着我的数据帧被缓存了,那么为什么Spark仍然警告我这个呢?
最佳答案 此消息由o.a.s.mllib.clustering.KMeans生成,如果不修补Spark代码,您就无法真正了解它.
内部o.a.s.ml.clustering.KMeans:
>将DataFrame转换为RDD [o.a.s.mllib.linalg.Vector].
>执行o.a.s.mllib.clustering.KMeans.
在缓存DataFrame时,内部使用的RDD不会被缓存.这就是你看警告的原因.虽然很烦人但我不会太担心它.