Getting centroid vector
Closed this issue · 2 comments
underfitting commented
Hi,
Is there any function to get centroid vector which is not encoded with encoder?
matsui528 commented
Hi,
You mean reconstructing centers from PQ-codes to the original vectors after the clustering is finished? Then the codes will be:
# Run clustering
kmeans = pqkmeans.clustering.PQKMeans(encoder=encoder, k=5)
kmeans.fit_predict(X_pqcode)
# Need to convert from list to np.array
centers_pqcodes = np.array(kmeans.cluster_centers_, dtype=encoder.code_dtype)
# PQ-codes -> D-dim vectors
centers = encoder.inverse_transform(centers_pqcodes)
See the tutorial as well: https://github.com/DwangoMediaVillage/pqkmeans/blob/master/tutorial/1_pqkmeans.ipynb
underfitting commented
It works! Thank you.