title: How Could One Implement the K-Means++ Algorithm?
body: <p>I am having trouble fully understanding the <a href="https://en.wikipedia.org/wiki/K-means%2B%2B" rel="nofollow noreferrer">K-Means++ algorithm</a>.  I am interested exactly how the first <code>k</code> centroids are picked, namely the initialization as the rest is like in the original <a href="https://en.wikipedia.org/wiki/K-means_clustering" rel="nofollow noreferrer">K-Means algorithm</a>.</p>
  
  <ol>
  <li>Is the probability function used based on distance or Gaussian? </li>
  <li>In the same time the most long distant point (From the other centroids) is picked for a new centroid.</li>
  </ol>
  
  <p>I will appreciate a step by step explanation and an example.  The one in <a href="https://en.wikipedia.org/wiki/K-means%2B%2B" rel="nofollow noreferrer">Wikipedia</a> is not clear enough.  Also a very well commented source code would also help.  If you are using 6 arrays then please tell us which one is for what.</p>