371 | | <a name="l00533"></a><a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376">00533</a> <a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376" title="Default constructor.">mepdf</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>* em ) :<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_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>=<span class="keyword">const_cast<</span><a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>*<span class="keyword">></span> ( em );}; |
372 | | <a name="l00534"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00534</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {} |
373 | | <a name="l00535"></a>00535 }; |
374 | | <a name="l00536"></a>00536 |
375 | | <a name="l00539"></a><a class="code" href="classbdm_1_1compositepdf.html">00539</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> { |
376 | | <a name="l00540"></a>00540 <span class="keyword">protected</span>: |
377 | | <a name="l00542"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00542</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
378 | | <a name="l00544"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00544</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
379 | | <a name="l00545"></a>00545 <span class="keyword">public</span>: |
380 | | <a name="l00546"></a>00546 <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( Array<mpdf*> A0 ) : <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ( A0.length() ), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
381 | | <a name="l00548"></a>00548 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keywordtype">bool</span> checkoverlap=<span class="keyword">false</span> ); |
382 | | <a name="l00550"></a>00550 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1compositepdf.html#c71fc2c51f49d797e61f479f543c75ce" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
383 | | <a name="l00551"></a>00551 }; |
384 | | <a name="l00552"></a>00552 |
385 | | <a name="l00560"></a><a class="code" href="classbdm_1_1DS.html">00560</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
386 | | <a name="l00561"></a>00561 <span class="keyword">protected</span>: |
387 | | <a name="l00562"></a>00562 <span class="keywordtype">int</span> dtsize; |
388 | | <a name="l00563"></a>00563 <span class="keywordtype">int</span> utsize; |
389 | | <a name="l00565"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00565</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>; |
390 | | <a name="l00567"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00567</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
391 | | <a name="l00569"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00569</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
392 | | <a name="l00570"></a>00570 <span class="keyword">public</span>: |
393 | | <a name="l00572"></a><a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a">00572</a> <a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</a>() :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> ( ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> ( ) {}; |
394 | | <a name="l00574"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00574</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
395 | | <a name="l00576"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00576</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
396 | | <a name="l00578"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00578</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
397 | | <a name="l00580"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00580</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d" title="Accepts action variables at specific indeces.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
398 | | <a name="l00581"></a>00581 |
399 | | <a name="l00583"></a>00583 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() =0; |
400 | | <a name="l00584"></a>00584 |
401 | | <a name="l00586"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00586</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e" title="Register DS for logging into logger L.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
402 | | <a name="l00587"></a>00587 it_assert_debug ( dtsize==<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
403 | | <a name="l00588"></a>00588 it_assert_debug ( utsize==<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
404 | | <a name="l00589"></a>00589 |
405 | | <a name="l00590"></a>00590 <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
406 | | <a name="l00591"></a>00591 L_ut=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>,<span class="stringliteral">""</span> ); |
407 | | <a name="l00592"></a>00592 } |
408 | | <a name="l00594"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00594</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf" title="Register DS for logging into logger L.">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
409 | | <a name="l00595"></a>00595 vec tmp ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() +<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ); |
410 | | <a name="l00596"></a>00596 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
411 | | <a name="l00597"></a>00597 <span class="comment">// d is first in getdata</span> |
412 | | <a name="l00598"></a>00598 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>,tmp.left ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
413 | | <a name="l00599"></a>00599 <span class="comment">// u follows after d in getdata</span> |
414 | | <a name="l00600"></a>00600 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_ut,tmp.mid ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
415 | | <a name="l00601"></a>00601 } |
416 | | <a name="l00603"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00603</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660" title="access function">_drv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> concat ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> );} |
417 | | <a name="l00605"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00605</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>;} |
418 | | <a name="l00606"></a>00606 }; |
419 | | <a name="l00607"></a>00607 |
420 | | <a name="l00629"></a><a class="code" href="classbdm_1_1BM.html">00629</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
421 | | <a name="l00630"></a>00630 <span class="keyword">protected</span>: |
422 | | <a name="l00632"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00632</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
423 | | <a name="l00634"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00634</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
424 | | <a name="l00636"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00636</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
425 | | <a name="l00637"></a>00637 <span class="keyword">public</span>: |
426 | | <a name="l00640"></a>00640 |
427 | | <a name="l00641"></a>00641 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> () :<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( 0 ),<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( true ), <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 3 ), <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ( false ) {}; |
428 | | <a name="l00642"></a>00642 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( B.<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
429 | | <a name="l00645"></a><a class="code" href="classbdm_1_1BM.html#40f01563651c1e4fe926189e41a6b8ab">00645</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classbdm_1_1BM.html#40f01563651c1e4fe926189e41a6b8ab">_copy_</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> NULL;}; |
430 | | <a name="l00647"></a>00647 |
431 | | <a name="l00650"></a>00650 |
432 | | <a name="l00654"></a>00654 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
433 | | <a name="l00656"></a>00656 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
434 | | <a name="l00659"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00659</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} |
435 | | <a name="l00661"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00661</a> vec <a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const</span>{vec tmp ( dt.cols() );<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<dt.cols();i++ ) {tmp ( i ) =<a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) );}<span class="keywordflow">return</span> tmp;} |
436 | | <a name="l00662"></a>00662 |
437 | | <a name="l00664"></a><a class="code" href="classbdm_1_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba">00664</a> <span class="keyword">virtual</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_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
438 | | <a name="l00666"></a><a class="code" href="classbdm_1_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912">00666</a> <span class="keyword">virtual</span> <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_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs a conditional density 1-step ahead predictor.">predictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
439 | | <a name="l00668"></a>00668 |
440 | | <a name="l00673"></a>00673 |
441 | | <a name="l00675"></a><a class="code" href="classbdm_1_1BM.html#de95c590d650b2db423d53992f0906cb">00675</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvc; |
442 | | <a name="l00677"></a><a class="code" href="classbdm_1_1BM.html#b5e8e016be16e4029c789063cb3f3b33">00677</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#b5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> rvc;} |
443 | | <a name="l00678"></a>00678 |
444 | | <a name="l00680"></a><a class="code" href="classbdm_1_1BM.html#6799f4b16a6a59ed58b1d0d6e17116f4">00680</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#6799f4b16a6a59ed58b1d0d6e17116f4" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) {it_error ( <span class="stringliteral">"Not implemented!"</span> );}; |
445 | | <a name="l00681"></a>00681 |
446 | | <a name="l00683"></a>00683 |
| 371 | <a name="l00533"></a><a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff">00533</a> <a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff" title="Default constructor.">mepdf</a> ( <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* em ) :<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_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>= em ;}; |
| 372 | <a name="l00534"></a>00534 <a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff" title="Default constructor.">mepdf</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>* em ) :<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_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>=<span class="keyword">const_cast<</span><a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>*<span class="keyword">></span>( em );}; |
| 373 | <a name="l00535"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00535</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {} |
| 374 | <a name="l00536"></a>00536 }; |
| 375 | <a name="l00537"></a>00537 |
| 376 | <a name="l00540"></a><a class="code" href="classbdm_1_1compositepdf.html">00540</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> { |
| 377 | <a name="l00541"></a>00541 <span class="keyword">protected</span>: |
| 378 | <a name="l00543"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00543</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
| 379 | <a name="l00545"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00545</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
| 380 | <a name="l00546"></a>00546 <span class="keyword">public</span>: |
| 381 | <a name="l00547"></a>00547 <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( Array<mpdf*> A0 ) : <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ( A0.length() ), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
| 382 | <a name="l00549"></a>00549 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keywordtype">bool</span> checkoverlap=<span class="keyword">false</span> ); |
| 383 | <a name="l00551"></a>00551 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1compositepdf.html#c71fc2c51f49d797e61f479f543c75ce" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
| 384 | <a name="l00552"></a>00552 }; |
| 385 | <a name="l00553"></a>00553 |
| 386 | <a name="l00561"></a><a class="code" href="classbdm_1_1DS.html">00561</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 387 | <a name="l00562"></a>00562 <span class="keyword">protected</span>: |
| 388 | <a name="l00563"></a>00563 <span class="keywordtype">int</span> dtsize; |
| 389 | <a name="l00564"></a>00564 <span class="keywordtype">int</span> utsize; |
| 390 | <a name="l00566"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00566</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>; |
| 391 | <a name="l00568"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00568</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
| 392 | <a name="l00570"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00570</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
| 393 | <a name="l00571"></a>00571 <span class="keyword">public</span>: |
| 394 | <a name="l00573"></a><a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a">00573</a> <a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</a>() :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> ( ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> ( ) {}; |
| 395 | <a name="l00575"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00575</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 396 | <a name="l00577"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00577</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 397 | <a name="l00579"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00579</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 398 | <a name="l00581"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00581</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d" title="Accepts action variables at specific indeces.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 399 | <a name="l00582"></a>00582 |
| 400 | <a name="l00584"></a>00584 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() =0; |
| 401 | <a name="l00585"></a>00585 |
| 402 | <a name="l00587"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00587</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e" title="Register DS for logging into logger L.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 403 | <a name="l00588"></a>00588 it_assert_debug ( dtsize==<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
| 404 | <a name="l00589"></a>00589 it_assert_debug ( utsize==<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
| 405 | <a name="l00590"></a>00590 |
| 406 | <a name="l00591"></a>00591 <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
| 407 | <a name="l00592"></a>00592 L_ut=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>,<span class="stringliteral">""</span> ); |
| 408 | <a name="l00593"></a>00593 } |
| 409 | <a name="l00595"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00595</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf" title="Register DS for logging into logger L.">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 410 | <a name="l00596"></a>00596 vec tmp ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() +<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ); |
| 411 | <a name="l00597"></a>00597 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
| 412 | <a name="l00598"></a>00598 <span class="comment">// d is first in getdata</span> |
| 413 | <a name="l00599"></a>00599 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>,tmp.left ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
| 414 | <a name="l00600"></a>00600 <span class="comment">// u follows after d in getdata</span> |
| 415 | <a name="l00601"></a>00601 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_ut,tmp.mid ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
| 416 | <a name="l00602"></a>00602 } |
| 417 | <a name="l00604"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00604</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660" title="access function">_drv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> concat ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> );} |
| 418 | <a name="l00606"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00606</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>;} |
| 419 | <a name="l00607"></a>00607 }; |
| 420 | <a name="l00608"></a>00608 |
| 421 | <a name="l00630"></a><a class="code" href="classbdm_1_1BM.html">00630</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 422 | <a name="l00631"></a>00631 <span class="keyword">protected</span>: |
| 423 | <a name="l00633"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00633</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
| 424 | <a name="l00635"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00635</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 425 | <a name="l00637"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00637</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
| 426 | <a name="l00638"></a>00638 <span class="keyword">public</span>: |
| 427 | <a name="l00641"></a>00641 |
| 428 | <a name="l00642"></a>00642 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> () :<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( 0 ),<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( true ), <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 3 ), <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ( false ) {}; |
| 429 | <a name="l00643"></a>00643 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( B.<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
| 430 | <a name="l00646"></a><a class="code" href="classbdm_1_1BM.html#40f01563651c1e4fe926189e41a6b8ab">00646</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classbdm_1_1BM.html#40f01563651c1e4fe926189e41a6b8ab">_copy_</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> NULL;}; |
| 431 | <a name="l00648"></a>00648 |
| 432 | <a name="l00651"></a>00651 |
| 433 | <a name="l00655"></a>00655 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
| 434 | <a name="l00657"></a>00657 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
| 435 | <a name="l00660"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00660</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} |
| 436 | <a name="l00662"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00662</a> vec <a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const</span>{vec tmp ( dt.cols() );<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<dt.cols();i++ ) {tmp ( i ) =<a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) );}<span class="keywordflow">return</span> tmp;} |
| 437 | <a name="l00663"></a>00663 |
| 438 | <a name="l00665"></a><a class="code" href="classbdm_1_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba">00665</a> <span class="keyword">virtual</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_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
| 439 | <a name="l00667"></a><a class="code" href="classbdm_1_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912">00667</a> <span class="keyword">virtual</span> <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_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs a conditional density 1-step ahead predictor.">predictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
| 440 | <a name="l00669"></a>00669 |
| 441 | <a name="l00674"></a>00674 |
| 442 | <a name="l00676"></a><a class="code" href="classbdm_1_1BM.html#de95c590d650b2db423d53992f0906cb">00676</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvc; |
| 443 | <a name="l00678"></a><a class="code" href="classbdm_1_1BM.html#b5e8e016be16e4029c789063cb3f3b33">00678</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#b5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> rvc;} |
| 444 | <a name="l00679"></a>00679 |
| 445 | <a name="l00681"></a><a class="code" href="classbdm_1_1BM.html#6799f4b16a6a59ed58b1d0d6e17116f4">00681</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#6799f4b16a6a59ed58b1d0d6e17116f4" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) {it_error ( <span class="stringliteral">"Not implemented!"</span> );}; |
| 446 | <a name="l00682"></a>00682 |
448 | | <a name="l00687"></a>00687 |
449 | | <a name="l00688"></a>00688 <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& _drv()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>;} |
450 | | <a name="l00689"></a>00689 <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &rv ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=rv;} |
451 | | <a name="l00690"></a>00690 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv ) {<span class="keyword">const_cast<</span>epdf&<span class="keyword">></span> ( posterior() ).set_rv ( rv );} |
452 | | <a name="l00691"></a>00691 <span class="keywordtype">double</span> _ll()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>;} |
453 | | <a name="l00692"></a>00692 <span class="keywordtype">void</span> set_evalll ( <span class="keywordtype">bool</span> evl0 ) {<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>=evl0;} |
454 | | <a name="l00693"></a>00693 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> =0; |
455 | | <a name="l00694"></a>00694 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf* _e() <span class="keyword">const</span> =0; |
456 | | <a name="l00696"></a>00696 |
457 | | <a name="l00699"></a>00699 |
458 | | <a name="l00701"></a><a class="code" href="classbdm_1_1BM.html#224dd68a83c1472b43163763fa93c477">00701</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#224dd68a83c1472b43163763fa93c477" title="Set boolean options from a string.">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
459 | | <a name="l00702"></a>00702 <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a>= ( opt.find ( <span class="stringliteral">"logbounds"</span> ) !=string::npos ); |
460 | | <a name="l00703"></a>00703 } |
461 | | <a name="l00705"></a><a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca">00705</a> ivec <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a>; |
462 | | <a name="l00706"></a>00706 |
463 | | <a name="l00708"></a><a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77">00708</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a>; |
464 | | <a name="l00710"></a><a class="code" href="classbdm_1_1BM.html#aa5d1f7e638db229403e3917bf155ee3">00710</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#aa5d1f7e638db229403e3917bf155ee3" title="Add all logged variables to a logger.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> *L, <span class="keyword">const</span> <span class="keywordtype">string</span> &name=<span class="stringliteral">""</span> ) { |
465 | | <a name="l00711"></a>00711 <span class="comment">// internal</span> |
466 | | <a name="l00712"></a>00712 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
467 | | <a name="l00713"></a>00713 <span class="keywordflow">if</span> ( posterior().isnamed() ) {r=posterior().<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>();} |
468 | | <a name="l00714"></a>00714 <span class="keywordflow">else</span>{r=<a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"est"</span>, posterior().dimension() );}; |
469 | | <a name="l00715"></a>00715 |
470 | | <a name="l00716"></a>00716 <span class="comment">// Add mean value</span> |
471 | | <a name="l00717"></a>00717 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 0 ) =L-><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name ); |
472 | | <a name="l00718"></a>00718 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ) { |
473 | | <a name="l00719"></a>00719 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 1 ) =L-><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name+<span class="stringliteral">"_lb"</span> ); |
474 | | <a name="l00720"></a>00720 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 2 ) =L-><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name+<span class="stringliteral">"_ub"</span> ); |
475 | | <a name="l00721"></a>00721 } |
476 | | <a name="l00722"></a>00722 } |
477 | | <a name="l00723"></a>00723 <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> *L ) { |
478 | | <a name="l00724"></a>00724 L-><a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 0 ), posterior().mean() ); |
479 | | <a name="l00725"></a>00725 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ) { |
480 | | <a name="l00726"></a>00726 vec ub,lb; |
481 | | <a name="l00727"></a>00727 posterior().<a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb,ub ); |
482 | | <a name="l00728"></a>00728 L-><a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 1 ), lb ); |
483 | | <a name="l00729"></a>00729 L-><a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 2 ), ub ); |
484 | | <a name="l00730"></a>00730 } |
485 | | <a name="l00731"></a>00731 } |
486 | | <a name="l00733"></a>00733 }; |
487 | | <a name="l00734"></a>00734 |
488 | | <a name="l00735"></a>00735 }; <span class="comment">//namespace</span> |
489 | | <a name="l00736"></a>00736 <span class="preprocessor">#endif // BM_H</span> |
| 448 | <a name="l00685"></a>00685 |
| 449 | <a name="l00688"></a>00688 |
| 450 | <a name="l00689"></a>00689 <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& _drv()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>;} |
| 451 | <a name="l00690"></a>00690 <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &rv ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=rv;} |
| 452 | <a name="l00691"></a>00691 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv ) {<span class="keyword">const_cast<</span>epdf&<span class="keyword">></span> ( posterior() ).set_rv ( rv );} |
| 453 | <a name="l00692"></a>00692 <span class="keywordtype">double</span> _ll()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>;} |
| 454 | <a name="l00693"></a>00693 <span class="keywordtype">void</span> set_evalll ( <span class="keywordtype">bool</span> evl0 ) {<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>=evl0;} |
| 455 | <a name="l00694"></a>00694 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> =0; |
| 456 | <a name="l00695"></a>00695 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf* _e() <span class="keyword">const</span> =0; |
| 457 | <a name="l00697"></a>00697 |
| 458 | <a name="l00700"></a>00700 |
| 459 | <a name="l00702"></a><a class="code" href="classbdm_1_1BM.html#224dd68a83c1472b43163763fa93c477">00702</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#224dd68a83c1472b43163763fa93c477" title="Set boolean options from a string.">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
| 460 | <a name="l00703"></a>00703 <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a>= ( opt.find ( <span class="stringliteral">"logbounds"</span> ) !=string::npos ); |
| 461 | <a name="l00704"></a>00704 } |
| 462 | <a name="l00706"></a><a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca">00706</a> ivec <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a>; |
| 463 | <a name="l00707"></a>00707 |
| 464 | <a name="l00709"></a><a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77">00709</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a>; |
| 465 | <a name="l00711"></a><a class="code" href="classbdm_1_1BM.html#aa5d1f7e638db229403e3917bf155ee3">00711</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#aa5d1f7e638db229403e3917bf155ee3" title="Add all logged variables to a logger.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> *L, <span class="keyword">const</span> <span class="keywordtype">string</span> &name=<span class="stringliteral">""</span> ) { |
| 466 | <a name="l00712"></a>00712 <span class="comment">// internal</span> |
| 467 | <a name="l00713"></a>00713 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
| 468 | <a name="l00714"></a>00714 <span class="keywordflow">if</span> ( posterior().isnamed() ) {r=posterior().<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>();} |
| 469 | <a name="l00715"></a>00715 <span class="keywordflow">else</span>{r=<a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"est"</span>, posterior().dimension() );}; |
| 470 | <a name="l00716"></a>00716 |
| 471 | <a name="l00717"></a>00717 <span class="comment">// Add mean value</span> |
| 472 | <a name="l00718"></a>00718 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 0 ) =L-><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name ); |
| 473 | <a name="l00719"></a>00719 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ) { |
| 474 | <a name="l00720"></a>00720 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 1 ) =L-><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name+<span class="stringliteral">"_lb"</span> ); |
| 475 | <a name="l00721"></a>00721 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 2 ) =L-><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name+<span class="stringliteral">"_ub"</span> ); |
| 476 | <a name="l00722"></a>00722 } |
| 477 | <a name="l00723"></a>00723 } |
| 478 | <a name="l00724"></a>00724 <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> *L ) { |
| 479 | <a name="l00725"></a>00725 L-><a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 0 ), posterior().mean() ); |
| 480 | <a name="l00726"></a>00726 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ) { |
| 481 | <a name="l00727"></a>00727 vec ub,lb; |
| 482 | <a name="l00728"></a>00728 posterior().<a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb,ub ); |
| 483 | <a name="l00729"></a>00729 L-><a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 1 ), lb ); |
| 484 | <a name="l00730"></a>00730 L-><a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 2 ), ub ); |
| 485 | <a name="l00731"></a>00731 } |
| 486 | <a name="l00732"></a>00732 } |
| 487 | <a name="l00734"></a>00734 }; |
| 488 | <a name="l00735"></a>00735 |
| 489 | <a name="l00736"></a>00736 }; <span class="comment">//namespace</span> |
| 490 | <a name="l00737"></a>00737 <span class="preprocessor">#endif // BM_H</span> |