0

我在具有 10 个簇的大小为 (11464, 2622) 的数据集上运行了模糊 c 均值聚类算法,并产生了一个 (10, 11464) 大小的中心,其最终模糊 c 分区矩阵大小为 (10, 2622)。

我的挑战是如何为我的数据集中的每个数据点绘制分配的集群。我在下面尝试过,但没有奏效。

cluster_membership = np.argmax(u, axis=0)
colors = ['b', 'orange', 'g', 'r', 'c', 'm', 'y', 'k', 'Brown','ForestGreen']

for j in range(10):
  x = data[:, 0]
  y = data[:, 1]
  plt.scatter(x[cluster_membership == j], y[cluster_membership == j], '.', color=colors[j])

其中 u 是分区矩阵。但我收到以下错误ufunc 'sqrt' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

有人可以指出我正确的方向来获得我的可视化吗?问候

PS我在这里按照这个例子

4

0 回答 0