LDA++
|
#include <CorrespondenceSupervisedEStep.hpp>
Public Member Functions | |
CorrespondenceSupervisedEStep (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar mu=2., Scalar compute_likelihood=1.0, int random_state=0) | |
std::shared_ptr< parameters::Parameters > | doc_e_step (const std::shared_ptr< corpus::Document > doc, const std::shared_ptr< parameters::Parameters > parameters) override |
Public Member Functions inherited from ldaplusplus::em::AbstractEStep< Scalar > | |
AbstractEStep (int random_state) | |
virtual void | e_step () override |
Public Member Functions inherited from ldaplusplus::events::EventDispatcherComposition | |
std::shared_ptr< EventDispatcherInterface > | get_event_dispatcher () |
void | set_event_dispatcher (std::shared_ptr< EventDispatcherInterface > dispatcher) |
Additional Inherited Members | |
Protected Member Functions inherited from ldaplusplus::em::AbstractEStep< Scalar > | |
bool | converged (const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &gamma_old, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &gamma, Scalar tolerance) |
PRNG & | get_prng () |
CorrespondenceSupervisedEStep implements the expectation step of a variant of the correspondence LDA model as it was introduced in [1]. Iinstead of trying to generate labels it tries to generate the class of the document.
The generative process according to this model is summarized below:
Exact probabilistic inference for this model is intractable, thus we use variational inference methods. The factorized distribution on the latent variables is the following.
\( q\left(\theta, z, \lambda \right) = q\left(\theta \mid \gamma\right)\left( \prod_{n=1}^N q\left(z_n \mid \phi_n \right)\right)q\left(\lambda \mid \tau \right)\)
[1] Blei, D.M. and Jordan, M.I., 2003, July. Modeling annotated data. In Proceedings of the 26th annual international ACM SIGIR conference on Research and development in informaion retrieval (pp. 127-134). ACM.
ldaplusplus::em::CorrespondenceSupervisedEStep< Scalar >::CorrespondenceSupervisedEStep | ( | size_t | e_step_iterations = 10 , |
Scalar | e_step_tolerance = 1e-2 , |
||
Scalar | mu = 2. , |
||
Scalar | compute_likelihood = 1.0 , |
||
int | random_state = 0 |
||
) |
e_step_iterations | The max number of times to alternate between maximizing for \(\gamma\) and for \(\phi\). |
e_step_tolerance | The minimum relative change in the variational parameter \(\gamma\). |
mu | The uniform Dirichlet prior of \(\eta\), practically is a smoothing parameter during the maximization of \(\eta\). |
compute_likelihood | The percentage of documents to compute likelihood for (1.0 means compute for every document) |
random_state | An initial seed value for any random numbers needed |
|
overridevirtual |
Maximize the ELBO w.r.t. \(\phi\) and \(\gamma\).
The following steps are the mathematics that are implemented where \(\beta\) are the over words topics distributions, \(\alpha\) is the Dirichlet prior, \(\eta\) are the logistic regression parameters, \(\tau\) are the \(N\)-dimensional mutltinomial parameters, \(i\) is the topic subscript, \(n\) is the word subscript, \(\hat{y}\) is the class subscript, \(y\) is the document's class, \(w_n\) is n-th word vocabulary index, and finally \(\Psi(\cdot)\) is the first derivative of the \(\log \Gamma\) function.
doc | A single document. |
parameters | An instance of class Parameters, which contains all necessary model parameters for e-step's implementation. |
Implements ldaplusplus::em::EStepInterface< Scalar >.