K-Means Clustering
The k-means algorithm takes a bunch of unlabeled points and tries to group them into âkâ number of clusters.
The âkâ in k-means denotes the number of clusters you want to have in the end. If k = 5, you will have 5 clusters on the data set.
How it works?
Determine K value by Elbow method and specify the number of clusters K
Randomly assign each data point to a cluster
Determine the cluster centroid coordinates
Determine the distances of each data point to the centroids and re-assign each point to the closest cluster centroid based upon minimum distance
Calculate cluster centroids again
Repeat steps 4 and 5 until we reach global optima where no improvements are possible and no switching of data points from one cluster to other.
Quick Run
Import necessary Python packages
Define a list containing the distance and the score of similarity in expression profile between the 2 genes
Implementation of K-Means Clustering
Accuracy estimates Define a list with know answer if the gene pair belongs to the same operon (1) or different operons (0)
Compare cluster labels with know answer
Traditional Approach
Import necessary Python packages
Define a list containing the distance and the score of similarity in expression profile between the 2 genes
Find out the optimal number of clusters using the elbow method
Implementation of K-Means Clustering
Accuracy estimates Define a list with know answer if the gene pair belongs to the same operon (1) or different operons (0)
Compare cluster labels with know answer
Last updated
Was this helpful?