<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * This source code is licensed under the BSD+Patents license found in the</span></div>
<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// -*- c++ -*-</span></div>
<divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment">/** Class for the clustering parameters. Can be passed to the</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment"> * constructor of the Clustering object.</span></div>
<divclass="line"><aname="l00026"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a11a049c40c376c57ac6cc3b8d5d1d58b"> 26</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="l00029"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#ad997fb511f574f7ddc69938c21612f8d"> 29</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="l00030"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a27d6192097920fa981cff0acedfaac91"> 30</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="l00032"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a5af907901147a9b1e748b13305839924"> 32</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="l00033"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a993e0a035248faad6e292a5ef9af1953"> 33</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="l00035"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1ClusteringParameters.html#a509c65e2ebe6ecabebd163ecb03c5579"> 35</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="l00042"></a><spanclass="lineno"> 42</span> <spanclass="comment">/** clustering based on assignment - centroid update iterations</span></div>
<divclass="line"><aname="l00044"></a><spanclass="lineno"> 44</span> <spanclass="comment"> * The clustering is based on an Index object that assigns training</span></div>
<divclass="line"><aname="l00045"></a><spanclass="lineno"> 45</span> <spanclass="comment"> * points to the centroids. Therefore, at each iteration the centroids</span></div>
<divclass="line"><aname="l00046"></a><spanclass="lineno"> 46</span> <spanclass="comment"> * are added to the index.</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment"> * On output, the centoids table is set to the latest version</span></div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span> <spanclass="comment"> * of the centroids and they are also added to the index. If the</span></div>
<divclass="line"><aname="l00050"></a><spanclass="lineno"> 50</span> <spanclass="comment"> * centroids table it is not empty on input, it is also used for</span></div>
<divclass="line"><aname="l00053"></a><spanclass="lineno"> 53</span> <spanclass="comment"> * To do several clusterings, just call train() several times on</span></div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment"> * different training sets, clearing the centroid table in between.</span></div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Clustering.html#afbf6efacae54c58586b75ed790facd74"> 58</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="l00059"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Clustering.html#a87581785d9516c683bbc7c9392bfa993"> 59</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="l00068"></a><spanclass="lineno"> 68</span> <spanclass="comment"> /// the only mandatory parameters are k and d</span></div>
<divclass="line"><aname="l00072"></a><spanclass="lineno"> 72</span> <spanclass="comment"> /// Index is used during the assignment stage</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</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#l00026">Clustering.h:26</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#l00039">Clustering.cpp:39</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#l00059">Clustering.h:59</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#l00035">Clustering.h:35</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#l00032">Clustering.h:32</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#l00062">Index.h:62</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#l00058">Clustering.h:58</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#l00030">Clustering.h:30</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#l00066">Clustering.cpp:66</a></div></div>
<divclass="ttc"id="structfaiss_1_1ClusteringParameters_html_ad997fb511f574f7ddc69938c21612f8d"><divclass="ttname"><ahref="structfaiss_1_1ClusteringParameters.html#ad997fb511f574f7ddc69938c21612f8d">faiss::ClusteringParameters::spherical</a></div><divclass="ttdeci">bool spherical</div><divclass="ttdoc">do we want normalized centroids? </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00029">Clustering.h:29</a></div></div>
<divclass="ttc"id="structfaiss_1_1ClusteringParameters_html_a993e0a035248faad6e292a5ef9af1953"><divclass="ttname"><ahref="structfaiss_1_1ClusteringParameters.html#a993e0a035248faad6e292a5ef9af1953">faiss::ClusteringParameters::max_points_per_centroid</a></div><divclass="ttdeci">int max_points_per_centroid</div><divclass="ttdoc">to limit size of dataset </div><divclass="ttdef"><b>Definition:</b><ahref="Clustering_8h_source.html#l00033">Clustering.h:33</a></div></div>