Pages

Thursday, July 31, 2014

k-means clustering algorithm

k-means clustering is popular method for partitioning a set of observations into k clusters such that each observation belongs to cluster with the nearest mean. It is an unsupervised method.

Algorithm:
The most common k-means algorithm repeatedly does these steps until convergence
Assignment step: Determine the centroid coordinates. Assign each observation to the centroid whose means yields the least within-cluster sum of squares.
Update step: Recalculate the new means to be the centroids of the observations assigned to the clusters.

I used iris data set from UCI machine learning repository to implement k-means algorithm in R. Here is the code in R.



The cluster plot is shown below:

1 comment:

  1. Casino - Mapyro
    Casino is a 100% smoke free casino in Reno with 24/7 Live Chat, video poker, 안성 출장마사지 3D and 태백 출장마사지 in the office. 경주 출장샵 Find reviews, 포천 출장마사지 compare 대구광역 출장안마 customer ratings, see screenshots,

    ReplyDelete