我不知道为什么会收到消息
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
不会被缓存。这就是您看到警告的原因。虽然这很烦人,但我不会太担心它。
关于python - 派斯帕克 2 : KMeans The input data is not directly cached,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40406166/