root/doc/latex/classbdm_1_1MixEF.tex @ 271

Revision 271, 14.9 kB (checked in by smidl, 16 years ago)

Next major revision

Line 
1\hypertarget{classbdm_1_1MixEF}{
2\section{bdm::MixEF Class Reference}
3\label{classbdm_1_1MixEF}\index{bdm::MixEF@{bdm::MixEF}}
4}
5{\tt \#include $<$mixef.h$>$}
6
7Inheritance diagram for bdm::MixEF::\begin{figure}[H]
8\begin{center}
9\leavevmode
10\includegraphics[height=4cm]{classbdm_1_1MixEF}
11\end{center}
12\end{figure}
13
14
15\subsection{Detailed Description}
16Mixture of Exponential Family Densities.
17
18An 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]$.
19
20The 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.
21
22This 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.
23
24TODO: Extend \hyperlink{classbdm_1_1BM}{BM} to use rvc. \subsection*{Public Member Functions}
25\begin{CompactItemize}
26\item 
27\hypertarget{classbdm_1_1MixEF_4efe67d414ff34a1e7534004fd061241}{
28\hyperlink{classbdm_1_1MixEF_4efe67d414ff34a1e7534004fd061241}{MixEF} (const Array$<$ \hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$ $>$ \&Coms0, const vec \&alpha0)}
29\label{classbdm_1_1MixEF_4efe67d414ff34a1e7534004fd061241}
30
31\begin{CompactList}\small\item\em Full constructor. \item\end{CompactList}\item 
32\hypertarget{classbdm_1_1MixEF_0266854387338ba757e6192d62907984}{
33\hyperlink{classbdm_1_1MixEF_0266854387338ba757e6192d62907984}{MixEF} ()}
34\label{classbdm_1_1MixEF_0266854387338ba757e6192d62907984}
35
36\begin{CompactList}\small\item\em Constructor of empty mixture. \item\end{CompactList}\item 
37\hypertarget{classbdm_1_1MixEF_9577de85c3e3481f7c0e23cf8f87c482}{
38\hyperlink{classbdm_1_1MixEF_9577de85c3e3481f7c0e23cf8f87c482}{MixEF} (const \hyperlink{classbdm_1_1MixEF}{MixEF} \&M2)}
39\label{classbdm_1_1MixEF_9577de85c3e3481f7c0e23cf8f87c482}
40
41\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
42void \hyperlink{classbdm_1_1MixEF_0c2a50789b30769964a909d217125ed2}{init} (\hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$Com0, const mat \&Data, int c=5)
43\item 
44\hypertarget{classbdm_1_1MixEF_5bd7da667da183eed1577f11dff0c1f1}{
45void \hyperlink{classbdm_1_1MixEF_5bd7da667da183eed1577f11dff0c1f1}{bayes} (const vec \&dt)}
46\label{classbdm_1_1MixEF_5bd7da667da183eed1577f11dff0c1f1}
47
48\begin{CompactList}\small\item\em Recursive EM-like algorithm (QB-variant), see Karny et. al, 2006. \item\end{CompactList}\item 
49\hypertarget{classbdm_1_1MixEF_5c41d5a4403da6e629f6bdfc70c43d20}{
50void \hyperlink{classbdm_1_1MixEF_5c41d5a4403da6e629f6bdfc70c43d20}{bayes} (const mat \&dt)}
51\label{classbdm_1_1MixEF_5c41d5a4403da6e629f6bdfc70c43d20}
52
53\begin{CompactList}\small\item\em EM algorithm. \item\end{CompactList}\item 
54\hypertarget{classbdm_1_1MixEF_5de521c395e93478df00d881ab8dac81}{
55void \textbf{bayesB} (const mat \&dt, const vec \&wData)}
56\label{classbdm_1_1MixEF_5de521c395e93478df00d881ab8dac81}
57
58\item 
59double \hyperlink{classbdm_1_1MixEF_da724da464a75e07521941e430929efa}{logpred} (const vec \&dt) const
60\item 
61\hypertarget{classbdm_1_1MixEF_4830916adef7891a207e42f39aaf787b}{
62const \hyperlink{classbdm_1_1epdf}{epdf} \& \textbf{posterior} () const }
63\label{classbdm_1_1MixEF_4830916adef7891a207e42f39aaf787b}
64
65\item 
66\hypertarget{classbdm_1_1MixEF_ea8be6f0703d87b7c4c3e77fd07e28c8}{
67const \hyperlink{classbdm_1_1eprod}{eprod} $\ast$ \textbf{\_\-e} () const }
68\label{classbdm_1_1MixEF_ea8be6f0703d87b7c4c3e77fd07e28c8}
69
70\item 
71\hypertarget{classbdm_1_1MixEF_edc50e9640f049b846084748b18469a2}{
72\hyperlink{classbdm_1_1emix}{emix} $\ast$ \hyperlink{classbdm_1_1MixEF_edc50e9640f049b846084748b18469a2}{epredictor} () const }
73\label{classbdm_1_1MixEF_edc50e9640f049b846084748b18469a2}
74
75\begin{CompactList}\small\item\em Constructs a predictive density $ f(d_{t+1} |d_{t}, \ldots d_{0}) $. \item\end{CompactList}\item 
76\hypertarget{classbdm_1_1MixEF_f0dfb4375fef4e61c4cb062e5bac7c8c}{
77void \hyperlink{classbdm_1_1MixEF_f0dfb4375fef4e61c4cb062e5bac7c8c}{flatten} (const \hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$M2)}
78\label{classbdm_1_1MixEF_f0dfb4375fef4e61c4cb062e5bac7c8c}
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{classbdm_1_1MixEF_251ef6fc51757712693da5faae5317c9}{
82\hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$ \hyperlink{classbdm_1_1MixEF_251ef6fc51757712693da5faae5317c9}{\_\-Coms} (int i)}
83\label{classbdm_1_1MixEF_251ef6fc51757712693da5faae5317c9}
84
85\begin{CompactList}\small\item\em Access function. \item\end{CompactList}\item 
86\hypertarget{classbdm_1_1MixEF_664529d52cc667383b39eeb440ccd577}{
87void \hyperlink{classbdm_1_1MixEF_664529d52cc667383b39eeb440ccd577}{set\_\-method} (MixEF\_\-METHOD M)}
88\label{classbdm_1_1MixEF_664529d52cc667383b39eeb440ccd577}
89
90\begin{CompactList}\small\item\em Set which method is to be used. \item\end{CompactList}\item 
91\hypertarget{classbdm_1_1BMEF_d2b528b7a41ca67163152142f5404051}{
92virtual void \hyperlink{classbdm_1_1BMEF_d2b528b7a41ca67163152142f5404051}{set\_\-statistics} (const \hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$BM0)}
93\label{classbdm_1_1BMEF_d2b528b7a41ca67163152142f5404051}
94
95\begin{CompactList}\small\item\em get statistics from another model \item\end{CompactList}\item 
96\hypertarget{classbdm_1_1BMEF_bf58deb99af2a6cc674f13ff90300de6}{
97virtual void \hyperlink{classbdm_1_1BMEF_bf58deb99af2a6cc674f13ff90300de6}{bayes} (const vec \&data, const double w)}
98\label{classbdm_1_1BMEF_bf58deb99af2a6cc674f13ff90300de6}
99
100\begin{CompactList}\small\item\em Weighted update of sufficient statistics (Bayes rule). \item\end{CompactList}\item 
101\hypertarget{classbdm_1_1BMEF_5912dbcf28ae711e30b08c2fa766a3e6}{
102\hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$ \hyperlink{classbdm_1_1BMEF_5912dbcf28ae711e30b08c2fa766a3e6}{\_\-copy\_\-} (bool changerv=false)}
103\label{classbdm_1_1BMEF_5912dbcf28ae711e30b08c2fa766a3e6}
104
105\begin{CompactList}\small\item\em Flatten the posterior as if to keep nu0 data. \item\end{CompactList}\end{CompactItemize}
106\begin{Indent}{\bf Constructors}\par
107\begin{CompactItemize}
108\item 
109virtual \hyperlink{classbdm_1_1BM}{BM} $\ast$ \hyperlink{classbdm_1_1BM_c0f027ff91d8459937c6f60ff8e553ff}{\_\-copy\_\-} ()
110\end{CompactItemize}
111\end{Indent}
112\begin{Indent}{\bf Mathematical operations}\par
113\begin{CompactItemize}
114\item 
115\hypertarget{classbdm_1_1BM_1dee3fddaf021e62d925289660a707dc}{
116virtual void \hyperlink{classbdm_1_1BM_1dee3fddaf021e62d925289660a707dc}{bayesB} (const mat \&Dt)}
117\label{classbdm_1_1BM_1dee3fddaf021e62d925289660a707dc}
118
119\begin{CompactList}\small\item\em Batch Bayes rule (columns of Dt are observations). \item\end{CompactList}\item 
120\hypertarget{classbdm_1_1BM_0e8ebe61fb14990abe1254bd3dda5fae}{
121vec \hyperlink{classbdm_1_1BM_0e8ebe61fb14990abe1254bd3dda5fae}{logpred\_\-m} (const mat \&dt) const }
122\label{classbdm_1_1BM_0e8ebe61fb14990abe1254bd3dda5fae}
123
124\begin{CompactList}\small\item\em Matrix version of logpred. \item\end{CompactList}\item 
125\hypertarget{classbdm_1_1BM_598b25e3f3d96a5bc00a5faeb5b3c912}{
126virtual \hyperlink{classbdm_1_1mpdf}{mpdf} $\ast$ \hyperlink{classbdm_1_1BM_598b25e3f3d96a5bc00a5faeb5b3c912}{predictor} () const }
127\label{classbdm_1_1BM_598b25e3f3d96a5bc00a5faeb5b3c912}
128
129\begin{CompactList}\small\item\em Constructs a conditional density 1-step ahead predictor. \item\end{CompactList}\end{CompactItemize}
130\end{Indent}
131\begin{Indent}{\bf Access to attributes}\par
132\begin{CompactItemize}
133\item 
134\hypertarget{classbdm_1_1BM_ff2d8755ba0b3def927d31305c03b09c}{
135const \hyperlink{classbdm_1_1RV}{RV} \& \textbf{\_\-drv} () const }
136\label{classbdm_1_1BM_ff2d8755ba0b3def927d31305c03b09c}
137
138\item 
139\hypertarget{classbdm_1_1BM_f135ae6dce7e9f30c9f88229c7930b96}{
140void \textbf{set\_\-drv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv)}
141\label{classbdm_1_1BM_f135ae6dce7e9f30c9f88229c7930b96}
142
143\item 
144\hypertarget{classbdm_1_1BM_b38d92f17620813ad872d86e01a26e5e}{
145void \textbf{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv)}
146\label{classbdm_1_1BM_b38d92f17620813ad872d86e01a26e5e}
147
148\item 
149\hypertarget{classbdm_1_1BM_5be65d37dedfe33a3671e7065f523a70}{
150double \textbf{\_\-ll} () const }
151\label{classbdm_1_1BM_5be65d37dedfe33a3671e7065f523a70}
152
153\item 
154\hypertarget{classbdm_1_1BM_236b3abbcc93594fc97cd86d82c1a83f}{
155void \textbf{set\_\-evalll} (bool evl0)}
156\label{classbdm_1_1BM_236b3abbcc93594fc97cd86d82c1a83f}
157
158\end{CompactItemize}
159\end{Indent}
160\subsection*{Protected Member Functions}
161\begin{CompactItemize}
162\item 
163\hypertarget{classbdm_1_1MixEF_d74a8d1370c63c93ec554908ae3e6006}{
164void \hyperlink{classbdm_1_1MixEF_d74a8d1370c63c93ec554908ae3e6006}{build\_\-est} ()}
165\label{classbdm_1_1MixEF_d74a8d1370c63c93ec554908ae3e6006}
166
167\begin{CompactList}\small\item\em Auxiliary function for use in constructors. \item\end{CompactList}\end{CompactItemize}
168\subsection*{Protected Attributes}
169\begin{CompactItemize}
170\item 
171\hypertarget{classbdm_1_1MixEF_38ca1d86e977d1c38810a3c95bf074a5}{
172int \hyperlink{classbdm_1_1MixEF_38ca1d86e977d1c38810a3c95bf074a5}{n}}
173\label{classbdm_1_1MixEF_38ca1d86e977d1c38810a3c95bf074a5}
174
175\begin{CompactList}\small\item\em Number of components. \item\end{CompactList}\item 
176\hypertarget{classbdm_1_1MixEF_90c21ab5a2af56d4b49e2eaef6eccc08}{
177Array$<$ \hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$ $>$ \hyperlink{classbdm_1_1MixEF_90c21ab5a2af56d4b49e2eaef6eccc08}{Coms}}
178\label{classbdm_1_1MixEF_90c21ab5a2af56d4b49e2eaef6eccc08}
179
180\begin{CompactList}\small\item\em Models for Components of $\theta_i$. \item\end{CompactList}\item 
181\hypertarget{classbdm_1_1MixEF_e39faa70cebadc3296bd249040105e86}{
182\hyperlink{classbdm_1_1multiBM}{multiBM} \hyperlink{classbdm_1_1MixEF_e39faa70cebadc3296bd249040105e86}{weights}}
183\label{classbdm_1_1MixEF_e39faa70cebadc3296bd249040105e86}
184
185\begin{CompactList}\small\item\em Statistics for weights. \item\end{CompactList}\item 
186\hypertarget{classbdm_1_1MixEF_9413fb7f1836237aac807fb9f245e4f6}{
187\hyperlink{classbdm_1_1eprod}{eprod} $\ast$ \hyperlink{classbdm_1_1MixEF_9413fb7f1836237aac807fb9f245e4f6}{est}}
188\label{classbdm_1_1MixEF_9413fb7f1836237aac807fb9f245e4f6}
189
190\begin{CompactList}\small\item\em Posterior on component parameters. \item\end{CompactList}\item 
191\hypertarget{classbdm_1_1MixEF_a2376ddadb7573532404452d0c2dd28a}{
192MixEF\_\-METHOD \hyperlink{classbdm_1_1MixEF_a2376ddadb7573532404452d0c2dd28a}{method}}
193\label{classbdm_1_1MixEF_a2376ddadb7573532404452d0c2dd28a}
194
195\begin{CompactList}\small\item\em Flag for a method that is used in the inference. \item\end{CompactList}\item 
196\hypertarget{classbdm_1_1BMEF_1331865e10fb1ccef65bb4c47fa3be64}{
197double \hyperlink{classbdm_1_1BMEF_1331865e10fb1ccef65bb4c47fa3be64}{frg}}
198\label{classbdm_1_1BMEF_1331865e10fb1ccef65bb4c47fa3be64}
199
200\begin{CompactList}\small\item\em forgetting factor \item\end{CompactList}\item 
201\hypertarget{classbdm_1_1BMEF_06e7b3ac03e10017d4288c76888e2865}{
202double \hyperlink{classbdm_1_1BMEF_06e7b3ac03e10017d4288c76888e2865}{last\_\-lognc}}
203\label{classbdm_1_1BMEF_06e7b3ac03e10017d4288c76888e2865}
204
205\begin{CompactList}\small\item\em cached value of lognc() in the previous step (used in evaluation of {\tt ll} ) \item\end{CompactList}\item 
206\hypertarget{classbdm_1_1BM_c400357e37d27a4834b2b1d9211009ed}{
207\hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1BM_c400357e37d27a4834b2b1d9211009ed}{drv}}
208\label{classbdm_1_1BM_c400357e37d27a4834b2b1d9211009ed}
209
210\begin{CompactList}\small\item\em Random variable of the data (optional). \item\end{CompactList}\item 
211\hypertarget{classbdm_1_1BM_4064b6559d962633e4372b12f4cd204a}{
212double \hyperlink{classbdm_1_1BM_4064b6559d962633e4372b12f4cd204a}{ll}}
213\label{classbdm_1_1BM_4064b6559d962633e4372b12f4cd204a}
214
215\begin{CompactList}\small\item\em Logarithm of marginalized data likelihood. \item\end{CompactList}\item 
216\hypertarget{classbdm_1_1BM_faff0ad12556fe7dc0e2807d4fd938ee}{
217bool \hyperlink{classbdm_1_1BM_faff0ad12556fe7dc0e2807d4fd938ee}{evalll}}
218\label{classbdm_1_1BM_faff0ad12556fe7dc0e2807d4fd938ee}
219
220\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}
221
222
223\subsection{Member Function Documentation}
224\hypertarget{classbdm_1_1MixEF_0c2a50789b30769964a909d217125ed2}{
225\index{bdm::MixEF@{bdm::MixEF}!init@{init}}
226\index{init@{init}!bdm::MixEF@{bdm::MixEF}}
227\subsubsection[init]{\setlength{\rightskip}{0pt plus 5cm}void bdm::MixEF::init ({\bf BMEF} $\ast$ {\em Com0}, \/  const mat \& {\em Data}, \/  int {\em c} = {\tt 5})}}
228\label{classbdm_1_1MixEF_0c2a50789b30769964a909d217125ed2}
229
230
231Initializing the mixture by a random pick of centroids from data \begin{Desc}
232\item[Parameters:]
233\begin{description}
234\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}
235\end{Desc}
236
237
238References bdm::BMEF::\_\-copy\_\-(), build\_\-est(), Coms, est, n, bdm::multiBM::set\_\-parameters(), and weights.
239
240Referenced by bdm::merger::merge().\hypertarget{classbdm_1_1MixEF_da724da464a75e07521941e430929efa}{
241\index{bdm::MixEF@{bdm::MixEF}!logpred@{logpred}}
242\index{logpred@{logpred}!bdm::MixEF@{bdm::MixEF}}
243\subsubsection[logpred]{\setlength{\rightskip}{0pt plus 5cm}double bdm::MixEF::logpred (const vec \& {\em dt}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
244\label{classbdm_1_1MixEF_da724da464a75e07521941e430929efa}
245
246
247Evaluates predictive log-likelihood of the given data record I.e. marginal likelihood of the data with the posterior integrated out.
248
249Reimplemented from \hyperlink{classbdm_1_1BM_50257e0c1e5b5c73153ea6e716ad8ae0}{bdm::BM}.
250
251References Coms, bdm::epdf::mean(), bdm::multiBM::posterior(), and weights.
252
253Referenced by bdm::merger::evallog(), and bdm::merger::merge().\hypertarget{classbdm_1_1BM_c0f027ff91d8459937c6f60ff8e553ff}{
254\index{bdm::MixEF@{bdm::MixEF}!\_\-copy\_\-@{\_\-copy\_\-}}
255\index{\_\-copy\_\-@{\_\-copy\_\-}!bdm::MixEF@{bdm::MixEF}}
256\subsubsection[\_\-copy\_\-]{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf BM}$\ast$ bdm::BM::\_\-copy\_\- ()\hspace{0.3cm}{\tt  \mbox{[}inline, virtual, inherited\mbox{]}}}}
257\label{classbdm_1_1BM_c0f027ff91d8459937c6f60ff8e553ff}
258
259
260Copy function required in vectors, Arrays of \hyperlink{classbdm_1_1BM}{BM} etc. Have to be DELETED manually! Prototype:
261
262\begin{Code}\begin{verbatim} BM* _copy_(){return new BM(*this);} 
263\end{verbatim}
264\end{Code}
265
266 
267
268Reimplemented in \hyperlink{classbdm_1_1ARX_60c40b5c6abc4c7e464b4ccae64a5a61}{bdm::ARX}.
269
270The documentation for this class was generated from the following files:\begin{CompactItemize}
271\item 
272\hyperlink{mixef_8h}{mixef.h}\item 
273mixef.cpp\end{CompactItemize}
Note: See TracBrowser for help on using the browser.