Changeset 270 for doc/html/libPF_8h-source.html
- Timestamp:
- 02/16/09 10:02:08 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
doc/html/libPF_8h-source.html
r269 r270 35 35 <a name="l00040"></a><a class="code" href="classbdm_1_1PF.html#c58b8fa634272c3f48845a9020ba55aa">00040</a> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &<a class="code" href="classbdm_1_1PF.html#c58b8fa634272c3f48845a9020ba55aa" title="Observation model.">obs</a>; 36 36 <a name="l00041"></a>00041 <span class="keyword">public</span>: 37 <a name="l00043"></a><a class="code" href="classbdm_1_1PF.html#d f9e7dc54dbe1c78a4aa503c42f7f8c4">00043</a> <a class="code" href="classbdm_1_1PF.html#df9e7dc54dbe1c78a4aa503c42f7f8c4" title="Default constructor.">PF</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &par0, <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &obs0, <span class="keywordtype">int</span> n0 ) :<a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( rv0),38 <a name="l00044"></a>00044 <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ( n0 ),<a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a> ( rv0,<a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ),<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>() ),<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>() ),37 <a name="l00043"></a><a class="code" href="classbdm_1_1PF.html#db2ed4517083f83de9d61750a87274de">00043</a> <a class="code" href="classbdm_1_1PF.html#db2ed4517083f83de9d61750a87274de" title="Default constructor.">PF</a> ( <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &par0, <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &obs0, <span class="keywordtype">int</span> n0 ) :<a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( ), 38 <a name="l00044"></a>00044 <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ( n0 ),<a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a> ( <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ),<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>() ),<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>() ), 39 39 <a name="l00045"></a>00045 <a class="code" href="classbdm_1_1PF.html#cf3a1b2a407012e47ac878e3aa2fbf34" title="Parameter evolution model.">par</a> ( par0 ), <a class="code" href="classbdm_1_1PF.html#c58b8fa634272c3f48845a9020ba55aa" title="Observation model.">obs</a> ( obs0 ) {}; 40 40 <a name="l00046"></a>00046 … … 59 59 <a name="l00074"></a>00074 <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>( ) ), E ( E0 ), <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( E._w() ), 60 60 <a name="l00075"></a>00075 Coms ( <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length() ) { 61 <a name="l00076"></a>00076 <a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a>.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( E._rv() );62 <a name="l00077"></a>00077 <a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a>.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( rvc );61 <a name="l00076"></a>00076 rv.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( E._rv() ); 62 <a name="l00077"></a>00077 rv.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( rvc ); 63 63 <a name="l00078"></a>00078 }; 64 64 <a name="l00079"></a>00079 … … 68 68 <a name="l00083"></a>00083 vec mean()<span class="keyword"> const </span>{ 69 69 <a name="l00084"></a>00084 <span class="comment">// ugly</span> 70 <a name="l00085"></a>00085 vec pom=zeros ( ( Coms ( 0 )-> <a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793" title="access function">_rv</a>() ).count() );70 <a name="l00085"></a>00085 vec pom=zeros ( ( Coms ( 0 )->_rv() ).count() ); 71 71 <a name="l00086"></a>00086 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length(); i++ ) {pom += Coms ( i )->mean() * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i );} 72 72 <a name="l00087"></a>00087 <span class="keywordflow">return</span> <a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a> ( E.mean(),pom ); … … 74 74 <a name="l00089"></a>00089 vec variance()<span class="keyword"> const </span>{ 75 75 <a name="l00090"></a>00090 <span class="comment">// ugly</span> 76 <a name="l00091"></a>00091 vec pom=zeros ( ( Coms ( 0 )-> <a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793" title="access function">_rv</a>() ).count() );77 <a name="l00092"></a>00092 vec pom2=zeros ( ( Coms ( 0 )-> <a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793" title="access function">_rv</a>() ).count() );76 <a name="l00091"></a>00091 vec pom=zeros ( ( Coms ( 0 )->_rv() ).count() ); 77 <a name="l00092"></a>00092 vec pom2=zeros ( ( Coms ( 0 )->_rv() ).count() ); 78 78 <a name="l00093"></a>00093 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length(); i++ ) { 79 79 <a name="l00094"></a>00094 pom += Coms ( i )->mean() * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ); … … 93 93 <a name="l00110"></a>00110 <span class="comment">//</span> 94 94 <a name="l00111"></a>00111 <span class="comment">//TODO test if rv and BMcond.rv are compatible.</span> 95 <a name="l00112"></a>00112 <a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a>.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( rvlin );95 <a name="l00112"></a>00112 <span class="comment">// rv.add ( rvlin );</span> 96 96 <a name="l00113"></a>00113 <span class="comment">//</span> 97 97 <a name="l00114"></a>00114 … … 109 109 <a name="l00126"></a>00126 110 110 <a name="l00127"></a>00127 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1MPF.html#286d040770d08bd7ff416cea617b1b14" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ); 111 <a name="l00128"></a> <a class="code" href="classbdm_1_1MPF.html#2da4cbf7645da52ad5630ada411e3f9f">00128</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classbdm_1_1MPF.html#2da4cbf7645da52ad5630ada411e3f9f" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> jest;}112 <a name="l00129"></a> <a class="code" href="classbdm_1_1MPF.html#1401874aa88a7a3f2593070646779af2">00129</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1MPF.html#1401874aa88a7a3f2593070646779af2" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> &jest;} <span class="comment">//Fixme: is it useful?</span>111 <a name="l00128"></a>00128 <span class="keyword">const</span> epdf& _epdf()<span class="keyword"> const </span>{<span class="keywordflow">return</span> jest;} 112 <a name="l00129"></a>00129 <span class="keyword">const</span> epdf* _e()<span class="keyword"> const </span>{<span class="keywordflow">return</span> &jest;} <span class="comment">//Fixme: is it useful?</span> 113 113 <a name="l00131"></a><a class="code" href="classbdm_1_1MPF.html#dcecdaf2acbbee51acf3018a70989a7e">00131</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1MPF.html#dcecdaf2acbbee51acf3018a70989a7e" title="Set postrior of rvc to samples from epdf0. Statistics of Bms are not re-computed!...">set_est</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& epdf0 ) { 114 114 <a name="l00132"></a>00132 <a class="code" href="classbdm_1_1PF.html#6f1988db4c3f602d187a6c15ec89cb1e" title="Set posterior density by sampling from epdf0.">PF::set_est</a> ( epdf0 ); <span class="comment">// sample params in condition</span> … … 133 133 <a name="l00152"></a>00152 <span class="comment">//generate new samples from paramater evolution model;</span> 134 134 <a name="l00153"></a>00153 <a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( i ) = <a class="code" href="classbdm_1_1PF.html#cf3a1b2a407012e47ac878e3aa2fbf34" title="Parameter evolution model.">par</a>.<a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( i ) ); 135 <a name="l00154"></a>00154 llsP ( i ) = <a class="code" href="classbdm_1_1PF.html#cf3a1b2a407012e47ac878e3aa2fbf34" title="Parameter evolution model.">par</a>.<a class="code" href="classbdm_1_1mpdf.html#05e843fd11c410a99dad2b88c55aca80" title="access function">_e</a>()-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a>(<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>(i));135 <a name="l00154"></a>00154 llsP ( i ) = <a class="code" href="classbdm_1_1PF.html#cf3a1b2a407012e47ac878e3aa2fbf34" title="Parameter evolution model.">par</a>.<a class="code" href="classbdm_1_1mpdf.html#05e843fd11c410a99dad2b88c55aca80">_e</a>()-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a>(<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>(i)); 136 136 <a name="l00155"></a>00155 Bms[i]->condition ( <a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( i ) ); 137 137 <a name="l00156"></a>00156 Bms[i]->bayes ( dt ); … … 183 183 <a name="l00202"></a>00202 184 184 </pre></div></div> 185 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Feb 11 10:20:05 2009 for mixpp by 185 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Feb 11 23:33:55 2009 for mixpp by 186 186 <a href="http://www.doxygen.org/index.html"> 187 187 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>