# How to collect data which exists centre or border of the cluster?

After applying clustering algorithm I need to extract those data which exists centre of the cluster and which exists border of the cluster. How could I do this by using python.

I use k-means clustering algorithm and divide those data into 19 cluster. I am also using scikit learn library.

Edited:

Here's my plot after clustering:

• Can you share a plot of your data?We might need to manually trim the data(not quite sure) as we will have different centroids coordinates.. – Aditya Feb 25 '18 at 17:36
• As I am new in clustering and I have 682 instances with 35 features that's why I don't know how I can plot? If I provides centroids willbe it helpful ? – IS2057 Feb 25 '18 at 17:44

You can use numpy.where documentation can be fouind here : https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.where.html

You can define a function to extract your data ID somthing like this

def ClusterIndicesNumpy(clustNum, labels_array):
return np.where(labels == cluster)[0]


To get samples from cluster 3 for example:

ClusterIndicesNumpy(3, km.labels_)

• I need those data in every(19) cluster that are very close to the centre. By using numpy.where how could I identify those data ? – IS2057 Feb 26 '18 at 18:05