Changeset 271 for doc/html/intro.html

Show
Ignore:
Timestamp:
02/16/09 10:03:13 (15 years ago)
Author:
smidl
Message:

Next major revision

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • doc/html/intro.html

    r210 r271  
    66</head><body> 
    77<!-- Generated by Doxygen 1.5.6 --> 
     8<script type="text/javascript"> 
     9<!-- 
     10function changeDisplayState (e){ 
     11  var num=this.id.replace(/[^[0-9]/g,''); 
     12  var button=this.firstChild; 
     13  var sectionDiv=document.getElementById('dynsection'+num); 
     14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ 
     15    sectionDiv.style.display='block'; 
     16    button.src='open.gif'; 
     17  }else{ 
     18    sectionDiv.style.display='none'; 
     19    button.src='closed.gif'; 
     20  } 
     21} 
     22function initDynSections(){ 
     23  var divs=document.getElementsByTagName('div'); 
     24  var sectionCounter=1; 
     25  for(var i=0;i<divs.length-1;i++){ 
     26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ 
     27      var header=divs[i]; 
     28      var section=divs[i+1]; 
     29      var button=header.firstChild; 
     30      if (button!='IMG'){ 
     31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); 
     32        button=document.createElement('img'); 
     33        divs[i].insertBefore(button,divs[i].firstChild); 
     34      } 
     35      header.style.cursor='pointer'; 
     36      header.onclick=changeDisplayState; 
     37      header.id='dynheader'+sectionCounter; 
     38      button.src='closed.gif'; 
     39      section.id='dynsection'+sectionCounter; 
     40      section.style.display='none'; 
     41      section.style.marginLeft='14px'; 
     42      sectionCounter++; 
     43    } 
     44  } 
     45} 
     46window.onload = initDynSections; 
     47--> 
     48</script> 
    849<div class="navigation" id="top"> 
    950  <div class="tabs"> 
    1051    <ul> 
    11       <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> 
     52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li> 
    1253      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li> 
    13       <li><a href="annotated.html"><span>Classes</span></a></li> 
     54      <li><a href="modules.html"><span>Modules</span></a></li> 
     55      <li><a href="classes.html"><span>Classes</span></a></li> 
    1456      <li><a href="files.html"><span>Files</span></a></li> 
    1557    </ul> 
     58  </div> 
     59  <div class="navpath"><a class="el" href="manual.html">User Manual</a> 
    1660  </div> 
    1761</div> 
     
    2569</ul> 
    2670Theoretically, the latter is a special case of the former, however we list it separately to highlight its importance in practical applications.<p> 
    27 In order to achieve these principal goals in full generality, we need to implement full range of probabilistic operations such as: marginalization, conditioning, Bayes rule, combination of probability densities. Furthermore, many supportive operations are also required, such as data handling and logging of results. Here, we explain the basic classes for each task and point to advanced topics on the issue.<h2><a class="anchor" name="phil"> 
    28 Philosophy of the Toolbox</a></h2> 
    29 The primary obstacle for creation of any any Bayesian software is how to address inherent computational intractability of the calculus. Typically, toolboxes implementing Bayesian calculus choose one particular task or one particular approximation methodology. For example, "BUGS" is a toolbox focused on evaluation using Gibbs sampling, "BNT" is focused on Bayesian Networks, "NFT" on Bayesian filtering. BDM takes another approach: <b> all tasks are defined via their functional form, detailed implementation is an internal matter of each class.</b><p> 
    30 This philosophy results in a tree structure of inheritance, where the root is an abstract class. Different approaches to Bayesian calculus are implemented as specialization of this class. Interoperability of these classes is achieved by data classes, representing mathematical objects arising in the Bayesian calculus.<p> 
    31 The task of Bayesian estimation decribed in the next Section is a good illustration of the philosophy.<h2><a class="anchor" name="bayes"> 
    32 Bayesian parameter estimation</a></h2> 
    33 Bayesian parameter estimation is, in essence, straightforward application of the Bayes rule:<p class="formulaDsp"> 
    34 <img class="formulaDsp" alt="\[ f(\theta|D) =\frac{f(D|\theta)f(\theta)}{f(D)}\]" src="form_81.png"> 
    35 <p> 
    36  where, <img class="formulaInl" alt="$ \theta $" src="form_82.png"> is an unknown parameter, <img class="formulaInl" alt="$ D $" src="form_83.png"> denotes the observed data, <img class="formulaInl" alt="$ f(D|\theta) $" src="form_84.png"> is the likelihood function, <img class="formulaInl" alt="$ f(\theta) $" src="form_85.png"> is the prior density, and <img class="formulaInl" alt="$ f(D) $" src="form_86.png"> is "evidence" of the data.<p> 
    37 This simple rule has, however, many incarnations for various types of the likelihood, prior and evidence. For example, the Bayes rule can be evaluated exactly for likelihood function from the Exponential Family and conjugate prior, where the whole functional operation reduces to algebraic operation on sufficient statistics. For other likelihood functions and priors, various approximate schemes (such as Monte Carlo sampling, or maximum-likelihood optimizations) were proposed. To capture all of these options, we abstract the core functionality in the class <code><a class="el" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>:</code> <p> 
    38 <dl> 
     71Here, we describe basic objects that are required for implementation of the Bayesian parameter estimation.<p> 
     72Key objects are: <dl> 
     73<dt>Bayesian Model: class <code>BM</code>  </dt> 
     74<dd>which is an encapsulation of the likelihood function, the prior and methodology of evaluation of the Bayes rule. This methodology may be either exact or approximate. </dd> 
     75<dt>Posterior density of the parameter: class <code>epdf</code>  </dt> 
     76<dd>representing posterior density of the parameter. Methods defined on this class allow any manipulation of the posterior, such as moment evaluation, marginalization and conditioning.  </dd> 
    3977</dl> 
    40 <a class="el" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>, abstract class defining two key methods: <ul> 
     78<h2><a class="anchor" name="bm"> 
     79Class BM</a></h2> 
     80The class BM is designed for both on-line and off-line estimation. We make the following assumptions about data: <ul> 
    4181<li> 
    42 <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> bayes(vec dt)  
    43 </pre></div> or <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> bayesB(mat D)  
    44 </pre></div>  </li> 
     82an individual data record is stored in a vector, <code>vec</code> <code>dt</code>,  </li> 
    4583<li> 
    46 <div class="fragment"><pre class="fragment"> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>&amp; _epdf().  
    47 </pre></div>  </li> 
     84a set of data records is stored in a matrix,<code>mat</code> <code>D</code>, where each column represent one individual data record  </li> 
    4885</ul> 
    4986<p> 
    50 Hence, the class represent an "estimator" that is capable of returning a posterior density (via method <code>_epdf</code> ) and application of the Bayes rule vis method <code>bayes</code> .<p> 
    51 Functions <code>bayes</code> and <code>bayesB</code> denotes on-line and off-line scenario, respectively. Function <code>bayes</code> assumes that <dl compact><dt><b>Parameters:</b></dt><dd> 
    52   <table border="0" cellspacing="2" cellpadding="0"> 
    53     <tr><td valign="top"></td><td valign="top"><em>dt</em>&nbsp;</td><td>is an incremental data record and applies the Bayes rule using posterior density for the previous step as a prior. On the other hand, <code>bayesB</code> assumes that </td></tr> 
    54     <tr><td valign="top"></td><td valign="top"><em>D</em>&nbsp;</td><td>is the full data record, and uses the original prior created during construction of the object.</td></tr> 
    55   </table> 
    56 </dl> 
    57 Posterior density is represented by a class <code><a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a></code> . When we are interested only in part of the posterior density we can apply probability calculus via methods of this class.<h2><a class="anchor" name="calc"> 
    58 Probability calculus</a></h2> 
    59 Key objects of probability calculus are probability density functions, pdfs. We distinguish two types of pdfs: <dl> 
    60 </dl> 
    61 <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>, a pdf fully defined by statistics: <img class="formulaInl" alt="$ f(a | S)$" src="form_87.png">, with numerical statics <img class="formulaInl" alt="$ S $" src="form_88.png">, and   <a class="el" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>, a pdf conditioned on another random variable: <img class="formulaInl" alt="$ f(a| b) $" src="form_89.png">, where <img class="formulaInl" alt="$ b $" src="form_90.png"> is a variable. <p> 
    62 The principal distinction between these types is that operations defined on these classes have different results. For example, the first moment of the former is a numeric value, while for the latter it is a functional form.<p> 
    63 The most important operations on pdfs are: <dl> 
    64 </dl> 
    65 evaluation in a point: implemented by methods <div class="fragment"><pre class="fragment"> <span class="keywordtype">double</span> evallog(vec dt) 
    66 </pre></div> for <code><a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a></code> and <div class="fragment"><pre class="fragment"> <span class="keywordtype">double</span> evallogcond() 
    67 </pre></div> for <code><a class="el" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a></code>.   marginalization: implemented by method <div class="fragment"><pre class="fragment"> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* marginal(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv) 
    68 </pre></div> for <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>,   conditioning: implemented by method <div class="fragment"><pre class="fragment"> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* conditional(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv) 
    69 </pre></div> for <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.  <p> 
    70 Note that a new data class, <code><a class="el" href="classRV.html" title="Class representing variables, most often random variables.">RV</a></code>, is introduced. This class represents description of a multivariate random variable.<h2><a class="anchor" name="RVs"> 
    71 Random Variables</a></h2> 
    72 In mathematics, variable is a symbol of quantity that has no assigned value. Its purpose is to distinguish one variable from another. Hence, in software representation it has a meaning of unique identifier. Since we allow multivariate random variables, the variable also carries its dimensionality. Moreover, for dealing with time-varying estimation it also makes sense to distinguish different time-shift of variables.<p> 
    73 The main purpose of this class is to mediate composition and decomposition of pdfs. See,... </div> 
    74 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Nov 12 20:46:07 2008 for mixpp by&nbsp; 
     87On-line estimation is implemented by method <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> bayes(vec dt) 
     88</pre></div> Off-line estimation is implemented by method <div class="fragment"><pre class="fragment"> <span class="keywordtype">void</span> bayesB(mat D) 
     89</pre></div><p> 
     90As an intermediate product, the bayes rule computes marginal likelihood of the data records <img class="formulaInl" alt="$ f(D) $" src="form_86.png">. Numerical value of this quantity which is important e.g. for model selection can be obtained by calling method <code>_ll()</code>.<h2><a class="anchor" name="epdf"> 
     91Getting results from BM</a></h2> 
     92Class <code>BM</code> offers several ways how to obtain results: <ul> 
     93<li> 
     94generation of posterior or predictive pdfs, methods <code>_epdf()</code> and <code>predictor()</code>  </li> 
     95<li> 
     96direct evaluation of predictive likelihood, method <code>logpred()</code>  </li> 
     97</ul> 
     98Underscore in the name of method <code>_epdf()</code> indicate that the method returns a pointer to the internal posterior density of the model. On the other hand, <code>predictor</code> creates a new structure of type <code>epdf()</code>.<p> 
     99Direct evaluation of predictive pdfs via logpred offers a shortcut for more efficient implementation.<h2><a class="anchor" name="epdf"> 
     100Getting results from BM</a></h2> 
     101As introduced above, the results of parameter estimation are in the form of probability density function conditioned on numerical values. This type of information is represented by class <code>epdf</code>.<p> 
     102This class allows such as moment evaluation via methods <code>mean()</code> and <code>variance()</code>, marginalization via method <code>marginal()</code>, and conditioning via method <code>condition()</code>.<p> 
     103Also, it allows generation of a sample via <code>sample()</code> and evaluation of one value of the posterior parameter likelihood via <code>evallog()</code>. Multivariate versions of these operations are also available by adding suffix <code>_m</code>, i.e. <code>sample_m()</code> and <code>evallog_m()</code>. These methods providen multiple samples and evaluation of likelihood in multiple points respectively.<h2><a class="anchor" name="pc"> 
     104Classes for probability calculus</a></h2> 
     105When a more demanding task then generation of point estimate of the parameter is required, the power of general probability claculus can be used. The following classes (together with <code>epdf</code> introduced above) form the basis of the calculus: <ul> 
     106<li> 
     107<code>mpdf</code> a pdf conditioned on another symbolic variable, </li> 
     108<li> 
     109<code>RV</code> a symbolic variable on which pdfs are defined. </li> 
     110</ul> 
     111The former class is an extension of mpdf that allows conditioning on a symbolic variable. Hence, when numerical results - such as samples - are required, numericla values of the condition must be provided. The names of methods of the <code>epdf</code> are used extended by suffix <code>cond</code>, i.e. <code>samplecond()</code>, <code>evallogcond()</code>, where <code>cond</code> precedes matrix estension, i.e. <code>samplecond_m()</code> and <code>evallogcond_m()</code>.<p> 
     112The latter class is used to identify how symbolic variables are to be combined together. For example, consider the task of composition of pdfs via the chain rule: <p class="formulaDsp"> 
     113<img class="formulaDsp" alt="\[ f(a,b,c) = f(a|b,c) f(b) f(c) \]" src="form_89.png"> 
     114<p> 
     115 In our setup, <img class="formulaInl" alt="$ f(a|b,c) $" src="form_90.png"> is represented by an <code>mpdf</code> while <img class="formulaInl" alt="$ f(b) $" src="form_91.png"> and <img class="formulaInl" alt="$ f(c) $" src="form_92.png"> by two <code>epdfs</code>. We need to distinguish the latter two from each other and to deside in which order they should be added to the mpdf. This distinction is facilitated by the class <code>RV</code> which uniquely identify a random varibale.<p> 
     116Therefore, each pdf keeps record on which RVs it represents; <code>epdf</code> needs to know only one <code>RV</code> stored in the attribute <code>rv</code>; <code>mpdf</code> needs to keep two <code>RVs</code>, one for variable on which it is defined (<code>rv</code>) and one for variable incondition which is stored in attribute <code>rvc</code>. </div> 
     117<hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 15 23:09:26 2009 for mixpp by&nbsp; 
    75118<a href="http://www.doxygen.org/index.html"> 
    76119<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>