Python和SAS中KMeans集群的分配(proc fastclus)不同

2024-05-14 23:19:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用了相同的输入文件。我还检查了变量的标准值。它们是一样的。这意味着输入文件是相同的。然后,我使用下面的Python代码和SAS代码生成了6个集群解决方案。我用SAS集群和Python集群创建了一个交叉表,但它们不一样。我不明白他们为什么不同

from sklearn.cluster import KMeans
km = KMeans(n_clusters=6, max_iter=300)
new = X_data._get_numeric_data().dropna(axis=1)
km.fit(new)
predict=km.predict(new)
X_data['Cluster'] = pd.Series(predict, index=X_data.index)
proc fastclus data= Hydro1.NEW_MATCH_1_FINAL out= Hydro1.NEW_MATCH_1_FINAL_6 maxclusters = 6 maxiter=300 converge=0;
var ACTEMP_PCT
AIDABO_PCT
....
;
run;

enter image description here


Tags: 文件newdataindexmatch集群predictfinal

热门问题