From a dataset in which I am using PCA and kmeans, I would like to know what are the central objects in each cluster.
What is the best way to describe these objects as iris from my original dataset ?
from sklearn.datasets import load_iris
iris = load_iris()
X = iris.data
y = iris.target
from sklearn.decomposition import PCA
pca = PCA(n_components=2, whiten=True).fit(X)
X_pca = pca.transform(X)
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=3).fit(X_pca)
# I can get the central object from the reduced data but this does not help me describe
# the properties of the center of each cluster
from sklearn.metrics import pairwise_distances_argmin_min
closest, _ = pairwise_distances_argmin_min(kmeans.cluster_centers_, X_pca)
for i in closest:
print X_pca[i]