Is there a way to constrain a particular data point to a cluster with SciKit K Means or other clustering method?

101 Views Asked by At

I am using SciKit K Means cluster_centres_ method to give me a "centre of gravity" for weighted data points. I would like to be able to restrict a subset of data points to a particular cluster and have that affect the centre location. Is there a way to do this by preventing certain values from being attributed to the nearest cluster by default?

1

There are 1 best solutions below

0
ASH On

You should probably try DBSCAN, and see if it does what you want. Here is a link to several clustering algos.

https://machinelearningmastery.com/clustering-algorithms-with-python/

Just choose the model you want, fit it, and interpret the output.

Similar to the link above, you can test several clustering models using the sample code from the link below.

https://github.com/ASH-WICUS/Notebooks/blob/master/Clustering%20Algorithms%20Compared.ipynb