title: Refitting clusters around fixed centroids
body: <p>Clustering/classification problem:
  Used k-means clustering to generate these clusters and centroids:</p>
  
  <p>This is the dataset with the added cluster attribute from the initial run:  </p>
  
  <pre><code>  &gt; dput(sampledata)
      structure(list(Player = structure(1:5, .Label = c("A", "B", "C", 
      "D", "E"), class = "factor"), Metric.1 = c(0.3938961, 0.28062338, 
      0.32532626, 0.29239642, 0.25622558), Metric.2 = c(0.00763359, 
      0.01172354, 0.40550867, 0.04026846, 0.05976367), Metric.3 = c(0.50766075, 
      0.20345662, 0.06267444, 0.08661417, 0.17588925), cluster = c(1L, 
      2L, 3L, 2L, 2L)), .Names = c("Player", "Metric.1", "Metric.2", 
      "Metric.3", "cluster"), row.names = c(NA, -5L), class = "data.frame")
  </code></pre>
  
  <hr>
  
  <p>These are the cluster details ran off the 3 metrics:</p>
  
  <pre><code>&gt; dput (scluster)
  structure(list(cluster = c(1L, 2L, 3L, 2L, 2L), centers = structure(c(0.3938961, 
  0.276415126666667, 0.32532626, 0.00763359, 0.03725189, 0.40550867, 
  0.50766075, 0.155320013333333, 0.06267444), .Dim = c(3L, 3L), .Dimnames = list(
      c("1", "2", "3"), c("Metric.1", "Metric.2", "Metric.3"))), 
      totss = 0.252759813332907, withinss = c(0, 0.00930902482096013, 
      0), tot.withinss = 0.00930902482096013, betweenss = 0.243450788511947, 
      size = c(1L, 3L, 1L), iter = 1L, ifault = 0L), .Names = c("cluster", 
  "centers", "totss", "withinss", "tot.withinss", "betweenss", 
  "size", "iter", "ifault"), class = "kmeans")
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/OqljU.jpg" rel="nofollow">Data with cluster attribute and centroids</a></p>
  
  <p>I aim to find a way to fix these centroids after the first cluster run for each cluster, such that these centroids can be used as fixed future references to see how these players move in and out of these clusters to different clusters if their metrics change, thereby tracking their progress or regress.</p>
  
  <p>Specifically, if player A has changes in metrics such that it now resembles cluster 2 rather than 1, based on the Euclidean distance from the respective fixed centroids, I should be able to see player A move to cluster 2. This would mean the data points were refitted around these initially fixed centroids obtained from the first run.</p>
  
  <p>This should help users to know how to approach such a data mining problem. Any pointers would be greatly appreciated! Thank you.</p>