l have a dataset of images with their labels. l put them into a k-means algorithm (as a feature extractor). Now, l would like to use this new representation of images (features extracted from k-means algorithm) as SVM classifier inputs. How can l do that ? Number of cluster k=400 and numbers of images=1000.
However, l just have the vectors of centroids (400 centroids)
l need to get the representation for each image with respect to the centroids.
EDIT1
package update
from sklearn import mixture
gmm = mixture.GMM(n_components=6).fit(X)
Now l would like run k-means with different k=range(50,500), how can l get the distances for each k ? Is is correct to do the following :
K=range(50,500)
KM=[KMeans(n_clusters=k).fit(X) for k in K]
distances = [np.column_stack([np.sum((X - center)**2, axis=1)**0.5 for center in C.cluster_centers_]) for C in KM]