<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * This source code is licensed under the CC-by-NC license found in the</span></div>
<divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved</span></div>
<divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment">// -*- c++ -*-</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment">/** Class for the clustering parameters. Can be passed to the</span></div>
<divclass="line"><aname="l00023"></a><spanclass="lineno"> 23</span> <spanclass="comment"> * constructor of the Clustering object.</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a11a049c40c376c57ac6cc3b8d5d1d58b"> 27</a></span> <spanclass="comment"></span><spanclass="keywordtype">int</span><aclass="code"href="structfaiss_1_1ClusteringParameters.html#a11a049c40c376c57ac6cc3b8d5d1d58b">nredo</a>; <spanclass="comment">///< redo clustering this many times and keep best</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#ad997fb511f574f7ddc69938c21612f8d"> 30</a></span> <spanclass="keywordtype">bool</span><aclass="code"href="structfaiss_1_1ClusteringParameters.html#ad997fb511f574f7ddc69938c21612f8d">spherical</a>; <spanclass="comment">///< do we want normalized centroids?</span></div>
<divclass="line"><aname="l00031"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a27d6192097920fa981cff0acedfaac91"> 31</a></span> <spanclass="comment"></span><spanclass="keywordtype">bool</span><aclass="code"href="structfaiss_1_1ClusteringParameters.html#a27d6192097920fa981cff0acedfaac91">update_index</a>; <spanclass="comment">///< update index after each iteration?</span></div>
<divclass="line"><aname="l00033"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a5af907901147a9b1e748b13305839924"> 33</a></span> <spanclass="keywordtype">int</span><aclass="code"href="structfaiss_1_1ClusteringParameters.html#a5af907901147a9b1e748b13305839924">min_points_per_centroid</a>; <spanclass="comment">///< otherwise you get a warning</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a993e0a035248faad6e292a5ef9af1953"> 34</a></span> <spanclass="comment"></span><spanclass="keywordtype">int</span><aclass="code"href="structfaiss_1_1ClusteringParameters.html#a993e0a035248faad6e292a5ef9af1953">max_points_per_centroid</a>; <spanclass="comment">///< to limit size of dataset</span></div>
<divclass="line"><aname="l00036"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a509c65e2ebe6ecabebd163ecb03c5579"> 36</a></span> <spanclass="keywordtype">int</span><aclass="code"href="structfaiss_1_1ClusteringParameters.html#a509c65e2ebe6ecabebd163ecb03c5579">seed</a>; <spanclass="comment">///< seed for the random number generator</span></div>
<divclass="line"><aname="l00043"></a><spanclass="lineno"> 43</span> <spanclass="comment">/** clustering based on assignment - centroid update iterations</span></div>
<divclass="line"><aname="l00045"></a><spanclass="lineno"> 45</span> <spanclass="comment"> * The clustering is based on an Index object that assigns training</span></div>
<divclass="line"><aname="l00046"></a><spanclass="lineno"> 46</span> <spanclass="comment"> * points to the centroids. Therefore, at each iteration the centroids</span></div>
<divclass="line"><aname="l00047"></a><spanclass="lineno"> 47</span> <spanclass="comment"> * are added to the index.</span></div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span> <spanclass="comment"> * On output, the centoids table is set to the latest version</span></div>
<divclass="line"><aname="l00050"></a><spanclass="lineno"> 50</span> <spanclass="comment"> * of the centroids and they are also added to the index. If the</span></div>
<divclass="line"><aname="l00051"></a><spanclass="lineno"> 51</span> <spanclass="comment"> * centroids table it is not empty on input, it is also used for</span></div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment"> * To do several clusterings, just call train() several times on</span></div>
<divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span> <spanclass="comment"> * different training sets, clearing the centroid table in between.</span></div>
<divclass="line"><aname="l00059"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Clustering.html#afbf6efacae54c58586b75ed790facd74"> 59</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1Clustering.html#afbf6efacae54c58586b75ed790facd74">d</a>; <spanclass="comment">///< dimension of the vectors</span></div>
<divclass="line"><aname="l00060"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Clustering.html#a87581785d9516c683bbc7c9392bfa993"> 60</a></span> <spanclass="comment"></span><spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1Clustering.html#a87581785d9516c683bbc7c9392bfa993">k</a>; <spanclass="comment">///< nb of centroids</span></div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> <spanclass="comment"> /// the only mandatory parameters are k and d</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment"> /// Index is used during the assignment stage</span></div>
<divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment"></span><spanclass="keyword">virtual</span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1Clustering.html#a839f210abb11c7a1c7162e336e0ff9cf">train</a> (idx_t n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span> * x, <aclass="code"href="structfaiss_1_1Index.html">faiss::Index</a>& index);</div>
<divclass="ttc"id="structfaiss_1_1ClusteringParameters_html_a11a049c40c376c57ac6cc3b8d5d1d58b"><divclass="ttname"><ahref="structfaiss_1_1ClusteringParameters.html#a11a049c40c376c57ac6cc3b8d5d1d58b">faiss::ClusteringParameters::nredo</a></div><divclass="ttdeci">int nredo</div><divclass="ttdoc">redo clustering this many times and keep best </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00027">Clustering.h:27</a></div></div>
<divclass="ttc"id="structfaiss_1_1Clustering_html_a2fa90a2681dc42faaf2435e63a5ae9b4"><divclass="ttname"><ahref="structfaiss_1_1Clustering.html#a2fa90a2681dc42faaf2435e63a5ae9b4">faiss::Clustering::Clustering</a></div><divclass="ttdeci">Clustering(int d, int k)</div><divclass="ttdoc">the only mandatory parameters are k and d </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8cpp_source.html#l00040">Clustering.cpp:40</a></div></div>
<divclass="ttc"id="structfaiss_1_1Clustering_html_a87581785d9516c683bbc7c9392bfa993"><divclass="ttname"><ahref="structfaiss_1_1Clustering.html#a87581785d9516c683bbc7c9392bfa993">faiss::Clustering::k</a></div><divclass="ttdeci">size_t k</div><divclass="ttdoc">nb of centroids </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00060">Clustering.h:60</a></div></div>
<divclass="ttc"id="structfaiss_1_1ClusteringParameters_html_a509c65e2ebe6ecabebd163ecb03c5579"><divclass="ttname"><ahref="structfaiss_1_1ClusteringParameters.html#a509c65e2ebe6ecabebd163ecb03c5579">faiss::ClusteringParameters::seed</a></div><divclass="ttdeci">int seed</div><divclass="ttdoc">seed for the random number generator </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00036">Clustering.h:36</a></div></div>
<divclass="ttc"id="structfaiss_1_1ClusteringParameters_html_a5af907901147a9b1e748b13305839924"><divclass="ttname"><ahref="structfaiss_1_1ClusteringParameters.html#a5af907901147a9b1e748b13305839924">faiss::ClusteringParameters::min_points_per_centroid</a></div><divclass="ttdeci">int min_points_per_centroid</div><divclass="ttdoc">otherwise you get a warning </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00033">Clustering.h:33</a></div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_a040c6aed1f224f3ea7bf58eebc0c31a4"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">faiss::Index::idx_t</a></div><divclass="ttdeci">long idx_t</div><divclass="ttdoc">all indices are this type </div><divclass="ttdef"><b>Definition:</b><ahref="Index_8h_source.html#l00064">Index.h:64</a></div></div>
<divclass="ttc"id="structfaiss_1_1Clustering_html_afbf6efacae54c58586b75ed790facd74"><divclass="ttname"><ahref="structfaiss_1_1Clustering.html#afbf6efacae54c58586b75ed790facd74">faiss::Clustering::d</a></div><divclass="ttdeci">size_t d</div><divclass="ttdoc">dimension of the vectors </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00059">Clustering.h:59</a></div></div>
<divclass="ttc"id="structfaiss_1_1ClusteringParameters_html_a27d6192097920fa981cff0acedfaac91"><divclass="ttname"><ahref="structfaiss_1_1ClusteringParameters.html#a27d6192097920fa981cff0acedfaac91">faiss::ClusteringParameters::update_index</a></div><divclass="ttdeci">bool update_index</div><divclass="ttdoc">update index after each iteration? </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00031">Clustering.h:31</a></div></div>
<divclass="ttc"id="structfaiss_1_1Clustering_html_a839f210abb11c7a1c7162e336e0ff9cf"><divclass="ttname"><ahref="structfaiss_1_1Clustering.html#a839f210abb11c7a1c7162e336e0ff9cf">faiss::Clustering::train</a></div><divclass="ttdeci">virtual void train(idx_t n, const float *x, faiss::Index &index)</div><divclass="ttdoc">Index is used during the assignment stage. </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8cpp_source.html#l00067">Clustering.cpp:67</a></div></div>