1 | \hypertarget{classbdm_1_1emix}{ |
---|
2 | \section{bdm::emix Class Reference} |
---|
3 | \label{classbdm_1_1emix}\index{bdm::emix@{bdm::emix}} |
---|
4 | } |
---|
5 | {\tt \#include $<$emix.h$>$} |
---|
6 | |
---|
7 | Inheritance diagram for bdm::emix::\begin{figure}[H] |
---|
8 | \begin{center} |
---|
9 | \leavevmode |
---|
10 | \includegraphics[height=3cm]{classbdm_1_1emix} |
---|
11 | \end{center} |
---|
12 | \end{figure} |
---|
13 | |
---|
14 | |
---|
15 | \subsection{Detailed Description} |
---|
16 | Mixture of epdfs. |
---|
17 | |
---|
18 | Density function: \[ f(x) = \sum_{i=1}^{n} w_{i} f_i(x), \quad \sum_{i=1}^n w_i = 1. \] where $f_i(x)$ is any density on random variable $x$, called {\em component\/}, \subsection*{Public Member Functions} |
---|
19 | \begin{CompactItemize} |
---|
20 | \item |
---|
21 | \hypertarget{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}{ |
---|
22 | \hyperlink{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}{emix} ()} |
---|
23 | \label{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d} |
---|
24 | |
---|
25 | \begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item |
---|
26 | void \hyperlink{classbdm_1_1emix_3a107a6b808a081389ef17af951c234a}{set\_\-parameters} (const vec \&\hyperlink{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{w}, const Array$<$ \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ $>$ \&\hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms}, bool copy=false) |
---|
27 | \item |
---|
28 | \hypertarget{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}{ |
---|
29 | vec \hyperlink{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}{sample} () const } |
---|
30 | \label{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc} |
---|
31 | |
---|
32 | \begin{CompactList}\small\item\em Returns a sample, $ x $ from density $ f_x()$. \item\end{CompactList}\item |
---|
33 | \hypertarget{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}{ |
---|
34 | vec \hyperlink{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}{mean} () const } |
---|
35 | \label{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a} |
---|
36 | |
---|
37 | \begin{CompactList}\small\item\em return expected value \item\end{CompactList}\item |
---|
38 | \hypertarget{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}{ |
---|
39 | vec \hyperlink{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}{variance} () const } |
---|
40 | \label{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86} |
---|
41 | |
---|
42 | \begin{CompactList}\small\item\em return expected variance (not covariance!) \item\end{CompactList}\item |
---|
43 | \hypertarget{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}{ |
---|
44 | double \hyperlink{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}{evallog} (const vec \&val) const } |
---|
45 | \label{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e} |
---|
46 | |
---|
47 | \begin{CompactList}\small\item\em Compute log-probability of argument {\tt val}. \item\end{CompactList}\item |
---|
48 | \hypertarget{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}{ |
---|
49 | vec \hyperlink{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}{evallog\_\-m} (const mat \&Val) const } |
---|
50 | \label{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b} |
---|
51 | |
---|
52 | \begin{CompactList}\small\item\em Compute log-probability of multiple values argument {\tt val}. \item\end{CompactList}\item |
---|
53 | \hypertarget{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}{ |
---|
54 | mat \hyperlink{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}{evallog\_\-M} (const mat \&Val) const } |
---|
55 | \label{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2} |
---|
56 | |
---|
57 | \begin{CompactList}\small\item\em Auxiliary function that returns pdflog for each component. \item\end{CompactList}\item |
---|
58 | \hypertarget{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}{ |
---|
59 | \hyperlink{classbdm_1_1emix}{emix} $\ast$ \hyperlink{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}{marginal} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const } |
---|
60 | \label{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646} |
---|
61 | |
---|
62 | \begin{CompactList}\small\item\em Return marginal density on the given \hyperlink{classbdm_1_1RV}{RV}, the remainig rvs are intergrated out. \item\end{CompactList}\item |
---|
63 | \hypertarget{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}{ |
---|
64 | \hyperlink{classbdm_1_1mratio}{mratio} $\ast$ \hyperlink{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}{condition} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const } |
---|
65 | \label{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf} |
---|
66 | |
---|
67 | \begin{CompactList}\small\item\em Return conditional density on the given \hyperlink{classbdm_1_1RV}{RV}, the remaining rvs will be in conditioning. \item\end{CompactList}\item |
---|
68 | \hypertarget{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}{ |
---|
69 | vec \& \hyperlink{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}{\_\-w} ()} |
---|
70 | \label{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be} |
---|
71 | |
---|
72 | \begin{CompactList}\small\item\em returns a pointer to the internal mean value. Use with Care! \item\end{CompactList}\item |
---|
73 | \hypertarget{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ |
---|
74 | void \hyperlink{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ownComs} ()} |
---|
75 | \label{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e} |
---|
76 | |
---|
77 | \begin{CompactList}\small\item\em Auxiliary function for taking ownership of the \hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms()}. \item\end{CompactList}\item |
---|
78 | \hypertarget{classbdm_1_1emix_578616445243674438257be99ba71612}{ |
---|
79 | \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1emix_578616445243674438257be99ba71612}{\_\-Coms} (int i)} |
---|
80 | \label{classbdm_1_1emix_578616445243674438257be99ba71612} |
---|
81 | |
---|
82 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize} |
---|
83 | \begin{Indent}{\bf Constructors}\par |
---|
84 | {\em Construction of each \hyperlink{classbdm_1_1epdf}{epdf} should support two types of constructors: \begin{itemize} |
---|
85 | \item empty constructor, \item copy constructor,\end{itemize} |
---|
86 | The following constructors should be supported for convenience: \begin{itemize} |
---|
87 | \item constructor followed by calling {\tt \hyperlink{classbdm_1_1emix_3a107a6b808a081389ef17af951c234a}{set\_\-parameters()}} \item constructor accepting random variables calling {\tt \hyperlink{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{set\_\-rv()}} \end{itemize} |
---|
88 | All internal data structures are constructed as empty. Their values (including sizes) will be set by method {\tt \hyperlink{classbdm_1_1emix_3a107a6b808a081389ef17af951c234a}{set\_\-parameters()}}. This way references can be initialized in constructors. }\begin{CompactItemize} |
---|
89 | \item |
---|
90 | \hypertarget{classbdm_1_1epdf_840de94aa33cf4f2ebd2427f45a165d8}{ |
---|
91 | void \textbf{set\_\-parameters} (int dim0)} |
---|
92 | \label{classbdm_1_1epdf_840de94aa33cf4f2ebd2427f45a165d8} |
---|
93 | |
---|
94 | \end{CompactItemize} |
---|
95 | \end{Indent} |
---|
96 | \begin{Indent}{\bf Matematical Operations}\par |
---|
97 | \begin{CompactItemize} |
---|
98 | \item |
---|
99 | \hypertarget{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{ |
---|
100 | virtual mat \hyperlink{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{sample\_\-m} (int N) const } |
---|
101 | \label{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058} |
---|
102 | |
---|
103 | \begin{CompactList}\small\item\em Returns N samples, $ [x_1 , x_2 , \ldots \ $ from density $ f_x(rv)$. \item\end{CompactList}\end{CompactItemize} |
---|
104 | \end{Indent} |
---|
105 | \begin{Indent}{\bf Connection to other classes}\par |
---|
106 | {\em Description of the random quantity via attribute {\tt rv} is optional. For operations such as sampling {\tt rv} does not need to be set. However, for {\tt marginalization} and {\tt conditioning} {\tt rv} has to be set. NB: }\begin{CompactItemize} |
---|
107 | \item |
---|
108 | \hypertarget{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{ |
---|
109 | void \hyperlink{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv0)} |
---|
110 | \label{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff} |
---|
111 | |
---|
112 | \begin{CompactList}\small\item\em Name its rv. \item\end{CompactList}\item |
---|
113 | \hypertarget{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{ |
---|
114 | bool \hyperlink{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{isnamed} () const } |
---|
115 | \label{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9} |
---|
116 | |
---|
117 | \begin{CompactList}\small\item\em True if rv is assigned. \item\end{CompactList}\item |
---|
118 | \hypertarget{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{ |
---|
119 | const \hyperlink{classbdm_1_1RV}{RV} \& \hyperlink{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{\_\-rv} () const } |
---|
120 | \label{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21} |
---|
121 | |
---|
122 | \begin{CompactList}\small\item\em Return name (fails when isnamed is false). \item\end{CompactList}\end{CompactItemize} |
---|
123 | \end{Indent} |
---|
124 | \begin{Indent}{\bf Access to attributes}\par |
---|
125 | \begin{CompactItemize} |
---|
126 | \item |
---|
127 | \hypertarget{classbdm_1_1epdf_7083a65f7b7a0d0d13b2c516bd2ec29c}{ |
---|
128 | int \hyperlink{classbdm_1_1epdf_7083a65f7b7a0d0d13b2c516bd2ec29c}{dimension} () const } |
---|
129 | \label{classbdm_1_1epdf_7083a65f7b7a0d0d13b2c516bd2ec29c} |
---|
130 | |
---|
131 | \begin{CompactList}\small\item\em Size of the random variable. \item\end{CompactList}\end{CompactItemize} |
---|
132 | \end{Indent} |
---|
133 | \subsection*{Protected Attributes} |
---|
134 | \begin{CompactItemize} |
---|
135 | \item |
---|
136 | \hypertarget{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{ |
---|
137 | vec \hyperlink{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{w}} |
---|
138 | \label{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46} |
---|
139 | |
---|
140 | \begin{CompactList}\small\item\em weights of the components \item\end{CompactList}\item |
---|
141 | \hypertarget{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{ |
---|
142 | Array$<$ \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ $>$ \hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms}} |
---|
143 | \label{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e} |
---|
144 | |
---|
145 | \begin{CompactList}\small\item\em Component (epdfs). \item\end{CompactList}\item |
---|
146 | \hypertarget{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}{ |
---|
147 | bool \hyperlink{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}{destroyComs}} |
---|
148 | \label{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4} |
---|
149 | |
---|
150 | \begin{CompactList}\small\item\em Flag if owning Coms. \item\end{CompactList}\item |
---|
151 | \hypertarget{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{ |
---|
152 | int \hyperlink{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{dim}} |
---|
153 | \label{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce} |
---|
154 | |
---|
155 | \begin{CompactList}\small\item\em dimension of the random variable \item\end{CompactList}\item |
---|
156 | \hypertarget{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{ |
---|
157 | \hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}} |
---|
158 | \label{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8} |
---|
159 | |
---|
160 | \begin{CompactList}\small\item\em Description of the random variable. \item\end{CompactList}\end{CompactItemize} |
---|
161 | |
---|
162 | |
---|
163 | \subsection{Member Function Documentation} |
---|
164 | \hypertarget{classbdm_1_1emix_3a107a6b808a081389ef17af951c234a}{ |
---|
165 | \index{bdm::emix@{bdm::emix}!set\_\-parameters@{set\_\-parameters}} |
---|
166 | \index{set\_\-parameters@{set\_\-parameters}!bdm::emix@{bdm::emix}} |
---|
167 | \subsubsection[set\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void bdm::emix::set\_\-parameters (const vec \& {\em w}, \/ const Array$<$ {\bf epdf} $\ast$ $>$ \& {\em Coms}, \/ bool {\em copy} = {\tt false})}} |
---|
168 | \label{classbdm_1_1emix_3a107a6b808a081389ef17af951c234a} |
---|
169 | |
---|
170 | |
---|
171 | Set weights {\tt w} and components {\tt Coms} By default Coms are copied inside. Parameter {\tt copy} can be set to false if Coms live externally. Use method \hyperlink{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ownComs()} if Coms should be destroyed by the destructor. |
---|
172 | |
---|
173 | References Coms, destroyComs, bdm::epdf::dim, bdm::epdf::dimension(), and w. |
---|
174 | |
---|
175 | Referenced by bdm::MixEF::epredictor(), marginal(), and bdm::mmix::set\_\-parameters(). |
---|
176 | |
---|
177 | The documentation for this class was generated from the following files:\begin{CompactItemize} |
---|
178 | \item |
---|
179 | \hyperlink{emix_8h}{emix.h}\item |
---|
180 | emix.cpp\end{CompactItemize} |
---|