LDA++
Public Member Functions | List of all members
ldaplusplus::em::CorrespondenceSupervisedMStep< Scalar > Class Template Reference

#include <CorrespondenceSupervisedMStep.hpp>

Inheritance diagram for ldaplusplus::em::CorrespondenceSupervisedMStep< Scalar >:
ldaplusplus::em::MStepInterface< Scalar > ldaplusplus::events::EventDispatcherComposition

Public Member Functions

 CorrespondenceSupervisedMStep (Scalar mu=2.)
 
virtual void m_step (std::shared_ptr< parameters::Parameters > parameters) override
 
virtual void doc_m_step (const std::shared_ptr< corpus::Document > doc, const std::shared_ptr< parameters::Parameters > v_parameters, std::shared_ptr< parameters::Parameters > m_parameters) override
 
- Public Member Functions inherited from ldaplusplus::events::EventDispatcherComposition
std::shared_ptr< EventDispatcherInterfaceget_event_dispatcher ()
 
void set_event_dispatcher (std::shared_ptr< EventDispatcherInterface > dispatcher)
 

Detailed Description

template<typename Scalar>
class ldaplusplus::em::CorrespondenceSupervisedMStep< Scalar >

CorrespondenceSupervisedMStep implements the maximization step of a variant of the correspondence LDA model.

This model implements the correspondence LDA but instead of labels it tries to also generate the class of the document. The generative procedure is the following:

  1. Given \(K\) \(V\)-dimensional multinomials as the topics and \(K\) \(C\)-dimensional multinomials to sample class labels from
  2. Sample from a Dirichlet the topic mixture from a document
  3. For N times
    1. Sample a topic \(k\)
    2. From that topic sample a word using the \(k\)-th \(V\)-dimensional multinomial
  4. Sample from a uniform distribution a number \(n\) between 1 and N
  5. Using the previously sampled \(n\)-th topic sample a class label from the multinomials

Member Function Documentation

template<typename Scalar >
void ldaplusplus::CorrespondenceSupervisedMStep::doc_m_step ( const std::shared_ptr< corpus::Document doc,
const std::shared_ptr< parameters::Parameters v_parameters,
std::shared_ptr< parameters::Parameters m_parameters 
)
overridevirtual

Count the occurences of every word and class to implement maximum likelihood estimation in the m_step()

Parameters
docA single document
v_parametersThe variational parameters used in m-step in order to maximize model parameters
m_parametersModel parameters, used as output in case of online methods

Implements ldaplusplus::em::MStepInterface< Scalar >.

template<typename Scalar >
void ldaplusplus::CorrespondenceSupervisedMStep::m_step ( std::shared_ptr< parameters::Parameters parameters)
overridevirtual

Maximize the ELBO w.r.t. to \(\beta\) and \(\eta\) (the topics and class generating multinomials).

Parameters
parametersModel parameters (maybe changed after call)

Implements ldaplusplus::em::MStepInterface< Scalar >.


The documentation for this class was generated from the following files: