Differences Between KMeans and KMedoids algorithms.
Installing sklearn-extra.
Imports.
First, create a random sample of 2-d points. Add a single outlier far from every other point in the sample.
Initialize a KMeans function and a KMedoids function. I'm using the ones from SKLearn and SKLearn_extra.
Plot the clusters resulting from each clustering algorithm.
Results
The KMeans() algorithm places the outlier into a cluster containing only itself, and sorts the remaining points into three distinct clusters. The KMedoids() algorithm puts the outlier into a cluster with the central points that are closest to it, rather than placing it into its own distinct group.