I have a data frame consisting of 12 months of Customer Transaction Level Data. The data is unsupervised. The data is divided into 6 sets of 2 months period each. Taking first period as the base, I am doing cluster analysis and then checking the pattern of those clusters in the next 5 sets of 2 months each. After applying PCA, I used Silhouette Analysis using KMeans to determine the optimum number of clusters. For example, I have 2 clusters applied on KMeans for my data 'PCAData'. The cluster centers I can get from 'cluster_centers_'. Also, I got the two cluster centroid coordinates [x,y] from the 'centers' object.
clusterer = KMeans(n_clusters=2, random_state=10) cluster_labels = clusterer.fit_predict(PCAData) centers = clusterer.cluster_centers_ if clusterVal == 2: cl1 = [centers[:, 0], centers[:, 1]] cl2 = [centers[:, 0], centers[:, 1]] coordinate = [cl1,cl2]
Now, I have the next data frame and I want to perform clustering based on these coordinates from the base period. The objective is to perform clustering with the same coordinate of the base period and to perform cluster analysis (like patterns, growth etc). Can I use Euclidean distance to cluster the data using centers of the base period?
Please help. How can I perform the clustering on the next data frames based on centroids of clusters from the first data frame in python?