root/doc/html/merger_8h-source.html @ 180

Revision 180, 10.8 kB (checked in by smidl, 16 years ago)

Modifications of BDM to reflect changes in basics

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: work/git/mixpp/bdm/estim/merger.h Source File</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.6 -->
8<div class="navigation" id="top">
9  <div class="tabs">
10    <ul>
11      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
13      <li><a href="annotated.html"><span>Classes</span></a></li>
14      <li class="current"><a href="files.html"><span>Files</span></a></li>
15    </ul>
16  </div>
17<h1>work/git/mixpp/bdm/estim/merger.h</h1><a href="merger_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
18<a name="l00013"></a>00013 <span class="preprocessor">#ifndef MER_H</span>
19<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define MER_H</span>
20<a name="l00015"></a>00015 <span class="preprocessor"></span>
21<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;itpp/itbase.h&gt;</span>
22<a name="l00017"></a>00017 <span class="preprocessor">#include "<a class="code" href="mixef_8h.html" title="Bayesian Filtering for mixtures of exponential family (EF) members.">mixef.h</a>"</span>
23<a name="l00018"></a>00018
24<a name="l00019"></a>00019 <span class="keyword">using namespace </span>itpp;
25<a name="l00020"></a>00020 <span class="keyword">using</span> std::string;
26<a name="l00021"></a>00021
27<a name="l00028"></a><a class="code" href="classmerger.html">00028</a> <span class="keyword">class </span><a class="code" href="classmerger.html" title="Function for general combination of pdfs.">merger</a> : <span class="keyword">public</span> <a class="code" href="classcompositepdf.html" title="Abstract composition of pdfs, a base for specific classes.">compositepdf</a>, <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> {
28<a name="l00029"></a>00029 <span class="keyword">protected</span>:
29<a name="l00031"></a><a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f">00031</a>         <a class="code" href="classMixEF.html" title="Mixture of Exponential Family Densities.">MixEF</a> <a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f" title="Internal mixture of EF models.">Mix</a>;
30<a name="l00033"></a><a class="code" href="classmerger.html#ce84de1824875b4262eefb640e8c6d69">00033</a>         <span class="keywordtype">int</span> <a class="code" href="classmerger.html#ce84de1824875b4262eefb640e8c6d69" title="Number of samples used in approximation.">Ns</a>;
31<a name="l00035"></a><a class="code" href="classmerger.html#6acf33e1c64aaaee20689725e8110f65">00035</a>         <span class="keywordtype">int</span> <a class="code" href="classmerger.html#6acf33e1c64aaaee20689725e8110f65" title="Number of components in a mixture.">Nc</a>;
32<a name="l00037"></a><a class="code" href="classmerger.html#e68a72e2740007ae68545e378c7701ad">00037</a>         <span class="keywordtype">double</span> <a class="code" href="classmerger.html#e68a72e2740007ae68545e378c7701ad" title="Prior on the log-normal merging model.">beta</a>;
33<a name="l00038"></a>00038 <span class="keyword">public</span>:
34<a name="l00040"></a><a class="code" href="classmerger.html#3f9a955329eab65026e8322e9027d469">00040</a>         <a class="code" href="classmerger.html#3f9a955329eab65026e8322e9027d469" title="Default constructor.">merger</a> ( <span class="keyword">const</span> Array&lt;mpdf*&gt; &amp;S ) :
35<a name="l00041"></a>00041                         <a class="code" href="classcompositepdf.html" title="Abstract composition of pdfs, a base for specific classes.">compositepdf</a> ( S ), <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( getrv ( false ) ),
36<a name="l00042"></a>00042                         <a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f" title="Internal mixture of EF models.">Mix</a> ( Array&lt;<a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a>*&gt; ( 0 ),vec ( 0 ) )
37<a name="l00043"></a>00043         { <a class="code" href="classmerger.html#e68a72e2740007ae68545e378c7701ad" title="Prior on the log-normal merging model.">beta</a>=2.0; <a class="code" href="classmerger.html#ce84de1824875b4262eefb640e8c6d69" title="Number of samples used in approximation.">Ns</a>=100; <a class="code" href="classmerger.html#6acf33e1c64aaaee20689725e8110f65" title="Number of components in a mixture.">Nc</a>=10;}
38<a name="l00045"></a><a class="code" href="classmerger.html#79420e251308df4502c834171d518ad9">00045</a>         <span class="keywordtype">void</span> <a class="code" href="classmerger.html#79420e251308df4502c834171d518ad9" title="Set internal parameters used in approximation.">set_parameters</a> ( <span class="keywordtype">double</span> beta0, <span class="keywordtype">int</span> Ns0, <span class="keywordtype">int</span> Nc0 ) {        <a class="code" href="classmerger.html#e68a72e2740007ae68545e378c7701ad" title="Prior on the log-normal merging model.">beta</a>=beta0;<a class="code" href="classmerger.html#ce84de1824875b4262eefb640e8c6d69" title="Number of samples used in approximation.">Ns</a>=Ns0;<a class="code" href="classmerger.html#6acf33e1c64aaaee20689725e8110f65" title="Number of components in a mixture.">Nc</a>=Nc0;}
39<a name="l00047"></a><a class="code" href="classmerger.html#02d2a445e44a87f37ee3a2b9b40cffd1">00047</a>         <span class="keywordtype">void</span> <a class="code" href="classmerger.html#02d2a445e44a87f37ee3a2b9b40cffd1" title="Initialize the proposal density. This function must be called before merge()!">init</a>() {
40<a name="l00048"></a>00048                 Array&lt;vec&gt; Smps ( <a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f" title="Number of mpdfs in the composite.">n</a> );
41<a name="l00049"></a>00049                 <span class="comment">//Gibbs sampling</span>
42<a name="l00050"></a>00050                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f" title="Number of mpdfs in the composite.">n</a>;i++ ) {Smps ( i ) =zeros ( 0 );}
43<a name="l00051"></a>00051         }
44<a name="l00053"></a>00053         <span class="keywordtype">void</span> <a class="code" href="classmerger.html#bc23accc77ec766bce7202934e2c180c" title="Create a mixture density, make sure to call init() before the first call.">merge</a> ( <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* g0 );
45<a name="l00055"></a><a class="code" href="classmerger.html#bc23accc77ec766bce7202934e2c180c">00055</a>         <span class="keywordtype">void</span> <a class="code" href="classmerger.html#bc23accc77ec766bce7202934e2c180c" title="Create a mixture density, make sure to call init() before the first call.">merge</a> () {<a class="code" href="classmerger.html#bc23accc77ec766bce7202934e2c180c" title="Create a mixture density, make sure to call init() before the first call.">merge</a> ( &amp; ( <a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f" title="Internal mixture of EF models.">Mix</a>.<a class="code" href="classMixEF.html#efb3e20c2151d91c4fc080b7722a2069" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</a>() ) );};
46<a name="l00056"></a>00056
47<a name="l00058"></a>00058         vec <a class="code" href="classmerger.html#217c65f335c603033fa09a2ecc64bc05" title="Merge log-likelihood values.">lognorm_merge</a> ( mat &amp;lW );
48<a name="l00061"></a><a class="code" href="classmerger.html#379198c3d2063bfa63f5d1245a2511ba">00061</a>         vec <a class="code" href="classmerger.html#379198c3d2063bfa63f5d1245a2511ba">sample</a> ( )<span class="keyword">const </span>{ <span class="keywordflow">return</span> <a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f" title="Internal mixture of EF models.">Mix</a>.<a class="code" href="classMixEF.html#efb3e20c2151d91c4fc080b7722a2069" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</a>().<a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample,  from density .">sample</a>();}
49<a name="l00062"></a><a class="code" href="classmerger.html#8c37688902b1a1e9fa32edc5709e5a00">00062</a>         <span class="keywordtype">double</span> <a class="code" href="classmerger.html#8c37688902b1a1e9fa32edc5709e5a00" title="Compute log-probability of argument val.">evalpdflog</a> ( <span class="keyword">const</span> vec &amp;dt )<span class="keyword"> const</span>{ <span class="keywordflow">return</span> <a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f" title="Internal mixture of EF models.">Mix</a>.<a class="code" href="classMixEF.html#efb3e20c2151d91c4fc080b7722a2069" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</a>().<a class="code" href="classepdf.html#6aef3eca74899692503769c18add1a4c" title="Compute log-probability of argument val.">evalpdflog</a> ( dt );}
50<a name="l00063"></a><a class="code" href="classmerger.html#3a46999cd77047d5d4ac6c1cb735a83e">00063</a>         vec <a class="code" href="classmerger.html#3a46999cd77047d5d4ac6c1cb735a83e" title="return expected value">mean</a>()<span class="keyword">const </span>{<span class="keywordflow">return</span> <a class="code" href="classmerger.html#021d1522cea70db8545d708afd32ec2f" title="Internal mixture of EF models.">Mix</a>.<a class="code" href="classMixEF.html#efb3e20c2151d91c4fc080b7722a2069" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</a>().<a class="code" href="classepdf.html#bf0a070a8f3e67a93604ca724638b870" title="return expected value">mean</a>();}
51<a name="l00065"></a><a class="code" href="classmerger.html#51e425ee1dd46d73353526e6a1c24ca3">00065</a>         <span class="keyword">virtual</span> <a class="code" href="classmerger.html#51e425ee1dd46d73353526e6a1c24ca3" title="for future use">~merger</a>() {};
52<a name="l00066"></a>00066 };
53<a name="l00067"></a>00067
54<a name="l00068"></a>00068
55<a name="l00069"></a>00069
56<a name="l00070"></a>00070 <span class="preprocessor">#endif // MER_H</span>
57</pre></div></div>
58<hr size="1"><address style="text-align: right;"><small>Generated on Thu Oct 9 21:26:31 2008 for mixpp by&nbsp;
59<a href="http://www.doxygen.org/index.html">
60<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
61</body>
62</html>
Note: See TracBrowser for help on using the browser.