0

I ran a fuzzy c-means clustering algorithm on a dataset of size (11464, 2622) with 10 clusters and that yields a (10, 11464) size centers with Final fuzzy c-partitioned matrix of size (10, 2622).

My challenge is how to plot assigned clusters, for each data point in my dataset. I tried this below but didnt work.

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])

where u is the partitioned matrix. but I get the error below 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''

Can someone point me on the right direction to get my visualization? Regards

P.S I am following this example here

3
  • What is u? What is the datatype of x and y? Commented Jul 18, 2017 at 5:18
  • @DYZ u is my final partitioned matrix and datatype of x and y is int64. Commented Jul 18, 2017 at 5:20
  • Oh thanks I got the mistake @DYZ the third argument shouldn't be there. Commented Jul 18, 2017 at 5:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.