root/doc/html/mog__diag__kmeans_8h-source.html @ 354

Revision 353, 14.0 kB (checked in by smidl, 16 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: mog_diag_kmeans.h Source File</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li><a href="annotated.html"><span>Classes</span></a></li>
56      <li class="current"><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
62      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
63    </ul>
64  </div>
65<h1>mog_diag_kmeans.h</h1><a href="mog__diag__kmeans_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
66<a name="l00030"></a>00030 <span class="preprocessor">#ifndef MOG_DIAG_KMEANS_H</span>
67<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define MOG_DIAG_KMEANS_H</span>
68<a name="l00032"></a>00032 <span class="preprocessor"></span>
69<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="mog__diag_8h.html" title="Diagonal Mixture of Gaussians class - header file.">itpp/stat/mog_diag.h</a>&gt;</span>
70<a name="l00034"></a>00034
71<a name="l00035"></a>00035
72<a name="l00036"></a>00036 <span class="keyword">namespace </span>itpp
73<a name="l00037"></a>00037 {
74<a name="l00038"></a>00038
75<a name="l00043"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html">00043</a> <span class="keyword">class </span><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html" title="support class for MOG_diag_kmeans()">MOG_diag_kmeans_sup</a> : <span class="keyword">public</span> <a class="code" href="classitpp_1_1MOG__diag.html" title="Diagonal Mixture of Gaussians (MOG) class.">MOG_diag</a>
76<a name="l00044"></a>00044 {
77<a name="l00045"></a>00045
78<a name="l00046"></a>00046 <span class="keyword">public</span>:
79<a name="l00048"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#7c39d71b74197769332e6a6faaa2d6b3">00048</a>   <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#7c39d71b74197769332e6a6faaa2d6b3" title="Default constructor.">MOG_diag_kmeans_sup</a>() { <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#ec4092a206d719bb09388e7329069b87" title="Whether we print the progress.">verbose</a> = <span class="keyword">false</span>; }
80<a name="l00049"></a>00049
81<a name="l00051"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#50fb4b3bcdd392fefef740ee27e3f23a">00051</a>   <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#50fb4b3bcdd392fefef740ee27e3f23a" title="Default destructor.">~MOG_diag_kmeans_sup</a>() { }
82<a name="l00052"></a>00052
83<a name="l00054"></a>00054   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#04cf54ca4326b599f0efa5765a442cc8" title="ADD DOCUMENTATION HERE.">run</a>(<a class="code" href="classitpp_1_1MOG__diag.html" title="Diagonal Mixture of Gaussians (MOG) class.">MOG_diag</a> &amp;model_in, <a class="code" href="classitpp_1_1Array.html">Array&lt;vec&gt;</a> &amp;X_in, <span class="keywordtype">int</span> max_iter_in = 10, <span class="keywordtype">double</span> trust_in = 0.5, <span class="keywordtype">bool</span> normalise_in = <span class="keyword">true</span>, <span class="keywordtype">bool</span> verbose_in = <span class="keyword">false</span>);
84<a name="l00055"></a>00055
85<a name="l00056"></a>00056 <span class="keyword">protected</span>:
86<a name="l00057"></a>00057
87<a name="l00059"></a>00059   <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#3e24981c4d249702fa35585d22845bbb" title="ADD DOCUMENTATION HERE.">dist</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> * x, <span class="keyword">const</span> <span class="keywordtype">double</span> * y) <span class="keyword">const</span>;
88<a name="l00061"></a>00061   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#7a626a8e78484aac6bca5e9b936ae24a" title="ADD DOCUMENTATION HERE.">assign_to_means</a>();
89<a name="l00063"></a>00063   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#ebd6357516c76408a33a32ee49fd97b9" title="ADD DOCUMENTATION HERE.">recalculate_means</a>();
90<a name="l00065"></a>00065   <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#213dbe1d954604685d2f1732d24de4bf" title="ADD DOCUMENTATION HERE.">dezombify_means</a>();
91<a name="l00067"></a>00067   <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#c86f312889770d04fb6d350f803ef027" title="ADD DOCUMENTATION HERE.">measure_change</a>() <span class="keyword">const</span>;
92<a name="l00069"></a>00069   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#2eee033b5ac020add5694087485742f3" title="ADD DOCUMENTATION HERE.">initial_means</a>();
93<a name="l00071"></a>00071   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#b12a40a78db6ef6f81eb4d1ae9d14081" title="ADD DOCUMENTATION HERE.">iterate</a>();
94<a name="l00073"></a>00073   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#1f48294377f23e0a68613c6132acf7dd" title="ADD DOCUMENTATION HERE.">calc_means</a>();
95<a name="l00075"></a>00075   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#3ef6c0b7586032fabb725ff383c9a6b9" title="ADD DOCUMENTATION HERE.">calc_covs</a>();
96<a name="l00077"></a>00077   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#fa84d148cc4fa5fd56de3271a46377ca" title="ADD DOCUMENTATION HERE.">calc_weights</a>();
97<a name="l00079"></a>00079   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#316734b9f6fb0969c4803de55a76138c" title="ADD DOCUMENTATION HERE.">normalise_vectors</a>();
98<a name="l00081"></a>00081   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#0632d9a1a0483efd7c712a9e16fecf0b" title="ADD DOCUMENTATION HERE.">unnormalise_vectors</a>();
99<a name="l00083"></a>00083   <span class="keywordtype">void</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#9ac02f645e9f0dab6c44de8da361a80e" title="ADD DOCUMENTATION HERE.">unnormalise_means</a>();
100<a name="l00084"></a>00084
101<a name="l00086"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#bcf0a96ce42fe4b396fa85d61a387408">00086</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#bcf0a96ce42fe4b396fa85d61a387408" title="Maximum number of iterations.">max_iter</a>;
102<a name="l00087"></a>00087
103<a name="l00091"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#c95783a3432e07a655769f0ae7fd2b1e">00091</a>   <span class="keywordtype">double</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#c95783a3432e07a655769f0ae7fd2b1e" title="trust factor, where 0 &amp;lt;= trust &amp;lt;= 1.">trust</a>;
104<a name="l00092"></a>00092
105<a name="l00094"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#ec4092a206d719bb09388e7329069b87">00094</a>   <span class="keywordtype">bool</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#ec4092a206d719bb09388e7329069b87" title="Whether we print the progress.">verbose</a>;
106<a name="l00095"></a>00095
107<a name="l00097"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#26dd35e29b50372e26acb24a439e20cc">00097</a>   <span class="keywordtype">int</span> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#26dd35e29b50372e26acb24a439e20cc" title="number of training vectors">N</a>;
108<a name="l00098"></a>00098
109<a name="l00100"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#28eae984b466fe137e3ee50e8c7dae64">00100</a>   <span class="keywordtype">double</span> ** <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#28eae984b466fe137e3ee50e8c7dae64" title="&amp;#39;C&amp;#39; pointers to training vectors">c_X</a>;
110<a name="l00101"></a>00101
111<a name="l00103"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#33cc1342d365ecbb7b12742086de15ad">00103</a>   <a class="code" href="classitpp_1_1Array.html">Array&lt;vec&gt;</a> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#33cc1342d365ecbb7b12742086de15ad" title="means from the previous iteration, used to measure progress">means_old</a>;
112<a name="l00104"></a>00104
113<a name="l00106"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#a4569601b2ba5ab8783bc128837d4a4f">00106</a>   <span class="keywordtype">double</span> ** <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#a4569601b2ba5ab8783bc128837d4a4f" title="&amp;#39;C&amp;#39; pointers to old means">c_means_old</a>;
114<a name="l00107"></a>00107
115<a name="l00109"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#e9e93615d3daae2f20ae9c6eb5ae7f94">00109</a>   <a class="code" href="classitpp_1_1Array.html">Array&lt;ivec&gt;</a> <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#e9e93615d3daae2f20ae9c6eb5ae7f94" title="contains indices of vectors assigned to each mean">partitions</a>;
116<a name="l00110"></a>00110
117<a name="l00112"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#6e4913f1be0c42b22f0677e1c82c73fc">00112</a>   <span class="keywordtype">int</span> ** <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#6e4913f1be0c42b22f0677e1c82c73fc" title="&amp;#39;C&amp;#39; pointers to partition vectors">c_partitions</a>;
118<a name="l00113"></a>00113
119<a name="l00115"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#d038e9cf1a0da0da4e03b1f8a7f4ee22">00115</a>   ivec <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#d038e9cf1a0da0da4e03b1f8a7f4ee22" title="keeps a count of the number of vectors assigned to each mean">count</a>;
120<a name="l00116"></a>00116
121<a name="l00118"></a><a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#25a878d1c832d4ac9ed82920ce4d9784">00118</a>   <span class="keywordtype">int</span> * <a class="code" href="classitpp_1_1MOG__diag__kmeans__sup.html#25a878d1c832d4ac9ed82920ce4d9784" title="&amp;#39;C&amp;#39; pointer to the count vector">c_count</a>;
122<a name="l00119"></a>00119
123<a name="l00120"></a>00120 <span class="keyword">private</span>:
124<a name="l00121"></a>00121
125<a name="l00122"></a>00122   vec norm_mu;
126<a name="l00123"></a>00123   <span class="keywordtype">double</span> * c_norm_mu;
127<a name="l00124"></a>00124
128<a name="l00125"></a>00125   vec norm_sd;
129<a name="l00126"></a>00126   <span class="keywordtype">double</span> * c_norm_sd;
130<a name="l00127"></a>00127
131<a name="l00128"></a>00128   vec tmpvec;
132<a name="l00129"></a>00129   <span class="keywordtype">double</span> * c_tmpvec;
133<a name="l00130"></a>00130
134<a name="l00131"></a>00131
135<a name="l00132"></a>00132 };
136<a name="l00133"></a>00133
137<a name="l00134"></a>00134 <span class="comment">//</span>
138<a name="l00135"></a>00135 <span class="comment">// convenience functions</span>
139<a name="l00136"></a>00136
140<a name="l00170"></a>00170 <span class="keywordtype">void</span> <a class="code" href="group__MOG.html#gdeb91bf337a38234135d6d402e3143b3">MOG_diag_kmeans</a>(<a class="code" href="classitpp_1_1MOG__diag.html" title="Diagonal Mixture of Gaussians (MOG) class.">MOG_diag</a> &amp;model_in, <a class="code" href="classitpp_1_1Array.html">Array&lt;vec&gt;</a> &amp;X_in, <span class="keywordtype">int</span> max_iter_in = 10, <span class="keywordtype">double</span> trust_in = 0.5, <span class="keywordtype">bool</span> normalise_in = <span class="keyword">true</span>, <span class="keywordtype">bool</span> verbose_in = <span class="keyword">false</span>);
141<a name="l00171"></a>00171
142<a name="l00172"></a>00172 }
143<a name="l00173"></a>00173
144<a name="l00174"></a>00174 <span class="preprocessor">#endif  // #ifndef MOG_DIAG_KMEANS_H</span>
145<a name="l00175"></a>00175 <span class="preprocessor"></span>
146</pre></div></div>
147<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:12 2009 for mixpp by&nbsp;
148<a href="http://www.doxygen.org/index.html">
149<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
150</body>
151</html>
Note: See TracBrowser for help on using the browser.