Show
Ignore:
Timestamp:
06/24/09 21:56:30 (15 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/doc/html/arx_8h-source.html

    r385 r397  
    6767<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define AR_H</span> 
    6868<a name="l00015"></a>00015 <span class="preprocessor"></span> 
    69 <a name="l00016"></a>00016 <span class="preprocessor">#include "../stat/libFN.h"</span> 
    70 <a name="l00017"></a>00017 <span class="preprocessor">#include "../stat/libEF.h"</span> 
    71 <a name="l00018"></a>00018 <span class="preprocessor">#include "../user_info.h"</span> 
     69<a name="l00016"></a>00016 <span class="preprocessor">#include "../math/functions.h"</span> 
     70<a name="l00017"></a>00017 <span class="preprocessor">#include "../stat/exp_family.h"</span> 
     71<a name="l00018"></a>00018 <span class="preprocessor">#include "../base/user_info.h"</span> 
    7272<a name="l00019"></a>00019  
    7373<a name="l00020"></a>00020 <span class="keyword">namespace </span>bdm { 
    7474<a name="l00021"></a>00021  
    75 <a name="l00040"></a><a class="code" href="classbdm_1_1ARX.html">00040</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a> { 
    76 <a name="l00041"></a>00041 <span class="keyword">protected</span>: 
    77 <a name="l00043"></a><a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9">00043</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>; 
    78 <a name="l00046"></a><a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">00046</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_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>; 
    79 <a name="l00048"></a><a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026">00048</a>         <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>; 
    80 <a name="l00050"></a><a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd">00050</a>         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &amp;<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>; 
    81 <a name="l00052"></a><a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f">00052</a>         <span class="keywordtype">double</span> &amp;<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a>; 
    82 <a name="l00053"></a>00053 <span class="keyword">public</span>: 
    83 <a name="l00056"></a>00056         <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> ( <span class="keyword">const</span> <span class="keywordtype">double</span> frg0=1.0 ) : <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a> ( frg0 ),<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a> (), <a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._V() ), <a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._nu() ) {}; 
    84 <a name="l00057"></a>00057         <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> &amp;A0 ) : <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a> (),<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a> (), <a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._V() ), <a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._nu() ) { 
    85 <a name="l00058"></a>00058                 set_statistics ( A0.<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>,A0.<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>,A0.<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ); 
    86 <a name="l00059"></a>00059                 set_parameters(A0.<a class="code" href="classbdm_1_1BMEF.html#1331865e10fb1ccef65bb4c47fa3be64" title="forgetting factor">frg</a>); 
    87 <a name="l00060"></a>00060         }; 
    88 <a name="l00061"></a>00061         ARX* <a class="code" href="classbdm_1_1ARX.html#ca0b54c0997cfd567f49377af5def106" title="Flatten the posterior as if to keep nu0 data.">_copy_</a>() <span class="keyword">const</span>; 
    89 <a name="l00062"></a>00062         <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">double</span> frg0 ) {<a class="code" href="classbdm_1_1BMEF.html#1331865e10fb1ccef65bb4c47fa3be64" title="forgetting factor">frg</a>=frg0;} 
    90 <a name="l00063"></a>00063         <span class="keywordtype">void</span> set_statistics ( <span class="keywordtype">int</span> dimx0, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> V0, <span class="keywordtype">double</span> nu0=-1.0 ) {<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.set_parameters ( dimx0,V0,nu0 );<a class="code" href="classbdm_1_1BMEF.html#06e7b3ac03e10017d4288c76888e2865" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.lognc();<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>=dimx0;} 
    91 <a name="l00065"></a>00065  
    92 <a name="l00066"></a>00066 <span class="comment">//      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)</span> 
    93 <a name="l00067"></a>00067 <span class="comment">//      void set_parameters ( const vec &amp;mu, const mat &amp;R, const mat &amp;C, double dfm){};</span> 
    94 <a name="l00069"></a>00069 <span class="comment"></span>        <span class="keywordtype">void</span> set_statistics ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BMEF.html#2def512872ed8a4fc3b702371ec0be55" title="Default constructor (=empty constructor).">BMEF</a>* BM0 ); 
    95 <a name="l00070"></a>00070 <span class="comment">//      //! Returns sufficient statistics</span> 
    96 <a name="l00071"></a>00071 <span class="comment">//      void get_parameters ( mat &amp;V0, double &amp;nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}</span> 
    97 <a name="l00074"></a>00074 <span class="comment"></span> 
    98 <a name="l00076"></a>00076         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#17e7fe14654ab3c449846c3f43e66169" title="Weighted Bayes .">bayes</a> ( <span class="keyword">const</span> vec &amp;dt, <span class="keyword">const</span> <span class="keywordtype">double</span> w ); 
    99 <a name="l00077"></a><a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3">00077</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &amp;dt ) {<a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3" title="Incremental Bayes rule.">bayes</a> ( dt,1.0 );}; 
    100 <a name="l00078"></a>00078         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1ARX.html#080a7e531e3aa06694112863b15bc6a4">logpred</a> ( <span class="keyword">const</span> vec &amp;dt ) <span class="keyword">const</span>; 
    101 <a name="l00079"></a><a class="code" href="classbdm_1_1ARX.html#e86ab499b116b837d3163ec852961eca">00079</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#e86ab499b116b837d3163ec852961eca" title="Flatten the posterior according to the given BMEF (of the same type!).">flatten</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a>* B ) { 
    102 <a name="l00080"></a>00080                 <span class="keyword">const</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>* A=<span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>*<span class="keyword">&gt;</span> ( B ); 
    103 <a name="l00081"></a>00081                 <span class="comment">// nu should be equal to B.nu</span> 
    104 <a name="l00082"></a>00082                 <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classbdm_1_1egiw.html#8e610e95401a11baf34f65e16ecd87be" title="Power of the density, used e.g. to flatten the density.">pow</a> ( A-&gt;<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a>/<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ); 
    105 <a name="l00083"></a>00083                 <span class="keywordflow">if</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> ) {<a class="code" href="classbdm_1_1BMEF.html#06e7b3ac03e10017d4288c76888e2865" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classbdm_1_1egiw.html#41d72ba7b2abc8a9a4209ffa98ed5633" title="logarithm of the normalizing constant, ">lognc</a>();} 
    106 <a name="l00084"></a>00084         } 
    107 <a name="l00086"></a>00086         <a class="code" href="classbdm_1_1enorm.html">enorm&lt;ldmat&gt;</a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a> ( <span class="keyword">const</span> vec &amp;rgr ) <span class="keyword">const</span>; 
    108 <a name="l00088"></a><a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15">00088</a>         <a class="code" href="classbdm_1_1enorm.html">enorm&lt;ldmat&gt;</a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a>()<span class="keyword"> const </span>{ 
    109 <a name="l00089"></a>00089                 it_assert_debug ( <a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>==<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()-1,<span class="stringliteral">"Regressor is not only 1"</span> ); 
    110 <a name="l00090"></a>00090                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a> ( vec_1 ( 1.0 ) ); 
    111 <a name="l00091"></a>00091         } 
    112 <a name="l00093"></a>00093         <a class="code" href="classbdm_1_1mlnorm.html">mlnorm&lt;ldmat&gt;</a>* <a class="code" href="classbdm_1_1ARX.html#74fe8ae2d88bee8639510fd0eaf73513" title="conditional version of the predictor">predictor</a>() <span class="keyword">const</span>; 
    113 <a name="l00094"></a>00094         <a class="code" href="classbdm_1_1mlstudent.html">mlstudent</a>* predictor_student() <span class="keyword">const</span>; 
    114 <a name="l00096"></a>00096         ivec <a class="code" href="classbdm_1_1ARX.html#16b02ae03316751664c22d59d90c1e34" title="Brute force structure estimation.">structure_est</a> ( <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> Eg0 ); 
    115 <a name="l00098"></a>00098  
    116 <a name="l00101"></a>00101         <span class="keyword">const</span> <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a>* _e()<span class="keyword"> const </span>{<span class="keywordflow">return</span> &amp;<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a> ;}; 
    117 <a name="l00102"></a>00102         <span class="keyword">const</span> egiw&amp; posterior()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>;} 
    118 <a name="l00104"></a>00104  
    119 <a name="l00107"></a>00107         <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &amp;drv0 ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=drv0;} 
    120 <a name="l00108"></a>00108         RV&amp; get_yrv() { 
    121 <a name="l00109"></a>00109                 <span class="comment">//if yrv is not ready create it</span> 
    122 <a name="l00110"></a>00110                 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>._dsize() !=<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a> ) { 
    123 <a name="l00111"></a>00111                         <span class="keywordtype">int</span> i=0; 
    124 <a name="l00112"></a>00112                         <span class="keywordflow">while</span> ( <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>._dsize() &lt;<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a> ) {<a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>.add ( <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( vec_1 ( i ) ) );i++;} 
    125 <a name="l00113"></a>00113                 } 
    126 <a name="l00114"></a>00114                 <span class="comment">//yrv should be ready by now</span> 
    127 <a name="l00115"></a>00115                 it_assert_debug ( <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>._dsize() ==<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>,<span class="stringliteral">"incompatible drv"</span> ); 
    128 <a name="l00116"></a>00116                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>; 
    129 <a name="l00117"></a>00117         } 
    130 <a name="l00119"></a>00119  
    131 <a name="l00120"></a>00120         <span class="comment">// TODO dokumentace - aktualizovat</span> 
    132 <a name="l00141"></a>00141 <span class="comment"></span>        <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#8d5f760ac23ae2c699d212c24892ae5f">from_setting</a>( <span class="keyword">const</span> Setting &amp;root ); 
    133 <a name="l00142"></a>00142  
    134 <a name="l00143"></a>00143         <span class="comment">// TODO dodelat void to_setting( Setting &amp;root ) const;</span> 
    135 <a name="l00144"></a>00144 }; 
    136 <a name="l00145"></a>00145  
    137 <a name="l00146"></a>00146 UIREGISTER(ARX); 
    138 <a name="l00147"></a>00147  
    139 <a name="l00148"></a>00148 } 
    140 <a name="l00149"></a>00149  
    141 <a name="l00150"></a>00150 <span class="preprocessor">#endif // AR_H</span> 
    142 <a name="l00151"></a>00151 <span class="preprocessor"></span> 
    143 <a name="l00152"></a>00152  
     75<a name="l00041"></a><a class="code" href="classbdm_1_1ARX.html">00041</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a> { 
     76<a name="l00042"></a>00042 <span class="keyword">protected</span>: 
     77<a name="l00044"></a><a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9">00044</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>; 
     78<a name="l00047"></a><a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">00047</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_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>; 
     79<a name="l00049"></a><a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026">00049</a>         <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>; 
     80<a name="l00051"></a><a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd">00051</a>         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &amp;<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>; 
     81<a name="l00053"></a><a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f">00053</a>         <span class="keywordtype">double</span> &amp;<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a>; 
     82<a name="l00054"></a>00054 <span class="keyword">public</span>: 
     83<a name="l00057"></a>00057         <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> ( <span class="keyword">const</span> <span class="keywordtype">double</span> frg0=1.0 ) : <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a> ( frg0 ),<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a> (), <a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._V() ), <a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._nu() ) {}; 
     84<a name="l00058"></a>00058         <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> &amp;A0 ) : <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a> (),<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a> (), <a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._V() ), <a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ( <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>._nu() ) { 
     85<a name="l00059"></a>00059                 set_statistics ( A0.<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>,A0.<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>,A0.<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ); 
     86<a name="l00060"></a>00060                 set_parameters(A0.<a class="code" href="classbdm_1_1BMEF.html#1331865e10fb1ccef65bb4c47fa3be64" title="forgetting factor">frg</a>); 
     87<a name="l00061"></a>00061         }; 
     88<a name="l00062"></a>00062         ARX* <a class="code" href="classbdm_1_1ARX.html#ca0b54c0997cfd567f49377af5def106" title="Flatten the posterior as if to keep nu0 data.">_copy_</a>() <span class="keyword">const</span>; 
     89<a name="l00063"></a>00063         <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">double</span> frg0 ) {<a class="code" href="classbdm_1_1BMEF.html#1331865e10fb1ccef65bb4c47fa3be64" title="forgetting factor">frg</a>=frg0;} 
     90<a name="l00064"></a>00064         <span class="keywordtype">void</span> set_statistics ( <span class="keywordtype">int</span> dimx0, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> V0, <span class="keywordtype">double</span> nu0=-1.0 ) {<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.set_parameters ( dimx0,V0,nu0 );<a class="code" href="classbdm_1_1BMEF.html#06e7b3ac03e10017d4288c76888e2865" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.lognc();<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>=dimx0;} 
     91<a name="l00066"></a>00066  
     92<a name="l00067"></a>00067 <span class="comment">//      //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)</span> 
     93<a name="l00068"></a>00068 <span class="comment">//      void set_parameters ( const vec &amp;mu, const mat &amp;R, const mat &amp;C, double dfm){};</span> 
     94<a name="l00070"></a>00070 <span class="comment"></span>        <span class="keywordtype">void</span> set_statistics ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BMEF.html#2def512872ed8a4fc3b702371ec0be55" title="Default constructor (=empty constructor).">BMEF</a>* BM0 ); 
     95<a name="l00071"></a>00071 <span class="comment">//      //! Returns sufficient statistics</span> 
     96<a name="l00072"></a>00072 <span class="comment">//      void get_parameters ( mat &amp;V0, double &amp;nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}</span> 
     97<a name="l00075"></a>00075 <span class="comment"></span> 
     98<a name="l00077"></a>00077         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#17e7fe14654ab3c449846c3f43e66169" title="Weighted Bayes .">bayes</a> ( <span class="keyword">const</span> vec &amp;dt, <span class="keyword">const</span> <span class="keywordtype">double</span> w ); 
     99<a name="l00078"></a><a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3">00078</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &amp;dt ) {<a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3" title="Incremental Bayes rule.">bayes</a> ( dt,1.0 );}; 
     100<a name="l00079"></a>00079         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1ARX.html#080a7e531e3aa06694112863b15bc6a4">logpred</a> ( <span class="keyword">const</span> vec &amp;dt ) <span class="keyword">const</span>; 
     101<a name="l00080"></a><a class="code" href="classbdm_1_1ARX.html#e86ab499b116b837d3163ec852961eca">00080</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#e86ab499b116b837d3163ec852961eca" title="Flatten the posterior according to the given BMEF (of the same type!).">flatten</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a>* B ) { 
     102<a name="l00081"></a>00081                 <span class="keyword">const</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>* A=<span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>*<span class="keyword">&gt;</span> ( B ); 
     103<a name="l00082"></a>00082                 <span class="comment">// nu should be equal to B.nu</span> 
     104<a name="l00083"></a>00083                 <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classbdm_1_1egiw.html#8e610e95401a11baf34f65e16ecd87be" title="Power of the density, used e.g. to flatten the density.">pow</a> ( A-&gt;<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a>/<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a> ); 
     105<a name="l00084"></a>00084                 <span class="keywordflow">if</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> ) {<a class="code" href="classbdm_1_1BMEF.html#06e7b3ac03e10017d4288c76888e2865" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classbdm_1_1egiw.html#41d72ba7b2abc8a9a4209ffa98ed5633" title="logarithm of the normalizing constant, ">lognc</a>();} 
     106<a name="l00085"></a>00085         } 
     107<a name="l00087"></a>00087         <a class="code" href="classbdm_1_1enorm.html">enorm&lt;ldmat&gt;</a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a> ( <span class="keyword">const</span> vec &amp;rgr ) <span class="keyword">const</span>; 
     108<a name="l00089"></a><a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15">00089</a>         <a class="code" href="classbdm_1_1enorm.html">enorm&lt;ldmat&gt;</a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a>()<span class="keyword"> const </span>{ 
     109<a name="l00090"></a>00090                 it_assert_debug ( <a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>==<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()-1,<span class="stringliteral">"Regressor is not only 1"</span> ); 
     110<a name="l00091"></a>00091                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a> ( vec_1 ( 1.0 ) ); 
     111<a name="l00092"></a>00092         } 
     112<a name="l00094"></a>00094         <a class="code" href="classbdm_1_1mlnorm.html">mlnorm&lt;ldmat&gt;</a>* <a class="code" href="classbdm_1_1ARX.html#74fe8ae2d88bee8639510fd0eaf73513" title="conditional version of the predictor">predictor</a>() <span class="keyword">const</span>; 
     113<a name="l00095"></a>00095         <a class="code" href="classbdm_1_1mlstudent.html">mlstudent</a>* predictor_student() <span class="keyword">const</span>; 
     114<a name="l00097"></a>00097         ivec <a class="code" href="classbdm_1_1ARX.html#16b02ae03316751664c22d59d90c1e34" title="Brute force structure estimation.">structure_est</a> ( <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> Eg0 ); 
     115<a name="l00099"></a>00099  
     116<a name="l00102"></a>00102         <span class="keyword">const</span> <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a>* _e()<span class="keyword"> const </span>{<span class="keywordflow">return</span> &amp;<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a> ;}; 
     117<a name="l00103"></a>00103         <span class="keyword">const</span> egiw&amp; posterior()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of  in the form of Normal-inverse Wishart density.">est</a>;} 
     118<a name="l00105"></a>00105  
     119<a name="l00108"></a>00108         <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &amp;drv0 ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=drv0;} 
     120<a name="l00109"></a>00109         RV&amp; get_yrv() { 
     121<a name="l00110"></a>00110                 <span class="comment">//if yrv is not ready create it</span> 
     122<a name="l00111"></a>00111                 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>._dsize() !=<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a> ) { 
     123<a name="l00112"></a>00112                         <span class="keywordtype">int</span> i=0; 
     124<a name="l00113"></a>00113                         <span class="keywordflow">while</span> ( <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>._dsize() &lt;<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a> ) {<a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>.add ( <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( vec_1 ( i ) ) );i++;} 
     125<a name="l00114"></a>00114                 } 
     126<a name="l00115"></a>00115                 <span class="comment">//yrv should be ready by now</span> 
     127<a name="l00116"></a>00116                 it_assert_debug ( <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>._dsize() ==<a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9" title="size of output variable (needed in regressors)">dimx</a>,<span class="stringliteral">"incompatible drv"</span> ); 
     128<a name="l00117"></a>00117                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>; 
     129<a name="l00118"></a>00118         } 
     130<a name="l00120"></a>00120  
     131<a name="l00121"></a>00121         <span class="comment">// TODO dokumentace - aktualizovat</span> 
     132<a name="l00142"></a>00142 <span class="comment"></span>        <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#9637412df898048bafaefee9dc7e9f6c">from_setting</a>( <span class="keyword">const</span> Setting &amp;<span class="keyword">set</span> ); 
     133<a name="l00143"></a>00143  
     134<a name="l00144"></a>00144         <span class="comment">// TODO dodelat void to_setting( Setting &amp;set ) const;</span> 
     135<a name="l00145"></a>00145 }; 
     136<a name="l00146"></a>00146  
     137<a name="l00147"></a>00147 UIREGISTER(ARX); 
     138<a name="l00148"></a>00148  
     139<a name="l00149"></a>00149 } 
     140<a name="l00150"></a>00150  
     141<a name="l00151"></a>00151 <span class="preprocessor">#endif // AR_H</span> 
     142<a name="l00152"></a>00152 <span class="preprocessor"></span> 
     143<a name="l00153"></a>00153  
    144144</pre></div></div> 
    145 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 17 14:13:28 2009 for mixpp by&nbsp; 
     145<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 23 19:52:49 2009 for mixpp by&nbsp; 
    146146<a href="http://www.doxygen.org/index.html"> 
    147147<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>