<divclass="center"><iframescrolling="no"frameborder="0"src="../../dc/dd4/kohonen__som__topology_8c__incl.svg"width="331"height="124"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight">to store info regarding 3D arrays <ahref="../../d8/db8/structkohonen__array__3d.html#details">More...</a><br/></td></tr>
<trclass="memdesc:gaffe776513b24d84b39af8ab0930fef7f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">shorthand for maximum value <br/></td></tr>
<trclass="memdesc:gac6afabdc09a49a433ee19d8a9486056d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">shorthand for minimum value <br/></td></tr>
<trclass="memitem:gac78022076d889bf2ebfb2c41d4527ceb"><tdclass="memItemLeft"align="right"valign="top">double * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gac78022076d889bf2ebfb2c41d4527ceb">kohonen_data_3d</a> (const struct <aclass="el"href="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a> *arr, int x, int y, int z)</td></tr>
<trclass="memdesc:gac78022076d889bf2ebfb2c41d4527ceb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by: <ahref="../../d1/d6b/group__kohonen__2d.html#gac78022076d889bf2ebfb2c41d4527ceb">More...</a><br/></td></tr>
<trclass="memitem:gaf5ce14f026d6d231bef29161bac2b485"><tdclass="memItemLeft"align="right"valign="top">double </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gaf5ce14f026d6d231bef29161bac2b485">_random</a> (double a, double b)</td></tr>
<trclass="memdesc:gaf5ce14f026d6d231bef29161bac2b485"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Helper function to generate a random number in a given interval. <ahref="../../d1/d6b/group__kohonen__2d.html#gaf5ce14f026d6d231bef29161bac2b485">More...</a><br/></td></tr>
<trclass="memitem:ga6824dc6d973eb3339af7aef5fea78b0c"><tdclass="memItemLeft"align="right"valign="top">int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a> (const char *fname, double **X, int num_points, int num_features)</td></tr>
<trclass="memdesc:ga6824dc6d973eb3339af7aef5fea78b0c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Save a given n-dimensional data martix to file. <ahref="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">More...</a><br/></td></tr>
<trclass="memdesc:ga49d35f68f5d11d8ef6f8cce0d0e7bcba"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Create the distance matrix or <ahref="https://en.wikipedia.org/wiki/U-matrix"target="_blank">U-matrix</a> from the trained weights and save to disk. <ahref="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">More...</a><br/></td></tr>
<trclass="memitem:gadc22d512c00a9f5799ee067f4fb90b4b"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gadc22d512c00a9f5799ee067f4fb90b4b">get_min_2d</a> (double **X, int N, double *val, int *x_idx, int *y_idx)</td></tr>
<trclass="memdesc:gadc22d512c00a9f5799ee067f4fb90b4b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get minimum value and index of the value in a matrix. <ahref="../../d1/d6b/group__kohonen__2d.html#gadc22d512c00a9f5799ee067f4fb90b4b">More...</a><br/></td></tr>
<trclass="memitem:ga83abb572c60d202e100595a989dfe123"><tdclass="memItemLeft"align="right"valign="top">double </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#ga83abb572c60d202e100595a989dfe123">kohonen_update_weights</a> (const double *X, struct <aclass="el"href="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a> *W, double **D, int num_out, int num_features, double alpha, int R)</td></tr>
<trclass="memdesc:ga83abb572c60d202e100595a989dfe123"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Update weights of the SOM using Kohonen algorithm. <ahref="../../d1/d6b/group__kohonen__2d.html#ga83abb572c60d202e100595a989dfe123">More...</a><br/></td></tr>
<trclass="memitem:gacb42eda8af6ebd6a141a34ab00a0b710"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a> (double **X, struct <aclass="el"href="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a> *W, int num_samples, int num_features, int num_out, double alpha_min)</td></tr>
<trclass="memdesc:gacb42eda8af6ebd6a141a34ab00a0b710"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given datset. <ahref="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">More...</a><br/></td></tr>
<trclass="memdesc:adb5ded007be1fd666fab9affe6764018"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <ahref="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018">More...</a><br/></td></tr>
<trclass="memdesc:a1440a7779ac56f47a3f355ce4a8c7da0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test that creates a random set of points distributed in four clusters in 2D space and trains an SOM that finds the topological pattern. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a1440a7779ac56f47a3f355ce4a8c7da0">More...</a><br/></td></tr>
<trclass="memdesc:ad9e25202bb8b481461f932668f249dbc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <ahref="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc">More...</a><br/></td></tr>
<trclass="memdesc:a0283886819c7c140a023582b7269e2d0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test that creates a random set of points distributed in 4 clusters in 3D space and trains an SOM that finds the topological pattern. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a0283886819c7c140a023582b7269e2d0">More...</a><br/></td></tr>
<trclass="memdesc:a5bb02a8322d717ead1b11182c5f02a3a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Creates a random set of points distributed in four clusters in 3D space with centroids at the points. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a">More...</a><br/></td></tr>
<trclass="memdesc:a6d0455dd5c30adda100e95f0423c786e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Test that creates a random set of points distributed in eight clusters in 3D space and trains an SOM that finds the topological pattern. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a6d0455dd5c30adda100e95f0423c786e">More...</a><br/></td></tr>
<trclass="memdesc:a2256c10b16edba377b64a44b6c656908"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Convert clock cycle difference to time in seconds. <ahref="../../d2/df6/kohonen__som__topology_8c.html#a2256c10b16edba377b64a44b6c656908">More...</a><br/></td></tr>
<p>This example implements a powerful unsupervised learning algorithm called as a self organizing map. The algorithm creates a connected network of weights that closely follows the given data points. This thus creates a topological map of the given data i.e., it maintains the relationship between various data points in a much higher dimensional space by creating an equivalent in a 2-dimensional space. <imgsrc="https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/machine_learning/kohonen/2D_Kohonen_SOM.svg"alt="Trained topological maps for the test cases in the program"style="pointer-events: none;"class="inline"/></p><dlclass="section author"><dt>Author</dt><dd><ahref="https://github.com/kvedala"target="_blank">Krishna Vedala</a></dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>MSVC 2019 compiler generates code that does not execute as expected. However, MinGW, Clang for GCC and Clang for MSVC compilers on windows perform as expected. Any insights and suggestions should be directed to the author. </dd></dl>
<divclass="line"><spanclass="lineno"> 696</span> printf(<spanclass="stringliteral">"(Note: Calculated times include: writing files to disk.)\n\n"</span>);</div>
<divclass="ttc"id="akohonen__som__topology_8c_html_a0283886819c7c140a023582b7269e2d0"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#a0283886819c7c140a023582b7269e2d0">test2</a></div><divclass="ttdeci">void test2()</div><divclass="ttdoc">Test that creates a random set of points distributed in 4 clusters in 3D space and trains an SOM that...</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:506</div></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_a1440a7779ac56f47a3f355ce4a8c7da0"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#a1440a7779ac56f47a3f355ce4a8c7da0">test1</a></div><divclass="ttdeci">void test1()</div><divclass="ttdoc">Test that creates a random set of points distributed in four clusters in 2D space and trains an SOM t...</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:406</div></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_a2256c10b16edba377b64a44b6c656908"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#a2256c10b16edba377b64a44b6c656908">get_clock_diff</a></div><divclass="ttdeci">double get_clock_diff(clock_t start_t, clock_t end_t)</div><divclass="ttdoc">Convert clock cycle difference to time in seconds.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:663</div></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_a6d0455dd5c30adda100e95f0423c786e"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#a6d0455dd5c30adda100e95f0423c786e">test3</a></div><divclass="ttdeci">void test3()</div><divclass="ttdoc">Test that creates a random set of points distributed in eight clusters in 3D space and trains an SOM ...</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:609</div></div>
</div><!-- fragment --><divclass="dynheader">
Here is the call graph for this function:</div>
<divclass="dyncontent">
<divclass="center"><divclass="zoom"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.svg"width="100%"height="600"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<p>The following <ahref="https://en.wikipedia.org/wiki/Comma-separated_values"target="_blank">CSV</a> files are created to validate the execution:</p><ul>
<divclass="line"><spanclass="lineno"> 425</span><spanclass="keywordflow">if</span> (i < N) <spanclass="comment">// only add new arrays if i < N</span></div>
<divclass="line"><spanclass="lineno"> 427</span><spanclass="keywordflow">if</span> (i < num_out) <spanclass="comment">// only add new arrays if i < num_out</span></div>
<divclass="line"><spanclass="lineno"> 429</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> k = 0; k < num_out; k++)</div>
<divclass="line"><spanclass="lineno"> 444</span><aclass="code hl_function"href="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018">test_2d_classes</a>(X, N); <spanclass="comment">// create test data around circumference of a circle</span></div>
<divclass="line"><spanclass="lineno"> 445</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a>(<spanclass="stringliteral">"test1.csv"</span>, X, N, features); <spanclass="comment">// save test data points</span></div>
<divclass="line"><spanclass="lineno"> 446</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w11.csv"</span>, &W); <spanclass="comment">// save initial random weights</span></div>
<divclass="line"><spanclass="lineno"> 447</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a>(X, &W, N, features, num_out, 1e-4); <spanclass="comment">// train the SOM</span></div>
<divclass="line"><spanclass="lineno"> 448</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w12.csv"</span>, &W); <spanclass="comment">// save the resultant weights</span></div>
<divclass="ttc"id="agroup__kohonen__2d_html_ga49d35f68f5d11d8ef6f8cce0d0e7bcba"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a></div><divclass="ttdeci">int save_u_matrix(const char *fname, struct kohonen_array_3d *W)</div><divclass="ttdoc">Create the distance matrix or U-matrix from the trained weights and save to disk.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:139</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_ga6824dc6d973eb3339af7aef5fea78b0c"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a></div><divclass="ttdeci">int save_2d_data(const char *fname, double **X, int num_points, int num_features)</div><divclass="ttdoc">Save a given n-dimensional data martix to file.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:102</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gac78022076d889bf2ebfb2c41d4527ceb"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gac78022076d889bf2ebfb2c41d4527ceb">kohonen_data_3d</a></div><divclass="ttdeci">double * kohonen_data_3d(const struct kohonen_array_3d *arr, int x, int y, int z)</div><divclass="ttdoc">Function that returns the pointer to (x, y, z) ^th location in the linear 3D array given by:</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:67</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gacb42eda8af6ebd6a141a34ab00a0b710"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a></div><divclass="ttdeci">void kohonen_som(double **X, struct kohonen_array_3d *W, int num_samples, int num_features, int num_out, double alpha_min)</div><divclass="ttdoc">Apply incremental algorithm with updating neighborhood and learning rates on all samples in the given...</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:314</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gaf5ce14f026d6d231bef29161bac2b485"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gaf5ce14f026d6d231bef29161bac2b485">_random</a></div><divclass="ttdeci">double _random(double a, double b)</div><divclass="ttdoc">Helper function to generate a random number in a given interval.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:87</div></div>
<divclass="ttc"id="agroup__kohonen__2d_html_gaffe776513b24d84b39af8ab0930fef7f"><divclass="ttname"><ahref="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a></div><divclass="ttdeci">#define max(a, b)</div><divclass="ttdoc">shorthand for maximum value</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:39</div></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_adb5ded007be1fd666fab9affe6764018"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#adb5ded007be1fd666fab9affe6764018">test_2d_classes</a></div><divclass="ttdeci">void test_2d_classes(double *const *data, int N)</div><divclass="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:366</div></div>
<divclass="ttc"id="amalloc__dbg_8h_html_a725f50ecaf1959d96de79b36b4788fee"><divclass="ttname"><ahref="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a></div><divclass="ttdeci">#define malloc(bytes)</div><divclass="ttdoc">This macro replace the standard malloc function with malloc_dbg.</div><divclass="ttdef"><b>Definition:</b> malloc_dbg.h:18</div></div>
<divclass="ttc"id="amalloc__dbg_8h_html_a9cc854374299a1dd933bf62029761768"><divclass="ttname"><ahref="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a></div><divclass="ttdeci">#define free(ptr)</div><divclass="ttdoc">This macro replace the standard free function with free_dbg.</div><divclass="ttdef"><b>Definition:</b> malloc_dbg.h:26</div></div>
<divclass="ttc"id="astructkohonen__array__3d_html"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html">kohonen_array_3d</a></div><divclass="ttdoc">to store info regarding 3D arrays</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:48</div></div>
<divclass="ttc"id="astructkohonen__array__3d_html_a16720581653fa9a34d1029e7229a7377"><divclass="ttname"><ahref="../../d8/db8/structkohonen__array__3d.html#a16720581653fa9a34d1029e7229a7377">kohonen_array_3d::dim1</a></div><divclass="ttdeci">int dim1</div><divclass="ttdoc">lengths of first dimension</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:49</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a1440a7779ac56f47a3f355ce4a8c7da0_cgraph.svg"width="616"height="270"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<p>The following <ahref="https://en.wikipedia.org/wiki/Comma-separated_values"target="_blank">CSV</a> files are created to validate the execution:</p><ul>
<divclass="line"><spanclass="lineno"> 525</span><spanclass="keywordflow">if</span> (i < N) <spanclass="comment">// only add new arrays if i < N</span></div>
<divclass="line"><spanclass="lineno"> 527</span><spanclass="keywordflow">if</span> (i < num_out) <spanclass="comment">// only add new arrays if i < num_out</span></div>
<divclass="line"><spanclass="lineno"> 529</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> k = 0; k < num_out; k++)</div>
<divclass="line"><spanclass="lineno"> 543</span><aclass="code hl_function"href="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc">test_3d_classes1</a>(X, N); <spanclass="comment">// create test data</span></div>
<divclass="line"><spanclass="lineno"> 544</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a>(<spanclass="stringliteral">"test2.csv"</span>, X, N, features); <spanclass="comment">// save test data points</span></div>
<divclass="line"><spanclass="lineno"> 545</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w21.csv"</span>, &W); <spanclass="comment">// save initial random weights</span></div>
<divclass="line"><spanclass="lineno"> 546</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a>(X, &W, N, features, num_out, 1e-4); <spanclass="comment">// train the SOM</span></div>
<divclass="line"><spanclass="lineno"> 547</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w22.csv"</span>, &W); <spanclass="comment">// save the resultant weights</span></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_ad9e25202bb8b481461f932668f249dbc"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#ad9e25202bb8b481461f932668f249dbc">test_3d_classes1</a></div><divclass="ttdeci">void test_3d_classes1(double *const *data, int N)</div><divclass="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:465</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a0283886819c7c140a023582b7269e2d0_cgraph.svg"width="623"height="271"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<p>The following <ahref="https://en.wikipedia.org/wiki/Comma-separated_values"target="_blank">CSV</a> files are created to validate the execution:</p><ul>
<divclass="line"><spanclass="lineno"> 626</span><spanclass="keywordflow">if</span> (i < N) <spanclass="comment">// only add new arrays if i < N</span></div>
<divclass="line"><spanclass="lineno"> 628</span><spanclass="keywordflow">if</span> (i < num_out) <spanclass="comment">// only add new arrays if i < num_out</span></div>
<divclass="line"><spanclass="lineno"> 630</span><spanclass="keywordflow">for</span> (<spanclass="keywordtype">int</span> k = 0; k < num_out; k++)</div>
<divclass="line"><spanclass="lineno"> 645</span><aclass="code hl_function"href="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a">test_3d_classes2</a>(X, N); <spanclass="comment">// create test data around the lamniscate</span></div>
<divclass="line"><spanclass="lineno"> 646</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga6824dc6d973eb3339af7aef5fea78b0c">save_2d_data</a>(<spanclass="stringliteral">"test3.csv"</span>, X, N, features); <spanclass="comment">// save test data points</span></div>
<divclass="line"><spanclass="lineno"> 647</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w31.csv"</span>, &W); <spanclass="comment">// save initial random weights</span></div>
<divclass="line"><spanclass="lineno"> 648</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#gacb42eda8af6ebd6a141a34ab00a0b710">kohonen_som</a>(X, &W, N, features, num_out, 0.01); <spanclass="comment">// train the SOM</span></div>
<divclass="line"><spanclass="lineno"> 649</span><aclass="code hl_function"href="../../d1/d6b/group__kohonen__2d.html#ga49d35f68f5d11d8ef6f8cce0d0e7bcba">save_u_matrix</a>(<spanclass="stringliteral">"w32.csv"</span>, &W); <spanclass="comment">// save the resultant weights</span></div>
<divclass="ttc"id="akohonen__som__topology_8c_html_a5bb02a8322d717ead1b11182c5f02a3a"><divclass="ttname"><ahref="../../d2/df6/kohonen__som__topology_8c.html#a5bb02a8322d717ead1b11182c5f02a3a">test_3d_classes2</a></div><divclass="ttdeci">void test_3d_classes2(double *const *data, int N)</div><divclass="ttdoc">Creates a random set of points distributed in four clusters in 3D space with centroids at the points.</div><divclass="ttdef"><b>Definition:</b> kohonen_som_topology.c:564</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a6d0455dd5c30adda100e95f0423c786e_cgraph.svg"width="623"height="271"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><spanclass="lineno"> 368</span><spanclass="keyword">const</span><spanclass="keywordtype">double</span> R = 0.3; <spanclass="comment">// radius of cluster</span></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_adb5ded007be1fd666fab9affe6764018_cgraph.svg"width="248"height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><spanclass="lineno"> 467</span><spanclass="keyword">const</span><spanclass="keywordtype">double</span> R = 0.2; <spanclass="comment">// radius of cluster</span></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_ad9e25202bb8b481461f932668f249dbc_cgraph.svg"width="255"height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><spanclass="lineno"> 566</span><spanclass="keyword">const</span><spanclass="keywordtype">double</span> R = 0.2; <spanclass="comment">// radius of cluster</span></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d2/df6/kohonen__som__topology_8c_a5bb02a8322d717ead1b11182c5f02a3a_cgraph.svg"width="255"height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="../../doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.9.5 </li>