<div dir="ltr">Hi everyone, <div><br></div><div>I was using scikit-learn KMeans algorithm to cluster pretrained word-vectors. There are a few things which I found to be surprising and wanted to get some feedback on. </div><div><br></div><div>- Based upon the 'labels_' assigned to each word-vector (i.e. cluster memberships), I compute every cluster centroid as the average of the word-vectors (corresponding to that cluster). Surprisingly, this seems to be pretty different from the 'cluster_centers_'. Is there anything that I am missing here?</div><div><br></div><div>- I was later using the verbose option to see if the clustering has converged or not. I saw on the console log messages such as <i>"</i><span style="font-family:Helvetica;color:rgb(29,31,34)"><i>center shift 7.994126e-04 within tolerance 1.243425e-06"</i>. It seems that this corresponds to some code in <b>kmeans_elkan.pyx</b> (</span><font color="#1d1f22" face="Helvetica"><a href="https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/cluster/_k_means_elkan.pyx">https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/cluster/_k_means_elkan.pyx</a>). </font></div><div><font color="#1d1f22" face="Helvetica"><br></font></div><div><font color="#1d1f22" face="Helvetica">- Lastly, another thing that seems strange is that I hadn't set the tolerance value. So the default of 1e-4 should have been used. But if you look again at the above log, it says <i>within tolerance 1.<span style="color:rgb(29,31,34);font-family:Helvetica;font-size:small;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">243425e-06 instead of 1e-4. </span></i></font></div><div><font color="#1d1f22" face="Helvetica"><br></font></div><div><font color="#1d1f22" face="Helvetica">It would be great if you can look into this and help me out. </font></div><div><font color="#1d1f22" face="Helvetica"><br></font></div><div><font color="#1d1f22" face="Helvetica">Thank you so much! :)</font></div><div><font color="#1d1f22" face="Helvetica"><br clear="all"></font><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Best,<div>Sidak Pal Singh</div><div>EPFL</div><div><br></div></div></div></div></div></div>
</div></div>