[172] | 1 | \hypertarget{classMixEF}{ |
---|
| 2 | \section{MixEF Class Reference} |
---|
| 3 | \label{classMixEF}\index{MixEF@{MixEF}} |
---|
| 4 | } |
---|
| 5 | Mixture of Exponential Family Densities. |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | {\tt \#include $<$mixef.h$>$} |
---|
| 9 | |
---|
| 10 | Inheritance diagram for MixEF:\nopagebreak |
---|
| 11 | \begin{figure}[H] |
---|
| 12 | \begin{center} |
---|
| 13 | \leavevmode |
---|
| 14 | \includegraphics[width=43pt]{classMixEF__inherit__graph} |
---|
| 15 | \end{center} |
---|
| 16 | \end{figure} |
---|
| 17 | Collaboration diagram for MixEF:\nopagebreak |
---|
| 18 | \begin{figure}[H] |
---|
| 19 | \begin{center} |
---|
| 20 | \leavevmode |
---|
| 21 | \includegraphics[height=400pt]{classMixEF__coll__graph} |
---|
| 22 | \end{center} |
---|
| 23 | \end{figure} |
---|
| 24 | \subsection*{Public Member Functions} |
---|
| 25 | \begin{CompactItemize} |
---|
| 26 | \item |
---|
[180] | 27 | \hypertarget{classMixEF_509ac467674c39af46aba42297528aad}{ |
---|
| 28 | \hyperlink{classMixEF_509ac467674c39af46aba42297528aad}{MixEF} (const Array$<$ \hyperlink{classBMEF}{BMEF} $\ast$ $>$ \&Coms0, const vec \&alpha0)} |
---|
| 29 | \label{classMixEF_509ac467674c39af46aba42297528aad} |
---|
[172] | 30 | |
---|
| 31 | \begin{CompactList}\small\item\em Full constructor. \item\end{CompactList}\item |
---|
[180] | 32 | void \hyperlink{classMixEF_73a782d2f464c830bbdbb03d34c6d63e}{init} (\hyperlink{classBMEF}{BMEF} $\ast$Com0, const mat \&Data, int c=5) |
---|
[172] | 33 | \item |
---|
| 34 | \hypertarget{classMixEF_d520fb534aa43f3084ff1568ffe7573d}{ |
---|
| 35 | void \hyperlink{classMixEF_d520fb534aa43f3084ff1568ffe7573d}{bayes} (const vec \&dt)} |
---|
| 36 | \label{classMixEF_d520fb534aa43f3084ff1568ffe7573d} |
---|
| 37 | |
---|
| 38 | \begin{CompactList}\small\item\em Recursive EM-like algorithm (QB-variant), see Karny et. al, 2006. \item\end{CompactList}\item |
---|
| 39 | \hypertarget{classMixEF_4e0ad97868e55facffb37932dd44353f}{ |
---|
| 40 | void \hyperlink{classMixEF_4e0ad97868e55facffb37932dd44353f}{bayes} (const mat \&dt)} |
---|
| 41 | \label{classMixEF_4e0ad97868e55facffb37932dd44353f} |
---|
| 42 | |
---|
| 43 | \begin{CompactList}\small\item\em EM algorithm. \item\end{CompactList}\item |
---|
| 44 | \hypertarget{classMixEF_e6810daa121ccaff1ac18f26fbad4563}{ |
---|
| 45 | void \hyperlink{classMixEF_e6810daa121ccaff1ac18f26fbad4563}{bayesB} (const mat \&dt)} |
---|
| 46 | \label{classMixEF_e6810daa121ccaff1ac18f26fbad4563} |
---|
| 47 | |
---|
| 48 | \begin{CompactList}\small\item\em Batch Bayes rule (columns of Dt are observations). \item\end{CompactList}\item |
---|
| 49 | double \hyperlink{classMixEF_424ca64f36d4e41de7a7e7ae921d35ea}{logpred} (const vec \&dt) const |
---|
| 50 | \item |
---|
| 51 | \hypertarget{classMixEF_efb3e20c2151d91c4fc080b7722a2069}{ |
---|
| 52 | const \hyperlink{classepdf}{epdf} \& \hyperlink{classMixEF_efb3e20c2151d91c4fc080b7722a2069}{\_\-epdf} () const } |
---|
| 53 | \label{classMixEF_efb3e20c2151d91c4fc080b7722a2069} |
---|
| 54 | |
---|
| 55 | \begin{CompactList}\small\item\em Returns a pointer to the \hyperlink{classepdf}{epdf} representing posterior density on parameters. Use with care! \item\end{CompactList}\item |
---|
[181] | 56 | \hypertarget{classMixEF_a93379cf31bb25961ea7f8d3f095513d}{ |
---|
| 57 | \hyperlink{classemix}{emix} $\ast$ \hyperlink{classMixEF_a93379cf31bb25961ea7f8d3f095513d}{predictor} (const \hyperlink{classRV}{RV} \&\hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv})} |
---|
| 58 | \label{classMixEF_a93379cf31bb25961ea7f8d3f095513d} |
---|
| 59 | |
---|
| 60 | \begin{CompactList}\small\item\em Constructs a predictive density (marginal density on data). \item\end{CompactList}\item |
---|
| 61 | \hypertarget{classMixEF_fdbd5f58778c1ecb68b71945cdff0483}{ |
---|
| 62 | void \hyperlink{classMixEF_fdbd5f58778c1ecb68b71945cdff0483}{flatten} (double sumw=1.0)} |
---|
| 63 | \label{classMixEF_fdbd5f58778c1ecb68b71945cdff0483} |
---|
| 64 | |
---|
| 65 | \begin{CompactList}\small\item\em Flatten the density as if it was not estimated from the data. \item\end{CompactList}\item |
---|
[180] | 66 | \hypertarget{classBM_cd0660f2a1a344b56ac39802708ff165}{ |
---|
| 67 | vec \hyperlink{classBM_cd0660f2a1a344b56ac39802708ff165}{logpred\_\-m} (const mat \&dt) const } |
---|
| 68 | \label{classBM_cd0660f2a1a344b56ac39802708ff165} |
---|
| 69 | |
---|
| 70 | \begin{CompactList}\small\item\em Matrix version of logpred. \item\end{CompactList}\item |
---|
[172] | 71 | \hypertarget{classBM_126bd2595c48e311fc2a7ab72876092a}{ |
---|
| 72 | const \hyperlink{classRV}{RV} \& \hyperlink{classBM_126bd2595c48e311fc2a7ab72876092a}{\_\-rv} () const } |
---|
| 73 | \label{classBM_126bd2595c48e311fc2a7ab72876092a} |
---|
| 74 | |
---|
| 75 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
| 76 | \hypertarget{classBM_87f4a547d2c29180be88175e5eab9c88}{ |
---|
| 77 | double \hyperlink{classBM_87f4a547d2c29180be88175e5eab9c88}{\_\-ll} () const } |
---|
| 78 | \label{classBM_87f4a547d2c29180be88175e5eab9c88} |
---|
| 79 | |
---|
| 80 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
| 81 | \hypertarget{classBM_1ffa9f23669aabecc3760c06c6987522}{ |
---|
| 82 | void \hyperlink{classBM_1ffa9f23669aabecc3760c06c6987522}{set\_\-evalll} (bool evl0)} |
---|
| 83 | \label{classBM_1ffa9f23669aabecc3760c06c6987522} |
---|
| 84 | |
---|
| 85 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
| 86 | virtual \hyperlink{classBM}{BM} $\ast$ \hyperlink{classBM_eb58c81d6a7b75b05fc6f276eed78887}{\_\-copy\_\-} (bool changerv=false) |
---|
| 87 | \end{CompactItemize} |
---|
| 88 | \subsection*{Protected Member Functions} |
---|
| 89 | \begin{CompactItemize} |
---|
| 90 | \item |
---|
| 91 | \hypertarget{classMixEF_5ae381b3a7dfbe2c1e5bb579a5d9b9d1}{ |
---|
| 92 | void \hyperlink{classMixEF_5ae381b3a7dfbe2c1e5bb579a5d9b9d1}{build\_\-est} ()} |
---|
| 93 | \label{classMixEF_5ae381b3a7dfbe2c1e5bb579a5d9b9d1} |
---|
| 94 | |
---|
| 95 | \begin{CompactList}\small\item\em Auxiliary function for use in constructors. \item\end{CompactList}\end{CompactItemize} |
---|
| 96 | \subsection*{Protected Attributes} |
---|
| 97 | \begin{CompactItemize} |
---|
| 98 | \item |
---|
| 99 | \hypertarget{classMixEF_e9cc9bb3e6da801455cec99a59aea149}{ |
---|
| 100 | int \hyperlink{classMixEF_e9cc9bb3e6da801455cec99a59aea149}{n}} |
---|
| 101 | \label{classMixEF_e9cc9bb3e6da801455cec99a59aea149} |
---|
| 102 | |
---|
| 103 | \begin{CompactList}\small\item\em Number of components. \item\end{CompactList}\item |
---|
| 104 | \hypertarget{classMixEF_4c4a140ca4e6e71b00237b7bc754302e}{ |
---|
| 105 | Array$<$ \hyperlink{classBMEF}{BMEF} $\ast$ $>$ \hyperlink{classMixEF_4c4a140ca4e6e71b00237b7bc754302e}{Coms}} |
---|
| 106 | \label{classMixEF_4c4a140ca4e6e71b00237b7bc754302e} |
---|
| 107 | |
---|
| 108 | \begin{CompactList}\small\item\em Models for Components of $\theta_i$. \item\end{CompactList}\item |
---|
| 109 | \hypertarget{classMixEF_d906782a0a9558f19150dc69411f717f}{ |
---|
| 110 | \hyperlink{classmultiBM}{multiBM} \hyperlink{classMixEF_d906782a0a9558f19150dc69411f717f}{weights}} |
---|
| 111 | \label{classMixEF_d906782a0a9558f19150dc69411f717f} |
---|
| 112 | |
---|
| 113 | \begin{CompactList}\small\item\em Statistics for weights. \item\end{CompactList}\item |
---|
| 114 | \hypertarget{classMixEF_33968f1325137cc6f4431f0cf05096dc}{ |
---|
| 115 | \hyperlink{classeprod}{eprod} $\ast$ \hyperlink{classMixEF_33968f1325137cc6f4431f0cf05096dc}{est}} |
---|
| 116 | \label{classMixEF_33968f1325137cc6f4431f0cf05096dc} |
---|
| 117 | |
---|
| 118 | \begin{CompactList}\small\item\em Posterior on component parameters. \item\end{CompactList}\item |
---|
| 119 | \hypertarget{classBM_af00f0612fabe66241dd507188cdbf88}{ |
---|
| 120 | \hyperlink{classRV}{RV} \hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv}} |
---|
| 121 | \label{classBM_af00f0612fabe66241dd507188cdbf88} |
---|
| 122 | |
---|
| 123 | \begin{CompactList}\small\item\em Random variable of the posterior. \item\end{CompactList}\item |
---|
| 124 | \hypertarget{classBM_5623fef6572a08c2b53b8c87b82dc979}{ |
---|
| 125 | double \hyperlink{classBM_5623fef6572a08c2b53b8c87b82dc979}{ll}} |
---|
| 126 | \label{classBM_5623fef6572a08c2b53b8c87b82dc979} |
---|
| 127 | |
---|
| 128 | \begin{CompactList}\small\item\em Logarithm of marginalized data likelihood. \item\end{CompactList}\item |
---|
| 129 | \hypertarget{classBM_bf6fb59b30141074f8ee1e2f43d03129}{ |
---|
| 130 | bool \hyperlink{classBM_bf6fb59b30141074f8ee1e2f43d03129}{evalll}} |
---|
| 131 | \label{classBM_bf6fb59b30141074f8ee1e2f43d03129} |
---|
| 132 | |
---|
| 133 | \begin{CompactList}\small\item\em If true, the filter will compute likelihood of the data record and store it in {\tt ll} . Set to false if you want to save computational time. \item\end{CompactList}\end{CompactItemize} |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | \subsection{Detailed Description} |
---|
| 137 | Mixture of Exponential Family Densities. |
---|
| 138 | |
---|
| 139 | An approximate estimation method for models with latent discrete variable, such as mixture models of the following kind: \[ f(y_t|\psi_t, \Theta) = \sum_{i=1}^{n} w_i f(y_t|\psi_t, \theta_i) \] where $\psi$ is a known function of past outputs, $w=[w_1,\ldots,w_n]$ are component weights, and component parameters $\theta_i$ are assumed to be mutually independent. $\Theta$ is an aggregation af all component parameters and weights, i.e. $\Theta = [\theta_1,\ldots,\theta_n,w]$. |
---|
| 140 | |
---|
| 141 | The characteristic feature of this model is that if the exact values of the latent variable were known, estimation of the parameters can be handled by a single model. For example, for the case of mixture models, posterior density for each component parameters would be a BayesianModel from Exponential Family. |
---|
| 142 | |
---|
[181] | 143 | This class uses EM-style type algorithms for estimation of its parameters. Under this simplification, the posterior density is a product of exponential family members, hence under EM-style approximate estimation this class itself belongs to the exponential family. |
---|
[172] | 144 | |
---|
| 145 | TODO: Extend \hyperlink{classBM}{BM} to use rvc. |
---|
| 146 | |
---|
[180] | 147 | \subsection{Member Function Documentation} |
---|
| 148 | \hypertarget{classMixEF_73a782d2f464c830bbdbb03d34c6d63e}{ |
---|
| 149 | \index{MixEF@{MixEF}!init@{init}} |
---|
| 150 | \index{init@{init}!MixEF@{MixEF}} |
---|
| 151 | \subsubsection[init]{\setlength{\rightskip}{0pt plus 5cm}void MixEF::init ({\bf BMEF} $\ast$ {\em Com0}, \/ const mat \& {\em Data}, \/ int {\em c} = {\tt 5})}} |
---|
| 152 | \label{classMixEF_73a782d2f464c830bbdbb03d34c6d63e} |
---|
[172] | 153 | |
---|
| 154 | |
---|
[180] | 155 | Initializing the mixture by a random pick of centroids from data \begin{Desc} |
---|
[172] | 156 | \item[Parameters:] |
---|
| 157 | \begin{description} |
---|
| 158 | \item[{\em Com0}]Initial component - necessary to determine its type. \item[{\em Data}]Data on which the initialization will be done \item[{\em c}]Initial number of components, default=5 \end{description} |
---|
| 159 | \end{Desc} |
---|
| 160 | |
---|
| 161 | |
---|
[180] | 162 | References BM::\_\-copy\_\-(), build\_\-est(), Coms, est, n, multiBM::set\_\-parameters(), and weights. |
---|
[172] | 163 | |
---|
[180] | 164 | Referenced by merger::merge().\hypertarget{classMixEF_424ca64f36d4e41de7a7e7ae921d35ea}{ |
---|
[172] | 165 | \index{MixEF@{MixEF}!logpred@{logpred}} |
---|
| 166 | \index{logpred@{logpred}!MixEF@{MixEF}} |
---|
| 167 | \subsubsection[logpred]{\setlength{\rightskip}{0pt plus 5cm}double MixEF::logpred (const vec \& {\em dt}) const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}} |
---|
| 168 | \label{classMixEF_424ca64f36d4e41de7a7e7ae921d35ea} |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | Evaluates predictive log-likelihood of the given data record I.e. marginal likelihood of the data with the posterior integrated out. |
---|
| 172 | |
---|
| 173 | Reimplemented from \hyperlink{classBM_8a8ce6df431689964c41cc6c849cfd06}{BM}. |
---|
| 174 | |
---|
[180] | 175 | References multiBM::\_\-epdf(), Coms, epdf::mean(), n, and weights. |
---|
| 176 | |
---|
[181] | 177 | Referenced by merger::evalpdflog(), and merger::merge().\hypertarget{classBM_eb58c81d6a7b75b05fc6f276eed78887}{ |
---|
[172] | 178 | \index{MixEF@{MixEF}!\_\-copy\_\-@{\_\-copy\_\-}} |
---|
| 179 | \index{\_\-copy\_\-@{\_\-copy\_\-}!MixEF@{MixEF}} |
---|
| 180 | \subsubsection[\_\-copy\_\-]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf BM}$\ast$ BM::\_\-copy\_\- (bool {\em changerv} = {\tt false})\hspace{0.3cm}{\tt \mbox{[}inline, virtual, inherited\mbox{]}}}} |
---|
| 181 | \label{classBM_eb58c81d6a7b75b05fc6f276eed78887} |
---|
| 182 | |
---|
| 183 | |
---|
| 184 | Copy function required in vectors, Arrays of \hyperlink{classBM}{BM} etc. Have to be DELETED manually! Prototype: BM$\ast$ \hyperlink{classBM_eb58c81d6a7b75b05fc6f276eed78887}{\_\-copy\_\-()}\{\hyperlink{classBM}{BM} Tmp$\ast$=new Tmp(this$\ast$); return Tmp; \} |
---|
| 185 | |
---|
[180] | 186 | Reimplemented in \hyperlink{classARX_5de61fbd4f97fa3216760b1f733f5af0}{ARX}. |
---|
[172] | 187 | |
---|
[180] | 188 | Referenced by init(). |
---|
[172] | 189 | |
---|
| 190 | The documentation for this class was generated from the following files:\begin{CompactItemize} |
---|
| 191 | \item |
---|
| 192 | work/git/mixpp/bdm/estim/\hyperlink{mixef_8h}{mixef.h}\item |
---|
| 193 | work/git/mixpp/bdm/estim/mixef.cpp\end{CompactItemize} |
---|