28 | | <a name="l00035"></a><a class="code" href="classbdm_1_1ARX.html">00035</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> { |
29 | | <a name="l00036"></a>00036 <span class="keyword">protected</span>: |
30 | | <a name="l00038"></a><a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026">00038</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>; |
31 | | <a name="l00040"></a><a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd">00040</a> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>; |
32 | | <a name="l00042"></a><a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f">00042</a> <span class="keywordtype">double</span> &<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a>; |
33 | | <a name="l00043"></a>00043 <span class="keyword">public</span>: |
34 | | <a name="l00045"></a><a class="code" href="classbdm_1_1ARX.html#43ed6114f04a3a8756fe2b42eaa35f98">00045</a> <a class="code" href="classbdm_1_1ARX.html#43ed6114f04a3a8756fe2b42eaa35f98" title="Full constructor.">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() ) |
35 | | <a name="l00046"></a>00046 {<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>();}; |
36 | | <a name="l00047"></a>00047 |
37 | | <a name="l00049"></a><a class="code" href="classbdm_1_1ARX.html#73a55a3d66bfbeeee4df6c2ae40920ed">00049</a> <a class="code" href="classbdm_1_1ARX.html#43ed6114f04a3a8756fe2b42eaa35f98" title="Full constructor.">ARX</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> &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> ( A0.<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() ) {}; |
38 | | <a name="l00050"></a>00050 |
39 | | <a name="l00052"></a>00052 <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>* <a class="code" href="classbdm_1_1ARX.html#60c40b5c6abc4c7e464b4ccae64a5a61" title="Auxiliary function.">_copy_</a>(); |
40 | | <a name="l00053"></a>00053 |
41 | | <a name="l00054"></a>00054 <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> |
42 | | <a name="l00055"></a>00055 <span class="comment">// void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};</span> |
43 | | <a name="l00057"></a><a class="code" href="classbdm_1_1ARX.html#cab0a1de5355b1027d24fd3d4862c9b0">00057</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#cab0a1de5355b1027d24fd3d4862c9b0" title="Set sufficient statistics.">set_parameters</a> ( <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="keyword">const</span> <span class="keywordtype">double</span> &nu0 ) |
44 | | <a name="l00058"></a>00058 {<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#15792f3112e5cf67d572f491b09324c8">_V</a>() =V0;<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#a025ee710274ca142dd0ae978735ad4a">_nu</a>() =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>.<a class="code" href="classbdm_1_1egiw.html#41d72ba7b2abc8a9a4209ffa98ed5633" title="logarithm of the normalizing constant, ">lognc</a>();} |
45 | | <a name="l00059"></a>00059 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#539f9d0127423c94b912708d390e67b8" title="get statistics from another model">set_statistics</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a>* BM0 ); |
46 | | <a name="l00061"></a><a class="code" href="classbdm_1_1ARX.html#1974409e022ea1efb3404b5c2fde66ad">00061</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#1974409e022ea1efb3404b5c2fde66ad" title="Returns sufficient statistics.">get_parameters</a> ( mat &V0, <span class="keywordtype">double</span> &nu0 ) {V0=<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#15792f3112e5cf67d572f491b09324c8">_V</a>().<a class="code" href="classldmat.html#2c1ebc071de4bafbba55b80afd8a7e8e" title="Conversion to full matrix.">to_mat</a>(); nu0=<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#a025ee710274ca142dd0ae978735ad4a">_nu</a>();} |
47 | | <a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#17e7fe14654ab3c449846c3f43e66169" title="Here .">bayes</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> <span class="keywordtype">double</span> w ); |
48 | | <a name="l00064"></a><a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3">00064</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1ARX.html#17e7fe14654ab3c449846c3f43e66169" title="Here .">bayes</a> ( <span class="keyword">const</span> vec &dt ) {<a class="code" href="classbdm_1_1ARX.html#17e7fe14654ab3c449846c3f43e66169" title="Here .">bayes</a> ( dt,1.0 );}; |
49 | | <a name="l00065"></a>00065 <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>& _epdf()<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>;} |
50 | | <a name="l00066"></a>00066 <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1ARX.html#080a7e531e3aa06694112863b15bc6a4">logpred</a> ( <span class="keyword">const</span> vec &dt ) <span class="keyword">const</span>; |
51 | | <a name="l00067"></a><a class="code" href="classbdm_1_1ARX.html#e86ab499b116b837d3163ec852961eca">00067</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 ) { |
52 | | <a name="l00068"></a>00068 <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<</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">></span>(B); |
53 | | <a name="l00069"></a>00069 <span class="comment">// nu should be equal to B.nu</span> |
54 | | <a name="l00070"></a>00070 <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-><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>); |
55 | | <a name="l00071"></a>00071 <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>();} |
56 | | <a name="l00072"></a>00072 } |
57 | | <a name="l00074"></a>00074 <a class="code" href="classbdm_1_1enorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<ldmat></a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Constructs a predictive density .">epredictor</a>( <span class="keyword">const</span> vec &rgr) <span class="keyword">const</span>; |
58 | | <a name="l00075"></a><a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15">00075</a> <a class="code" href="classbdm_1_1enorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<ldmat></a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Constructs a predictive density .">epredictor</a>()<span class="keyword"> const </span>{it_assert_debug(rv0.count()==<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>);<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Constructs a predictive density .">epredictor</a>(vec_1(1.0));} |
59 | | <a name="l00077"></a>00077 <a class="code" href="classbdm_1_1mlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm<ldmat></a>* <a class="code" href="classbdm_1_1ARX.html#74fe8ae2d88bee8639510fd0eaf73513" title="conditional version of the predictor">predictor</a>() <span class="keyword">const</span>; |
60 | | <a name="l00078"></a>00078 <a class="code" href="classbdm_1_1mlstudent.html">mlstudent</a>* predictor_student() <span class="keyword">const</span>; |
61 | | <a name="l00080"></a>00080 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 ); |
62 | | <a name="l00081"></a>00081 <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> &<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a> ;}; |
63 | | <a name="l00082"></a>00082 }; |
64 | | <a name="l00083"></a>00083 |
65 | | <a name="l00084"></a>00084 } |
66 | | <a name="l00085"></a>00085 |
67 | | <a name="l00086"></a>00086 <span class="preprocessor">#endif // AR_H</span> |
68 | | <a name="l00087"></a>00087 <span class="preprocessor"></span> |
69 | | <a name="l00088"></a>00088 |
| 68 | <a name="l00039"></a><a class="code" href="classbdm_1_1ARX.html">00039</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> { |
| 69 | <a name="l00040"></a>00040 <span class="keyword">protected</span>: |
| 70 | <a name="l00042"></a><a class="code" href="classbdm_1_1ARX.html#8e68db2a218d54b09304cad6c0a897d9">00042</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>; |
| 71 | <a name="l00045"></a><a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">00045</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>; |
| 72 | <a name="l00047"></a><a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026">00047</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>; |
| 73 | <a name="l00049"></a><a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd">00049</a> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &<a class="code" href="classbdm_1_1ARX.html#de5b7d83ff5d3f5af2f80068db0abdfd" title="cached value of est.V">V</a>; |
| 74 | <a name="l00051"></a><a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f">00051</a> <span class="keywordtype">double</span> &<a class="code" href="classbdm_1_1ARX.html#740b0582f180ba13cae91d66e9bdb67f" title="cached value of est.nu">nu</a>; |
| 75 | <a name="l00052"></a>00052 <span class="keyword">public</span>: |
| 76 | <a name="l00055"></a>00055 <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() ) {}; |
| 77 | <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> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> &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> ( A0.<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() ) {}; |
| 78 | <a name="l00057"></a>00057 ARX* <a class="code" href="classbdm_1_1ARX.html#60c40b5c6abc4c7e464b4ccae64a5a61">_copy_</a>(); |
| 79 | <a name="l00058"></a>00058 <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;} |
| 80 | <a name="l00059"></a>00059 <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;} |
| 81 | <a name="l00061"></a>00061 |
| 82 | <a name="l00062"></a>00062 <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> |
| 83 | <a name="l00063"></a>00063 <span class="comment">// void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};</span> |
| 84 | <a name="l00065"></a>00065 <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 ); |
| 85 | <a name="l00066"></a>00066 <span class="comment">// //! Returns sufficient statistics</span> |
| 86 | <a name="l00067"></a>00067 <span class="comment">// void get_parameters ( mat &V0, double &nu0 ) {V0=est._V().to_mat(); nu0=est._nu();}</span> |
| 87 | <a name="l00070"></a>00070 <span class="comment"></span> |
| 88 | <a name="l00072"></a>00072 <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 &dt, <span class="keyword">const</span> <span class="keywordtype">double</span> w ); |
| 89 | <a name="l00073"></a><a class="code" href="classbdm_1_1ARX.html#8bdf2974052e8ce74eb0d4f3791c58a3">00073</a> <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 &dt ) {<a class="code" href="classbdm_1_1ARX.html#17e7fe14654ab3c449846c3f43e66169" title="Weighted Bayes .">bayes</a> ( dt,1.0 );}; |
| 90 | <a name="l00074"></a>00074 <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1ARX.html#080a7e531e3aa06694112863b15bc6a4">logpred</a> ( <span class="keyword">const</span> vec &dt ) <span class="keyword">const</span>; |
| 91 | <a name="l00075"></a><a class="code" href="classbdm_1_1ARX.html#e86ab499b116b837d3163ec852961eca">00075</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 ) { |
| 92 | <a name="l00076"></a>00076 <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<</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">></span> ( B ); |
| 93 | <a name="l00077"></a>00077 <span class="comment">// nu should be equal to B.nu</span> |
| 94 | <a name="l00078"></a>00078 <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-><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> ); |
| 95 | <a name="l00079"></a>00079 <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>();} |
| 96 | <a name="l00080"></a>00080 } |
| 97 | <a name="l00082"></a>00082 <a class="code" href="classbdm_1_1enorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<ldmat></a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a> ( <span class="keyword">const</span> vec &rgr ) <span class="keyword">const</span>; |
| 98 | <a name="l00084"></a><a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15">00084</a> <a class="code" href="classbdm_1_1enorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<ldmat></a>* <a class="code" href="classbdm_1_1ARX.html#4cdf5e2a7d3480ec31f6247ed4289b15" title="Predictor for empty regressor.">epredictor</a>()<span class="keyword"> const </span>{it_assert_debug ( <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_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</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> );<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 ) );} |
| 99 | <a name="l00086"></a>00086 <a class="code" href="classbdm_1_1mlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm<ldmat></a>* <a class="code" href="classbdm_1_1ARX.html#74fe8ae2d88bee8639510fd0eaf73513" title="conditional version of the predictor">predictor</a>() <span class="keyword">const</span>; |
| 100 | <a name="l00087"></a>00087 <a class="code" href="classbdm_1_1mlstudent.html">mlstudent</a>* predictor_student() <span class="keyword">const</span>; |
| 101 | <a name="l00089"></a>00089 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 ); |
| 102 | <a name="l00091"></a>00091 |
| 103 | <a name="l00094"></a>00094 <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> &<a class="code" href="classbdm_1_1ARX.html#11474a627367f81b76830cb8477cf026" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a> ;}; |
| 104 | <a name="l00095"></a>00095 <span class="keyword">const</span> egiw& 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>;} |
| 105 | <a name="l00097"></a>00097 |
| 106 | <a name="l00100"></a>00100 <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &drv0 ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=drv0;} |
| 107 | <a name="l00101"></a>00101 RV& get_yrv() { |
| 108 | <a name="l00102"></a>00102 <span class="comment">//if yrv is not ready create it</span> |
| 109 | <a name="l00103"></a>00103 <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> ) { |
| 110 | <a name="l00104"></a>00104 <span class="keywordtype">int</span> i=0; |
| 111 | <a name="l00105"></a>00105 <span class="keywordflow">while</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> ) {<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++;} |
| 112 | <a name="l00106"></a>00106 } |
| 113 | <a name="l00107"></a>00107 <span class="comment">//yrv should be ready by now</span> |
| 114 | <a name="l00108"></a>00108 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> ); |
| 115 | <a name="l00109"></a>00109 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1ARX.html#363aaa55b2ab3eec602510cdf53e84ef">_yrv</a>; |
| 116 | <a name="l00110"></a>00110 } |
| 117 | <a name="l00112"></a>00112 }; |
| 118 | <a name="l00113"></a>00113 |
| 119 | <a name="l00114"></a>00114 } |
| 120 | <a name="l00115"></a>00115 |
| 121 | <a name="l00116"></a>00116 <span class="preprocessor">#endif // AR_H</span> |
| 122 | <a name="l00117"></a>00117 <span class="preprocessor"></span> |
| 123 | <a name="l00118"></a>00118 |