root/doc/latex/classMixEF.tex @ 250

Revision 219, 13.3 kB (checked in by smidl, 16 years ago)

doc

Line 
1\hypertarget{classMixEF}{
2\section{MixEF Class Reference}
3\label{classMixEF}\index{MixEF@{MixEF}}
4}
5Mixture of Exponential Family Densities. 
6
7
8{\tt \#include $<$mixef.h$>$}
9
10Inheritance 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}
17Collaboration 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 
27\hypertarget{classMixEF_509ac467674c39af46aba42297528aad}{
28\hyperlink{classMixEF_509ac467674c39af46aba42297528aad}{MixEF} (const Array$<$ \hyperlink{classBMEF}{BMEF} $\ast$ $>$ \&Coms0, const vec \&alpha0)}
29\label{classMixEF_509ac467674c39af46aba42297528aad}
30
31\begin{CompactList}\small\item\em Full constructor. \item\end{CompactList}\item 
32\hypertarget{classMixEF_51fa3e3953c0af69f4e0162829d7929d}{
33\hyperlink{classMixEF_51fa3e3953c0af69f4e0162829d7929d}{MixEF} ()}
34\label{classMixEF_51fa3e3953c0af69f4e0162829d7929d}
35
36\begin{CompactList}\small\item\em Constructor of empty mixture. \item\end{CompactList}\item 
37\hypertarget{classMixEF_5f4880febf28803471694d87eab81ec4}{
38\hyperlink{classMixEF_5f4880febf28803471694d87eab81ec4}{MixEF} (const \hyperlink{classMixEF}{MixEF} \&M2)}
39\label{classMixEF_5f4880febf28803471694d87eab81ec4}
40
41\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
42void \hyperlink{classMixEF_73a782d2f464c830bbdbb03d34c6d63e}{init} (\hyperlink{classBMEF}{BMEF} $\ast$Com0, const mat \&Data, int c=5)
43\item 
44\hypertarget{classMixEF_d520fb534aa43f3084ff1568ffe7573d}{
45void \hyperlink{classMixEF_d520fb534aa43f3084ff1568ffe7573d}{bayes} (const vec \&dt)}
46\label{classMixEF_d520fb534aa43f3084ff1568ffe7573d}
47
48\begin{CompactList}\small\item\em Recursive EM-like algorithm (QB-variant), see Karny et. al, 2006. \item\end{CompactList}\item 
49\hypertarget{classMixEF_4e0ad97868e55facffb37932dd44353f}{
50void \hyperlink{classMixEF_4e0ad97868e55facffb37932dd44353f}{bayes} (const mat \&dt)}
51\label{classMixEF_4e0ad97868e55facffb37932dd44353f}
52
53\begin{CompactList}\small\item\em EM algorithm. \item\end{CompactList}\item 
54\hypertarget{classMixEF_8f4672ce35c35eec6a7f9c18ce3871a3}{
55void \textbf{bayesB} (const mat \&dt, const vec \&wData)}
56\label{classMixEF_8f4672ce35c35eec6a7f9c18ce3871a3}
57
58\item 
59double \hyperlink{classMixEF_424ca64f36d4e41de7a7e7ae921d35ea}{logpred} (const vec \&dt) const
60\item 
61\hypertarget{classMixEF_efb3e20c2151d91c4fc080b7722a2069}{
62const \hyperlink{classepdf}{epdf} \& \hyperlink{classMixEF_efb3e20c2151d91c4fc080b7722a2069}{\_\-epdf} () const }
63\label{classMixEF_efb3e20c2151d91c4fc080b7722a2069}
64
65\begin{CompactList}\small\item\em Returns a reference to the \hyperlink{classepdf}{epdf} representing posterior density on parameters. \item\end{CompactList}\item 
66\hypertarget{classMixEF_324c2f0f7f9a9ee123073c15aeb8d0c1}{
67const \hyperlink{classeprod}{eprod} $\ast$ \hyperlink{classMixEF_324c2f0f7f9a9ee123073c15aeb8d0c1}{\_\-e} () const }
68\label{classMixEF_324c2f0f7f9a9ee123073c15aeb8d0c1}
69
70\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 
71\hypertarget{classMixEF_4d5b5c25280a50df1edfa2c03540d0ac}{
72\hyperlink{classemix}{emix} $\ast$ \hyperlink{classMixEF_4d5b5c25280a50df1edfa2c03540d0ac}{predictor} (const \hyperlink{classRV}{RV} \&\hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv}) const }
73\label{classMixEF_4d5b5c25280a50df1edfa2c03540d0ac}
74
75\begin{CompactList}\small\item\em Constructs a predictive density (marginal density on data). \item\end{CompactList}\item 
76\hypertarget{classMixEF_7d4d571688a15cc5be10f6f48bfc433d}{
77void \hyperlink{classMixEF_7d4d571688a15cc5be10f6f48bfc433d}{flatten} (const \hyperlink{classBMEF}{BMEF} $\ast$M2)}
78\label{classMixEF_7d4d571688a15cc5be10f6f48bfc433d}
79
80\begin{CompactList}\small\item\em Flatten the density as if it was not estimated from the data. \item\end{CompactList}\item 
81\hypertarget{classMixEF_959d9b078766e251a3089b501ed78513}{
82\hyperlink{classBMEF}{BMEF} $\ast$ \hyperlink{classMixEF_959d9b078766e251a3089b501ed78513}{\_\-Coms} (int i)}
83\label{classMixEF_959d9b078766e251a3089b501ed78513}
84
85\begin{CompactList}\small\item\em Access function. \item\end{CompactList}\item 
86\hypertarget{classMixEF_6576024e16523da5cbaaf233512c53dc}{
87void \hyperlink{classMixEF_6576024e16523da5cbaaf233512c53dc}{set\_\-method} (MixEF\_\-METHOD M)}
88\label{classMixEF_6576024e16523da5cbaaf233512c53dc}
89
90\begin{CompactList}\small\item\em Set which method is to be used. \item\end{CompactList}\item 
91\hypertarget{classBMEF_30bb40eb1fd31869b2e62e79e1ecdcb4}{
92virtual void \hyperlink{classBMEF_30bb40eb1fd31869b2e62e79e1ecdcb4}{set\_\-statistics} (const \hyperlink{classBMEF}{BMEF} $\ast$BM0)}
93\label{classBMEF_30bb40eb1fd31869b2e62e79e1ecdcb4}
94
95\begin{CompactList}\small\item\em get statistics from another model \item\end{CompactList}\item 
96\hypertarget{classBMEF_8f4ecb6e2eaf630155a1fa98f35aa6ad}{
97virtual void \hyperlink{classBMEF_8f4ecb6e2eaf630155a1fa98f35aa6ad}{bayes} (const vec \&data, const double w)}
98\label{classBMEF_8f4ecb6e2eaf630155a1fa98f35aa6ad}
99
100\begin{CompactList}\small\item\em Weighted update of sufficient statistics (Bayes rule). \item\end{CompactList}\item 
101\hypertarget{classBMEF_97f5312efe4a5bedb86d2daec59d8651}{
102\hyperlink{classBMEF}{BMEF} $\ast$ \hyperlink{classBMEF_97f5312efe4a5bedb86d2daec59d8651}{\_\-copy\_\-} (bool changerv=false)}
103\label{classBMEF_97f5312efe4a5bedb86d2daec59d8651}
104
105\begin{CompactList}\small\item\em Flatten the posterior as if to keep nu0 data. \item\end{CompactList}\item 
106\hypertarget{classBM_0186270f75189677f390fe088a9947e9}{
107virtual void \hyperlink{classBM_0186270f75189677f390fe088a9947e9}{bayesB} (const mat \&Dt)}
108\label{classBM_0186270f75189677f390fe088a9947e9}
109
110\begin{CompactList}\small\item\em Batch Bayes rule (columns of Dt are observations). \item\end{CompactList}\item 
111\hypertarget{classBM_cd0660f2a1a344b56ac39802708ff165}{
112vec \hyperlink{classBM_cd0660f2a1a344b56ac39802708ff165}{logpred\_\-m} (const mat \&dt) const }
113\label{classBM_cd0660f2a1a344b56ac39802708ff165}
114
115\begin{CompactList}\small\item\em Matrix version of logpred. \item\end{CompactList}\item 
116\hypertarget{classBM_126bd2595c48e311fc2a7ab72876092a}{
117const \hyperlink{classRV}{RV} \& \hyperlink{classBM_126bd2595c48e311fc2a7ab72876092a}{\_\-rv} () const }
118\label{classBM_126bd2595c48e311fc2a7ab72876092a}
119
120\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
121\hypertarget{classBM_87f4a547d2c29180be88175e5eab9c88}{
122double \hyperlink{classBM_87f4a547d2c29180be88175e5eab9c88}{\_\-ll} () const }
123\label{classBM_87f4a547d2c29180be88175e5eab9c88}
124
125\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
126\hypertarget{classBM_1ffa9f23669aabecc3760c06c6987522}{
127void \hyperlink{classBM_1ffa9f23669aabecc3760c06c6987522}{set\_\-evalll} (bool evl0)}
128\label{classBM_1ffa9f23669aabecc3760c06c6987522}
129
130\begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize}
131\subsection*{Protected Member Functions}
132\begin{CompactItemize}
133\item 
134\hypertarget{classMixEF_5ae381b3a7dfbe2c1e5bb579a5d9b9d1}{
135void \hyperlink{classMixEF_5ae381b3a7dfbe2c1e5bb579a5d9b9d1}{build\_\-est} ()}
136\label{classMixEF_5ae381b3a7dfbe2c1e5bb579a5d9b9d1}
137
138\begin{CompactList}\small\item\em Auxiliary function for use in constructors. \item\end{CompactList}\end{CompactItemize}
139\subsection*{Protected Attributes}
140\begin{CompactItemize}
141\item 
142\hypertarget{classMixEF_e9cc9bb3e6da801455cec99a59aea149}{
143int \hyperlink{classMixEF_e9cc9bb3e6da801455cec99a59aea149}{n}}
144\label{classMixEF_e9cc9bb3e6da801455cec99a59aea149}
145
146\begin{CompactList}\small\item\em Number of components. \item\end{CompactList}\item 
147\hypertarget{classMixEF_4c4a140ca4e6e71b00237b7bc754302e}{
148Array$<$ \hyperlink{classBMEF}{BMEF} $\ast$ $>$ \hyperlink{classMixEF_4c4a140ca4e6e71b00237b7bc754302e}{Coms}}
149\label{classMixEF_4c4a140ca4e6e71b00237b7bc754302e}
150
151\begin{CompactList}\small\item\em Models for Components of $\theta_i$. \item\end{CompactList}\item 
152\hypertarget{classMixEF_d906782a0a9558f19150dc69411f717f}{
153\hyperlink{classmultiBM}{multiBM} \hyperlink{classMixEF_d906782a0a9558f19150dc69411f717f}{weights}}
154\label{classMixEF_d906782a0a9558f19150dc69411f717f}
155
156\begin{CompactList}\small\item\em Statistics for weights. \item\end{CompactList}\item 
157\hypertarget{classMixEF_33968f1325137cc6f4431f0cf05096dc}{
158\hyperlink{classeprod}{eprod} $\ast$ \hyperlink{classMixEF_33968f1325137cc6f4431f0cf05096dc}{est}}
159\label{classMixEF_33968f1325137cc6f4431f0cf05096dc}
160
161\begin{CompactList}\small\item\em Posterior on component parameters. \item\end{CompactList}\item 
162\hypertarget{classMixEF_6e630b2fd4cae8aa728ea1322708c8f0}{
163MixEF\_\-METHOD \hyperlink{classMixEF_6e630b2fd4cae8aa728ea1322708c8f0}{method}}
164\label{classMixEF_6e630b2fd4cae8aa728ea1322708c8f0}
165
166\begin{CompactList}\small\item\em Flag for a method that is used in the inference. \item\end{CompactList}\item 
167\hypertarget{classBMEF_538d632e59f9afa8daa1de74da12ce71}{
168double \hyperlink{classBMEF_538d632e59f9afa8daa1de74da12ce71}{frg}}
169\label{classBMEF_538d632e59f9afa8daa1de74da12ce71}
170
171\begin{CompactList}\small\item\em forgetting factor \item\end{CompactList}\item 
172\hypertarget{classBMEF_308cf5d4133cd471fdf1ecd5dfa09d02}{
173double \hyperlink{classBMEF_308cf5d4133cd471fdf1ecd5dfa09d02}{last\_\-lognc}}
174\label{classBMEF_308cf5d4133cd471fdf1ecd5dfa09d02}
175
176\begin{CompactList}\small\item\em cached value of lognc() in the previous step (used in evaluation of {\tt ll} ) \item\end{CompactList}\item 
177\hypertarget{classBM_af00f0612fabe66241dd507188cdbf88}{
178\hyperlink{classRV}{RV} \hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv}}
179\label{classBM_af00f0612fabe66241dd507188cdbf88}
180
181\begin{CompactList}\small\item\em Random variable of the posterior. \item\end{CompactList}\item 
182\hypertarget{classBM_5623fef6572a08c2b53b8c87b82dc979}{
183double \hyperlink{classBM_5623fef6572a08c2b53b8c87b82dc979}{ll}}
184\label{classBM_5623fef6572a08c2b53b8c87b82dc979}
185
186\begin{CompactList}\small\item\em Logarithm of marginalized data likelihood. \item\end{CompactList}\item 
187\hypertarget{classBM_bf6fb59b30141074f8ee1e2f43d03129}{
188bool \hyperlink{classBM_bf6fb59b30141074f8ee1e2f43d03129}{evalll}}
189\label{classBM_bf6fb59b30141074f8ee1e2f43d03129}
190
191\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}
192
193
194\subsection{Detailed Description}
195Mixture of Exponential Family Densities.
196
197An 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]$.
198
199The 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.
200
201This 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.
202
203TODO: Extend \hyperlink{classBM}{BM} to use rvc.
204
205\subsection{Member Function Documentation}
206\hypertarget{classMixEF_73a782d2f464c830bbdbb03d34c6d63e}{
207\index{MixEF@{MixEF}!init@{init}}
208\index{init@{init}!MixEF@{MixEF}}
209\subsubsection[init]{\setlength{\rightskip}{0pt plus 5cm}void MixEF::init ({\bf BMEF} $\ast$ {\em Com0}, \/  const mat \& {\em Data}, \/  int {\em c} = {\tt 5})}}
210\label{classMixEF_73a782d2f464c830bbdbb03d34c6d63e}
211
212
213Initializing the mixture by a random pick of centroids from data \begin{Desc}
214\item[Parameters:]
215\begin{description}
216\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}
217\end{Desc}
218
219
220References BMEF::\_\-copy\_\-(), build\_\-est(), Coms, est, n, multiBM::set\_\-parameters(), and weights.
221
222Referenced by merger::merge().\hypertarget{classMixEF_424ca64f36d4e41de7a7e7ae921d35ea}{
223\index{MixEF@{MixEF}!logpred@{logpred}}
224\index{logpred@{logpred}!MixEF@{MixEF}}
225\subsubsection[logpred]{\setlength{\rightskip}{0pt plus 5cm}double MixEF::logpred (const vec \& {\em dt}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
226\label{classMixEF_424ca64f36d4e41de7a7e7ae921d35ea}
227
228
229Evaluates predictive log-likelihood of the given data record I.e. marginal likelihood of the data with the posterior integrated out.
230
231Reimplemented from \hyperlink{classBM_8a8ce6df431689964c41cc6c849cfd06}{BM}.
232
233References multiBM::\_\-epdf(), Coms, epdf::mean(), and weights.
234
235Referenced by merger::evallog(), and merger::merge().
236
237The documentation for this class was generated from the following files:\begin{CompactItemize}
238\item 
239work/git/mixpp/bdm/estim/\hyperlink{mixef_8h}{mixef.h}\item 
240work/git/mixpp/bdm/estim/mixef.cpp\end{CompactItemize}
Note: See TracBrowser for help on using the browser.