78 | | <a name="l00030"></a><a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe">00030</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>; |
79 | | <a name="l00032"></a><a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af">00032</a> <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a> <a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>; |
80 | | <a name="l00034"></a><a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3">00034</a> vec &<a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>; |
81 | | <a name="l00036"></a><a class="code" href="classbdm_1_1PF.html#a914bd66025692c4018dbd482cb3c47c1">00036</a> Array<vec> &<a class="code" href="classbdm_1_1PF.html#a914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>; |
82 | | <a name="l00038"></a><a class="code" href="classbdm_1_1PF.html#a0b7ffedb2051161df6c102881afe41ff">00038</a> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> <a class="code" href="classbdm_1_1PF.html#a0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a>; |
83 | | <a name="l00040"></a><a class="code" href="classbdm_1_1PF.html#a77ed889e1b993df253e93059933d227d">00040</a> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> <a class="code" href="classbdm_1_1PF.html#a77ed889e1b993df253e93059933d227d" title="Observation model.">obs</a>; |
84 | | <a name="l00042"></a><a class="code" href="classbdm_1_1PF.html#a08cffd22d6e9501f283972245aeff8cd">00042</a> vec <a class="code" href="classbdm_1_1PF.html#a08cffd22d6e9501f283972245aeff8cd" title="internal structure storing loglikelihood of predictions">lls</a>; |
| 75 | <a name="l00030"></a><a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe">00030</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>; |
| 76 | <a name="l00032"></a><a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af">00032</a> <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a> <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>; |
| 77 | <a name="l00034"></a><a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3">00034</a> vec &<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>; |
| 78 | <a name="l00036"></a><a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1">00036</a> Array<vec> &<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>; |
| 79 | <a name="l00038"></a><a class="code" href="classbdm_1_1PF.html#0b7ffedb2051161df6c102881afe41ff">00038</a> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> <a class="code" href="classbdm_1_1PF.html#0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a>; |
| 80 | <a name="l00040"></a><a class="code" href="classbdm_1_1PF.html#77ed889e1b993df253e93059933d227d">00040</a> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> <a class="code" href="classbdm_1_1PF.html#77ed889e1b993df253e93059933d227d" title="Observation model.">obs</a>; |
| 81 | <a name="l00042"></a><a class="code" href="classbdm_1_1PF.html#08cffd22d6e9501f283972245aeff8cd">00042</a> vec <a class="code" href="classbdm_1_1PF.html#08cffd22d6e9501f283972245aeff8cd" title="internal structure storing loglikelihood of predictions">lls</a>; |
94 | | <a name="l00062"></a>00062 <a class="code" href="classbdm_1_1PF.html" title="Trivial particle filter with proposal density equal to parameter evolution model...">PF</a> ( ) : <a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>(), <a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( <a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>() ), <a class="code" href="classbdm_1_1PF.html#a914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( <a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#a914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>() ), <a class="code" href="classbdm_1_1PF.html#a98ef9ff80c394fafd28680b7a3f831b1" title="Log all samples.">opt_L_smp</a> ( false ), <a class="code" href="classbdm_1_1PF.html#a5a49463a88ee80771a464861df845ff6" title="Log all samples.">opt_L_wei</a> ( false ) { |
95 | | <a name="l00063"></a>00063 <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>.set_size ( 5 ); |
| 91 | <a name="l00062"></a>00062 <a class="code" href="classbdm_1_1PF.html" title="Trivial particle filter with proposal density equal to parameter evolution model...">PF</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#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>() ), <a class="code" href="classbdm_1_1PF.html#98ef9ff80c394fafd28680b7a3f831b1" title="Log all samples.">opt_L_smp</a> ( false ), <a class="code" href="classbdm_1_1PF.html#5a49463a88ee80771a464861df845ff6" title="Log all samples.">opt_L_wei</a> ( false ) { |
| 92 | <a name="l00063"></a>00063 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>.set_size ( 5 ); |
99 | | <a name="l00067"></a>00067 <a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> = n0; |
100 | | <a name="l00068"></a>00068 <a class="code" href="classbdm_1_1PF.html#ab16816e20f97f9bec993d1f25fc3d711">res_threshold</a> = res_th0; |
101 | | <a name="l00069"></a>00069 <a class="code" href="classbdm_1_1PF.html#a9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a> = rm; |
| 96 | <a name="l00067"></a>00067 <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> = n0; |
| 97 | <a name="l00068"></a>00068 <a class="code" href="classbdm_1_1PF.html#b16816e20f97f9bec993d1f25fc3d711">res_threshold</a> = res_th0; |
| 98 | <a name="l00069"></a>00069 <a class="code" href="classbdm_1_1PF.html#9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a> = rm; |
116 | | <a name="l00089"></a><a class="code" href="classbdm_1_1PF.html#abf104b869b5df8dd4a14bbe430d40488">00089</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#abf104b869b5df8dd4a14bbe430d40488">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
117 | | <a name="l00090"></a>00090 <a class="code" href="classbdm_1_1PF.html#abf104b869b5df8dd4a14bbe430d40488">BM::set_options</a> ( opt ); |
118 | | <a name="l00091"></a>00091 <a class="code" href="classbdm_1_1PF.html#a5a49463a88ee80771a464861df845ff6" title="Log all samples.">opt_L_wei</a> = ( opt.find ( <span class="stringliteral">"logweights"</span> ) != string::npos ); |
119 | | <a name="l00092"></a>00092 <a class="code" href="classbdm_1_1PF.html#a98ef9ff80c394fafd28680b7a3f831b1" title="Log all samples.">opt_L_smp</a> = ( opt.find ( <span class="stringliteral">"logsamples"</span> ) != string::npos ); |
| 113 | <a name="l00089"></a><a class="code" href="classbdm_1_1PF.html#bf104b869b5df8dd4a14bbe430d40488">00089</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#bf104b869b5df8dd4a14bbe430d40488">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
| 114 | <a name="l00090"></a>00090 <a class="code" href="classbdm_1_1PF.html#bf104b869b5df8dd4a14bbe430d40488">BM::set_options</a> ( opt ); |
| 115 | <a name="l00091"></a>00091 <a class="code" href="classbdm_1_1PF.html#5a49463a88ee80771a464861df845ff6" title="Log all samples.">opt_L_wei</a> = ( opt.find ( <span class="stringliteral">"logweights"</span> ) != string::npos ); |
| 116 | <a name="l00092"></a>00092 <a class="code" href="classbdm_1_1PF.html#98ef9ff80c394fafd28680b7a3f831b1" title="Log all samples.">opt_L_smp</a> = ( opt.find ( <span class="stringliteral">"logsamples"</span> ) != string::npos ); |
121 | | <a name="l00095"></a>00095 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#a63282dc111d1afb32c194c955d966a15" title="bayes I - generate samples and add their weights to lls">bayes_gensmp</a>(); |
122 | | <a name="l00097"></a>00097 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#aec76b4d647ac7dc683d8c9a7b7611026" title="bayes II - compute weights of the">bayes_weights</a>(); |
123 | | <a name="l00099"></a><a class="code" href="classbdm_1_1PF.html#ac3443faad7159e742ef3cb0674a92634">00099</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1PF.html#ac3443faad7159e742ef3cb0674a92634" title="important part of particle filtering - decide if it is time to perform resampling...">do_resampling</a>(){ |
124 | | <a name="l00100"></a>00100 <span class="keywordtype">double</span> eff = 1.0 / ( <a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> * <a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ); |
125 | | <a name="l00101"></a>00101 <span class="keywordflow">return</span> eff < ( <a class="code" href="classbdm_1_1PF.html#ab16816e20f97f9bec993d1f25fc3d711">res_threshold</a>*<a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ); |
| 118 | <a name="l00095"></a>00095 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#63282dc111d1afb32c194c955d966a15" title="bayes I - generate samples and add their weights to lls">bayes_gensmp</a>(); |
| 119 | <a name="l00097"></a>00097 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#ec76b4d647ac7dc683d8c9a7b7611026" title="bayes II - compute weights of the">bayes_weights</a>(); |
| 120 | <a name="l00099"></a><a class="code" href="classbdm_1_1PF.html#c3443faad7159e742ef3cb0674a92634">00099</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1PF.html#c3443faad7159e742ef3cb0674a92634" title="important part of particle filtering - decide if it is time to perform resampling...">do_resampling</a>(){ |
| 121 | <a name="l00100"></a>00100 <span class="keywordtype">double</span> eff = 1.0 / ( <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ); |
| 122 | <a name="l00101"></a>00101 <span class="keywordflow">return</span> eff < ( <a class="code" href="classbdm_1_1PF.html#b16816e20f97f9bec993d1f25fc3d711">res_threshold</a>*<a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ); |
127 | | <a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#a638946eea22d4964bf9350286bb4efd8" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ); |
128 | | <a name="l00105"></a><a class="code" href="classbdm_1_1PF.html#a37cb95af19c7bd13eb3ec61f25923463">00105</a> vec& <a class="code" href="classbdm_1_1PF.html#a37cb95af19c7bd13eb3ec61f25923463" title="access function">__w</a>() { <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>; } |
129 | | <a name="l00107"></a><a class="code" href="classbdm_1_1PF.html#a82d221d771cbc3c15a37cb358d759734">00107</a> vec& <a class="code" href="classbdm_1_1PF.html#a82d221d771cbc3c15a37cb358d759734" title="access function">_lls</a>() { <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#a08cffd22d6e9501f283972245aeff8cd" title="internal structure storing loglikelihood of predictions">lls</a>; } |
130 | | <a name="l00108"></a>00108 RESAMPLING_METHOD _resmethod()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#a9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a>; } |
131 | | <a name="l00110"></a><a class="code" href="classbdm_1_1PF.html#aee9553da1a05671f94f30e0e94ff42cd">00110</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a>& <a class="code" href="classbdm_1_1PF.html#aee9553da1a05671f94f30e0e94ff42cd" title="access function">posterior</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>;} |
| 124 | <a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#638946eea22d4964bf9350286bb4efd8" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ); |
| 125 | <a name="l00105"></a><a class="code" href="classbdm_1_1PF.html#37cb95af19c7bd13eb3ec61f25923463">00105</a> vec& <a class="code" href="classbdm_1_1PF.html#37cb95af19c7bd13eb3ec61f25923463" title="access function">__w</a>() { <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>; } |
| 126 | <a name="l00107"></a><a class="code" href="classbdm_1_1PF.html#82d221d771cbc3c15a37cb358d759734">00107</a> vec& <a class="code" href="classbdm_1_1PF.html#82d221d771cbc3c15a37cb358d759734" title="access function">_lls</a>() { <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#08cffd22d6e9501f283972245aeff8cd" title="internal structure storing loglikelihood of predictions">lls</a>; } |
| 127 | <a name="l00108"></a>00108 RESAMPLING_METHOD _resmethod()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a>; } |
| 128 | <a name="l00110"></a><a class="code" href="classbdm_1_1PF.html#ee9553da1a05671f94f30e0e94ff42cd">00110</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a>& <a class="code" href="classbdm_1_1PF.html#ee9553da1a05671f94f30e0e94ff42cd" title="access function">posterior</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>;} |
133 | | <a name="l00124"></a><a class="code" href="classbdm_1_1PF.html#a40d74160df73d152a9bcf044eac25663">00124</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#a40d74160df73d152a9bcf044eac25663">from_setting</a>(<span class="keyword">const</span> Setting &<span class="keyword">set</span>){ |
134 | | <a name="l00125"></a>00125 <a class="code" href="classbdm_1_1PF.html#a0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a> = UI::build<mpdf>(<span class="keyword">set</span>,<span class="stringliteral">"parameter_pdf"</span>,UI::compulsory); |
135 | | <a name="l00126"></a>00126 <a class="code" href="classbdm_1_1PF.html#a77ed889e1b993df253e93059933d227d" title="Observation model.">obs</a> = UI::build<mpdf>(<span class="keyword">set</span>,<span class="stringliteral">"observation_pdf"</span>,UI::compulsory); |
| 130 | <a name="l00124"></a><a class="code" href="classbdm_1_1PF.html#40d74160df73d152a9bcf044eac25663">00124</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#40d74160df73d152a9bcf044eac25663">from_setting</a>(<span class="keyword">const</span> Setting &<span class="keyword">set</span>){ |
| 131 | <a name="l00125"></a>00125 <a class="code" href="classbdm_1_1PF.html#0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a> = UI::build<mpdf>(<span class="keyword">set</span>,<span class="stringliteral">"parameter_pdf"</span>,UI::compulsory); |
| 132 | <a name="l00126"></a>00126 <a class="code" href="classbdm_1_1PF.html#77ed889e1b993df253e93059933d227d" title="Observation model.">obs</a> = UI::build<mpdf>(<span class="keyword">set</span>,<span class="stringliteral">"observation_pdf"</span>,UI::compulsory); |
152 | | <a name="l00144"></a>00144 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(resmeth,<span class="keyword">set</span>,<span class="stringliteral">"resmethod"</span>,UI::optional)){ |
153 | | <a name="l00145"></a>00145 <span class="keywordflow">if</span> (resmeth==<span class="stringliteral">"systematic"</span>) { |
154 | | <a name="l00146"></a>00146 <a class="code" href="classbdm_1_1PF.html#a9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a>= SYSTEMATIC; |
| 149 | <a name="l00144"></a>00144 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(resmeth,<span class="keyword">set</span>,<span class="stringliteral">"resmethod"</span>,UI::optional)){ |
| 150 | <a name="l00145"></a>00145 <span class="keywordflow">if</span> (resmeth==<span class="stringliteral">"systematic"</span>) { |
| 151 | <a name="l00146"></a>00146 <a class="code" href="classbdm_1_1PF.html#9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a>= SYSTEMATIC; |
169 | | <a name="l00161"></a>00161 <span class="keywordflow">if</span>(!<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(<a class="code" href="classbdm_1_1PF.html#ab16816e20f97f9bec993d1f25fc3d711">res_threshold</a>, <span class="keyword">set</span>, <span class="stringliteral">"res_threshold"</span>, UI::optional)){ |
170 | | <a name="l00162"></a>00162 <a class="code" href="classbdm_1_1PF.html#ab16816e20f97f9bec993d1f25fc3d711">res_threshold</a>=0.5; |
| 166 | <a name="l00161"></a>00161 <span class="keywordflow">if</span>(!<a class="code" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(<a class="code" href="classbdm_1_1PF.html#b16816e20f97f9bec993d1f25fc3d711">res_threshold</a>, <span class="keyword">set</span>, <span class="stringliteral">"res_threshold"</span>, UI::optional)){ |
| 167 | <a name="l00162"></a>00162 <a class="code" href="classbdm_1_1PF.html#b16816e20f97f9bec993d1f25fc3d711">res_threshold</a>=0.5; |
173 | | <a name="l00166"></a><a class="code" href="classbdm_1_1PF.html#a8ac867d4b88c2c6c73ae29d47f37d0bb">00166</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#a8ac867d4b88c2c6c73ae29d47f37d0bb" title="load prior information from set and set internal structures accordingly">prior_from_set</a>(<span class="keyword">const</span> Setting & <span class="keyword">set</span>){ |
174 | | <a name="l00167"></a>00167 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> pri = UI::build<epdf>(<span class="keyword">set</span>,<span class="stringliteral">"prior"</span>,UI::compulsory); |
| 170 | <a name="l00166"></a><a class="code" href="classbdm_1_1PF.html#8ac867d4b88c2c6c73ae29d47f37d0bb">00166</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#8ac867d4b88c2c6c73ae29d47f37d0bb" title="load prior information from set and set internal structures accordingly">prior_from_set</a>(<span class="keyword">const</span> Setting & <span class="keyword">set</span>){ |
| 171 | <a name="l00167"></a>00167 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> pri = UI::build<epdf>(<span class="keyword">set</span>,<span class="stringliteral">"prior"</span>,UI::compulsory); |
180 | | <a name="l00173"></a>00173 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>; |
181 | | <a name="l00174"></a>00174 <span class="keywordflow">if</span> (!<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(n,<span class="keyword">set</span>,<span class="stringliteral">"n"</span>,UI::optional)){n=10;} |
| 177 | <a name="l00173"></a>00173 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>; |
| 178 | <a name="l00174"></a>00174 <span class="keywordflow">if</span> (!<a class="code" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(n,<span class="keyword">set</span>,<span class="stringliteral">"n"</span>,UI::optional)){n=10;} |
188 | | <a name="l00181"></a><a class="code" href="classbdm_1_1PF.html#a7ebbb12b5b01e8ac6985af0e04e0f0c2">00181</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#a7ebbb12b5b01e8ac6985af0e04e0f0c2" title="This method TODO.">validate</a>(){ |
189 | | <a name="l00182"></a>00182 <a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>=<a class="code" href="classbdm_1_1PF.html#af5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length(); |
190 | | <a name="l00183"></a>00183 <a class="code" href="classbdm_1_1PF.html#a08cffd22d6e9501f283972245aeff8cd" title="internal structure storing loglikelihood of predictions">lls</a>=zeros(<a class="code" href="classbdm_1_1PF.html#aeeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>); |
191 | | <a name="l00184"></a>00184 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1PF.html#a0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a>->_rv()._dsize()>0) { |
192 | | <a name="l00185"></a>00185 <a class="code" href="bdmerror_8h.html#a7a3399d182b8e3065532596e76f84849" title="Throw std::runtime_exception if t is not true.">bdm_assert</a>(<a class="code" href="classbdm_1_1PF.html#a0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a>->_rv()._dsize()==<a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1epdf.html#a7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>(),<span class="stringliteral">"Mismatch of RV and dimension of posterior"</span> ); |
| 185 | <a name="l00181"></a><a class="code" href="classbdm_1_1PF.html#7ebbb12b5b01e8ac6985af0e04e0f0c2">00181</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#7ebbb12b5b01e8ac6985af0e04e0f0c2" title="This method TODO.">validate</a>(){ |
| 186 | <a name="l00182"></a>00182 <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>.length(); |
| 187 | <a name="l00183"></a>00183 <a class="code" href="classbdm_1_1PF.html#08cffd22d6e9501f283972245aeff8cd" title="internal structure storing loglikelihood of predictions">lls</a>=zeros(<a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>); |
| 188 | <a name="l00184"></a>00184 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1PF.html#0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a>->_rv()._dsize()>0) { |
| 189 | <a name="l00185"></a>00185 <a class="code" href="bdmerror_8h.html#7a3399d182b8e3065532596e76f84849" title="Throw std::runtime_exception if t is not true.">bdm_assert</a>(<a class="code" href="classbdm_1_1PF.html#0b7ffedb2051161df6c102881afe41ff" title="Parameter evolution model.">par</a>->_rv()._dsize()==<a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>(),<span class="stringliteral">"Mismatch of RV and dimension of posterior"</span> ); |
195 | | <a name="l00189"></a><a class="code" href="classbdm_1_1PF.html#a10fd6402c67ad3ee3a1a9a23fe91d7d7">00189</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#a10fd6402c67ad3ee3a1a9a23fe91d7d7" title="resample posterior density (from outside - see MPF)">resample</a>(ivec &ind){ |
196 | | <a name="l00190"></a>00190 <a class="code" href="classbdm_1_1PF.html#adc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1eEmp.html#af59ed50888a31057ac2038d80f607d3d">resample</a>(ind,<a class="code" href="classbdm_1_1PF.html#a9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a>); |
| 192 | <a name="l00189"></a><a class="code" href="classbdm_1_1PF.html#10fd6402c67ad3ee3a1a9a23fe91d7d7">00189</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1PF.html#10fd6402c67ad3ee3a1a9a23fe91d7d7" title="resample posterior density (from outside - see MPF)">resample</a>(ivec &ind){ |
| 193 | <a name="l00190"></a>00190 <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1eEmp.html#f59ed50888a31057ac2038d80f607d3d">resample</a>(ind,<a class="code" href="classbdm_1_1PF.html#9932c7c5865954ef9a438afcbe944e52" title="which resampling method will be used">resmethod</a>); |
315 | | <a name="l00323"></a><a class="code" href="classbdm_1_1MPF.html#aada1bdb117bc78035fbb49765fa7ef10">00323</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1MPF.html#aada1bdb117bc78035fbb49765fa7ef10">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
316 | | <a name="l00324"></a>00324 <a class="code" href="classbdm_1_1MPF.html#aada1bdb117bc78035fbb49765fa7ef10">BM::set_options</a>(opt); |
317 | | <a name="l00325"></a>00325 opt_L_mea = ( opt.find ( <span class="stringliteral">"logmeans"</span> ) != string::npos ); |
| 312 | <a name="l00323"></a><a class="code" href="classbdm_1_1MPF.html#ada1bdb117bc78035fbb49765fa7ef10">00323</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1MPF.html#ada1bdb117bc78035fbb49765fa7ef10">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
| 313 | <a name="l00324"></a>00324 <a class="code" href="classbdm_1_1MPF.html#ada1bdb117bc78035fbb49765fa7ef10">BM::set_options</a>(opt); |
| 314 | <a name="l00325"></a>00325 opt_L_mea = ( opt.find ( <span class="stringliteral">"logmeans"</span> ) != string::npos ); |
324 | | <a name="l00344"></a><a class="code" href="classbdm_1_1MPF.html#a9f74326b9ca3c888cb8eff1355ba3670">00344</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1MPF.html#a9f74326b9ca3c888cb8eff1355ba3670">from_setting</a>(<span class="keyword">const</span> Setting &<span class="keyword">set</span>){ |
325 | | <a name="l00345"></a>00345 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> par = UI::build<mpdf>(<span class="keyword">set</span>,<span class="stringliteral">"parameter_pdf"</span>,UI::compulsory); |
| 321 | <a name="l00344"></a><a class="code" href="classbdm_1_1MPF.html#9f74326b9ca3c888cb8eff1355ba3670">00344</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1MPF.html#9f74326b9ca3c888cb8eff1355ba3670">from_setting</a>(<span class="keyword">const</span> Setting &<span class="keyword">set</span>){ |
| 322 | <a name="l00345"></a>00345 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> par = UI::build<mpdf>(<span class="keyword">set</span>,<span class="stringliteral">"parameter_pdf"</span>,UI::compulsory); |
338 | | <a name="l00358"></a>00358 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(opt,<span class="keyword">set</span>,<span class="stringliteral">"options"</span>,UI::optional)){ |
339 | | <a name="l00359"></a>00359 <a class="code" href="classbdm_1_1MPF.html#aada1bdb117bc78035fbb49765fa7ef10">set_options</a>(opt); |
| 335 | <a name="l00358"></a>00358 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(opt,<span class="keyword">set</span>,<span class="stringliteral">"options"</span>,UI::optional)){ |
| 336 | <a name="l00359"></a>00359 <a class="code" href="classbdm_1_1MPF.html#ada1bdb117bc78035fbb49765fa7ef10">set_options</a>(opt); |