1 | \hypertarget{classbdm_1_1eigamma}{ |
---|
2 | \section{bdm::eigamma Class Reference} |
---|
3 | \label{classbdm_1_1eigamma}\index{bdm::eigamma@{bdm::eigamma}} |
---|
4 | } |
---|
5 | {\tt \#include $<$libEF.h$>$} |
---|
6 | |
---|
7 | Inheritance diagram for bdm::eigamma::\begin{figure}[H] |
---|
8 | \begin{center} |
---|
9 | \leavevmode |
---|
10 | \includegraphics[height=4cm]{classbdm_1_1eigamma} |
---|
11 | \end{center} |
---|
12 | \end{figure} |
---|
13 | |
---|
14 | |
---|
15 | \subsection{Detailed Description} |
---|
16 | Inverse-Gamma posterior density. |
---|
17 | |
---|
18 | Multivariate inverse-Gamma density as product of independent univariate densities. \[ f(x|\alpha,\beta) = \prod f(x_i|\alpha_i,\beta_i) \] |
---|
19 | |
---|
20 | Inverse Gamma can be converted to Gamma using \[ x\sim iG(a,b) => 1/x\sim G(a,1/b) \] This relation is used in sampling. \subsection*{Public Member Functions} |
---|
21 | \begin{CompactItemize} |
---|
22 | \item |
---|
23 | \hypertarget{classbdm_1_1eigamma_3aff7bf25ddac27731c60826fcfd878f}{ |
---|
24 | vec \hyperlink{classbdm_1_1eigamma_3aff7bf25ddac27731c60826fcfd878f}{sample} () const } |
---|
25 | \label{classbdm_1_1eigamma_3aff7bf25ddac27731c60826fcfd878f} |
---|
26 | |
---|
27 | \begin{CompactList}\small\item\em Returns a sample, $ x $ from density $ f_x()$. \item\end{CompactList}\item |
---|
28 | \hypertarget{classbdm_1_1eigamma_9e26c80c8e6708bfcf2e684958af6f91}{ |
---|
29 | double \hyperlink{classbdm_1_1eigamma_9e26c80c8e6708bfcf2e684958af6f91}{evallog} (const vec \&val) const } |
---|
30 | \label{classbdm_1_1eigamma_9e26c80c8e6708bfcf2e684958af6f91} |
---|
31 | |
---|
32 | \begin{CompactList}\small\item\em TODO: is it used anywhere? \item\end{CompactList}\item |
---|
33 | \hypertarget{classbdm_1_1eigamma_a52ac6d523e2fe05642d1f50fe66aec2}{ |
---|
34 | double \hyperlink{classbdm_1_1eigamma_a52ac6d523e2fe05642d1f50fe66aec2}{lognc} () const } |
---|
35 | \label{classbdm_1_1eigamma_a52ac6d523e2fe05642d1f50fe66aec2} |
---|
36 | |
---|
37 | \begin{CompactList}\small\item\em logarithm of the normalizing constant, $\mathcal{I}$ \item\end{CompactList}\item |
---|
38 | \hypertarget{classbdm_1_1eigamma_46cecb295edbabd28120cb0f6f572bcb}{ |
---|
39 | vec \hyperlink{classbdm_1_1eigamma_46cecb295edbabd28120cb0f6f572bcb}{mean} () const } |
---|
40 | \label{classbdm_1_1eigamma_46cecb295edbabd28120cb0f6f572bcb} |
---|
41 | |
---|
42 | \begin{CompactList}\small\item\em Returns poiter to alpha and beta. Potentially dangerous: use with care! \item\end{CompactList}\item |
---|
43 | \hypertarget{classbdm_1_1eigamma_c2c696f8c668e9f65392c9449f6a5133}{ |
---|
44 | vec \hyperlink{classbdm_1_1eigamma_c2c696f8c668e9f65392c9449f6a5133}{variance} () const } |
---|
45 | \label{classbdm_1_1eigamma_c2c696f8c668e9f65392c9449f6a5133} |
---|
46 | |
---|
47 | \begin{CompactList}\small\item\em return expected variance (not covariance!) \item\end{CompactList}\item |
---|
48 | \hypertarget{classbdm_1_1eigamma_0b3693d30bcc8c6bd873f9c49825cdeb}{ |
---|
49 | vec \& \textbf{\_\-alpha} ()} |
---|
50 | \label{classbdm_1_1eigamma_0b3693d30bcc8c6bd873f9c49825cdeb} |
---|
51 | |
---|
52 | \item |
---|
53 | \hypertarget{classbdm_1_1eigamma_d5aa95bce22824f16b46f8cd3ace9dae}{ |
---|
54 | vec \& \textbf{\_\-beta} ()} |
---|
55 | \label{classbdm_1_1eigamma_d5aa95bce22824f16b46f8cd3ace9dae} |
---|
56 | |
---|
57 | \item |
---|
58 | \hypertarget{classbdm_1_1eEF_deef7d6273ba4d5a5cf0bbd91ec7277a}{ |
---|
59 | virtual void \hyperlink{classbdm_1_1eEF_deef7d6273ba4d5a5cf0bbd91ec7277a}{dupdate} (mat \&v)} |
---|
60 | \label{classbdm_1_1eEF_deef7d6273ba4d5a5cf0bbd91ec7277a} |
---|
61 | |
---|
62 | \begin{CompactList}\small\item\em TODO decide if it is really needed. \item\end{CompactList}\item |
---|
63 | \hypertarget{classbdm_1_1eEF_a4135778ecd9ab774762936c82a097c6}{ |
---|
64 | virtual double \hyperlink{classbdm_1_1eEF_a4135778ecd9ab774762936c82a097c6}{evallog\_\-nn} (const vec \&val) const } |
---|
65 | \label{classbdm_1_1eEF_a4135778ecd9ab774762936c82a097c6} |
---|
66 | |
---|
67 | \begin{CompactList}\small\item\em Evaluate normalized log-probability. \item\end{CompactList}\item |
---|
68 | \hypertarget{classbdm_1_1eEF_79a7c8ea8c02e45d410bd1d7ffd72b41}{ |
---|
69 | virtual vec \hyperlink{classbdm_1_1eEF_79a7c8ea8c02e45d410bd1d7ffd72b41}{evallog} (const mat \&Val) const } |
---|
70 | \label{classbdm_1_1eEF_79a7c8ea8c02e45d410bd1d7ffd72b41} |
---|
71 | |
---|
72 | \begin{CompactList}\small\item\em Evaluate normalized log-probability for many samples. \item\end{CompactList}\item |
---|
73 | \hypertarget{classbdm_1_1eEF_cf38af29e8e3d650c640509a52396053}{ |
---|
74 | virtual void \hyperlink{classbdm_1_1eEF_cf38af29e8e3d650c640509a52396053}{pow} (double p)} |
---|
75 | \label{classbdm_1_1eEF_cf38af29e8e3d650c640509a52396053} |
---|
76 | |
---|
77 | \begin{CompactList}\small\item\em Power of the density, used e.g. to flatten the density. \item\end{CompactList}\end{CompactItemize} |
---|
78 | \begin{Indent}{\bf Constructors}\par |
---|
79 | \begin{CompactItemize} |
---|
80 | \item |
---|
81 | \hypertarget{classbdm_1_1eigamma_b496396f3511ce87d7ae3830ba94262c}{ |
---|
82 | \textbf{eigamma} ()} |
---|
83 | \label{classbdm_1_1eigamma_b496396f3511ce87d7ae3830ba94262c} |
---|
84 | |
---|
85 | \item |
---|
86 | \hypertarget{classbdm_1_1eigamma_2870f6a8ffda9eb2fbaf9f85ea04c05f}{ |
---|
87 | \textbf{eigamma} (const vec \&a, const vec \&b)} |
---|
88 | \label{classbdm_1_1eigamma_2870f6a8ffda9eb2fbaf9f85ea04c05f} |
---|
89 | |
---|
90 | \item |
---|
91 | \hypertarget{classbdm_1_1eigamma_09e616c95f31acddf7dfef96d1c5d645}{ |
---|
92 | void \textbf{set\_\-parameters} (const vec \&a, const vec \&b)} |
---|
93 | \label{classbdm_1_1eigamma_09e616c95f31acddf7dfef96d1c5d645} |
---|
94 | |
---|
95 | \end{CompactItemize} |
---|
96 | \end{Indent} |
---|
97 | \begin{Indent}{\bf Constructors}\par |
---|
98 | {\em Construction of each \hyperlink{classbdm_1_1epdf}{epdf} should support two types of constructors: \begin{itemize} |
---|
99 | \item empty constructor, \item copy constructor,\end{itemize} |
---|
100 | The following constructors should be supported for convenience: \begin{itemize} |
---|
101 | \item constructor followed by calling {\tt set\_\-parameters()} \item constructor accepting random variables calling {\tt \hyperlink{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{set\_\-rv()}} \end{itemize} |
---|
102 | All internal data structures are constructed as empty. Their values (including sizes) will be set by method {\tt set\_\-parameters()}. This way references can be initialized in constructors. }\begin{CompactItemize} |
---|
103 | \item |
---|
104 | \hypertarget{classbdm_1_1epdf_840de94aa33cf4f2ebd2427f45a165d8}{ |
---|
105 | void \textbf{set\_\-parameters} (int dim0)} |
---|
106 | \label{classbdm_1_1epdf_840de94aa33cf4f2ebd2427f45a165d8} |
---|
107 | |
---|
108 | \end{CompactItemize} |
---|
109 | \end{Indent} |
---|
110 | \begin{Indent}{\bf Matematical Operations}\par |
---|
111 | \begin{CompactItemize} |
---|
112 | \item |
---|
113 | \hypertarget{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{ |
---|
114 | virtual mat \hyperlink{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{sample\_\-m} (int N) const } |
---|
115 | \label{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058} |
---|
116 | |
---|
117 | \begin{CompactList}\small\item\em Returns N samples, $ [x_1 , x_2 , \ldots \ $ from density $ f_x(rv)$. \item\end{CompactList}\item |
---|
118 | \hypertarget{classbdm_1_1epdf_34956d4dd3176eeb5937cf48a1546b62}{ |
---|
119 | virtual vec \hyperlink{classbdm_1_1epdf_34956d4dd3176eeb5937cf48a1546b62}{evallog\_\-m} (const mat \&Val) const } |
---|
120 | \label{classbdm_1_1epdf_34956d4dd3176eeb5937cf48a1546b62} |
---|
121 | |
---|
122 | \begin{CompactList}\small\item\em Compute log-probability of multiple values argument {\tt val}. \item\end{CompactList}\item |
---|
123 | \hypertarget{classbdm_1_1epdf_e584eac5579c1b6384947ecf66166c77}{ |
---|
124 | virtual \hyperlink{classbdm_1_1mpdf}{mpdf} $\ast$ \hyperlink{classbdm_1_1epdf_e584eac5579c1b6384947ecf66166c77}{condition} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const } |
---|
125 | \label{classbdm_1_1epdf_e584eac5579c1b6384947ecf66166c77} |
---|
126 | |
---|
127 | \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 |
---|
128 | \hypertarget{classbdm_1_1epdf_3fb2ece54f720b62ad325e61214fa0a1}{ |
---|
129 | virtual \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1epdf_3fb2ece54f720b62ad325e61214fa0a1}{marginal} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const } |
---|
130 | \label{classbdm_1_1epdf_3fb2ece54f720b62ad325e61214fa0a1} |
---|
131 | |
---|
132 | \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}\end{CompactItemize} |
---|
133 | \end{Indent} |
---|
134 | \begin{Indent}{\bf Connection to other classes}\par |
---|
135 | {\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} |
---|
136 | \item |
---|
137 | \hypertarget{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{ |
---|
138 | void \hyperlink{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv0)} |
---|
139 | \label{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff} |
---|
140 | |
---|
141 | \begin{CompactList}\small\item\em Name its rv. \item\end{CompactList}\item |
---|
142 | \hypertarget{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{ |
---|
143 | bool \hyperlink{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{isnamed} () const } |
---|
144 | \label{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9} |
---|
145 | |
---|
146 | \begin{CompactList}\small\item\em True if rv is assigned. \item\end{CompactList}\item |
---|
147 | \hypertarget{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{ |
---|
148 | const \hyperlink{classbdm_1_1RV}{RV} \& \hyperlink{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{\_\-rv} () const } |
---|
149 | \label{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21} |
---|
150 | |
---|
151 | \begin{CompactList}\small\item\em Return name (fails when isnamed is false). \item\end{CompactList}\end{CompactItemize} |
---|
152 | \end{Indent} |
---|
153 | \begin{Indent}{\bf Access to attributes}\par |
---|
154 | \begin{CompactItemize} |
---|
155 | \item |
---|
156 | \hypertarget{classbdm_1_1epdf_7083a65f7b7a0d0d13b2c516bd2ec29c}{ |
---|
157 | int \hyperlink{classbdm_1_1epdf_7083a65f7b7a0d0d13b2c516bd2ec29c}{dimension} () const } |
---|
158 | \label{classbdm_1_1epdf_7083a65f7b7a0d0d13b2c516bd2ec29c} |
---|
159 | |
---|
160 | \begin{CompactList}\small\item\em Size of the random variable. \item\end{CompactList}\end{CompactItemize} |
---|
161 | \end{Indent} |
---|
162 | \subsection*{Protected Attributes} |
---|
163 | \begin{CompactItemize} |
---|
164 | \item |
---|
165 | \hypertarget{classbdm_1_1eigamma_3e5c03201f073033a7db894fa15ddb96}{ |
---|
166 | \hyperlink{classbdm_1_1egamma}{egamma} \hyperlink{classbdm_1_1eigamma_3e5c03201f073033a7db894fa15ddb96}{eg}} |
---|
167 | \label{classbdm_1_1eigamma_3e5c03201f073033a7db894fa15ddb96} |
---|
168 | |
---|
169 | \begin{CompactList}\small\item\em internal \hyperlink{classbdm_1_1egamma}{egamma} \item\end{CompactList}\item |
---|
170 | \hypertarget{classbdm_1_1eigamma_494fafd76d9448395efe160c9ba11ab6}{ |
---|
171 | vec \& \hyperlink{classbdm_1_1eigamma_494fafd76d9448395efe160c9ba11ab6}{alpha}} |
---|
172 | \label{classbdm_1_1eigamma_494fafd76d9448395efe160c9ba11ab6} |
---|
173 | |
---|
174 | \begin{CompactList}\small\item\em Vector $\alpha$. \item\end{CompactList}\item |
---|
175 | \hypertarget{classbdm_1_1eigamma_e32ff12ba6b2fdc22068c35dace23fa6}{ |
---|
176 | vec \& \hyperlink{classbdm_1_1eigamma_e32ff12ba6b2fdc22068c35dace23fa6}{beta}} |
---|
177 | \label{classbdm_1_1eigamma_e32ff12ba6b2fdc22068c35dace23fa6} |
---|
178 | |
---|
179 | \begin{CompactList}\small\item\em Vector $\beta$ (in fact it is 1/beta as used in definition of iG). \item\end{CompactList}\item |
---|
180 | \hypertarget{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{ |
---|
181 | int \hyperlink{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{dim}} |
---|
182 | \label{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce} |
---|
183 | |
---|
184 | \begin{CompactList}\small\item\em dimension of the random variable \item\end{CompactList}\item |
---|
185 | \hypertarget{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{ |
---|
186 | \hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}} |
---|
187 | \label{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8} |
---|
188 | |
---|
189 | \begin{CompactList}\small\item\em Description of the random variable. \item\end{CompactList}\end{CompactItemize} |
---|
190 | |
---|
191 | |
---|
192 | The documentation for this class was generated from the following file:\begin{CompactItemize} |
---|
193 | \item |
---|
194 | \hyperlink{libEF_8h}{libEF.h}\end{CompactItemize} |
---|