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

#include <AbstractEStep.hpp>

Inheritance diagram for ldaplusplus::em::AbstractEStep< Scalar >:
ldaplusplus::em::EStepInterface< Scalar > ldaplusplus::events::EventDispatcherComposition ldaplusplus::em::CorrespondenceSupervisedEStep< Scalar > ldaplusplus::em::FastSupervisedEStep< Scalar > ldaplusplus::em::MultinomialSupervisedEStep< Scalar > ldaplusplus::em::SupervisedEStep< Scalar > ldaplusplus::em::UnsupervisedEStep< Scalar >

Public Member Functions

 AbstractEStep (int random_state)
 
virtual void e_step () override
 
- Public Member Functions inherited from ldaplusplus::em::EStepInterface< Scalar >
virtual std::shared_ptr< parameters::Parametersdoc_e_step (const std::shared_ptr< corpus::Document > doc, const std::shared_ptr< parameters::Parameters > parameters)=0
 
- Public Member Functions inherited from ldaplusplus::events::EventDispatcherComposition
std::shared_ptr< EventDispatcherInterfaceget_event_dispatcher ()
 
void set_event_dispatcher (std::shared_ptr< EventDispatcherInterface > dispatcher)
 

Protected Member Functions

bool converged (const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &gamma_old, const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &gamma, Scalar tolerance)
 
PRNGget_prng ()
 

Detailed Description

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

A base class that provides few common functionalities for implementing an E step.

Constructor & Destructor Documentation

template<typename Scalar >
ldaplusplus::em::AbstractEStep< Scalar >::AbstractEStep ( int  random_state)

Require a random state to be passed from the extending classes.

Parameters
random_stateAn initial seed value for random number generation.

Member Function Documentation

template<typename Scalar >
bool ldaplusplus::em::AbstractEStep< Scalar >::converged ( const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &  gamma_old,
const Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > &  gamma,
Scalar  tolerance 
)
protected

Check for convergence based on the mean relative change of the variational parameter \(\gamma\).

Parameters
gamma_oldThe gamma of the previous iteration.
gammaThe gamma of this iteration.
toleranceThe threshold below which we declare convergence.
Returns
Whether the change is small enough to indicate convergence.
template<typename Scalar >
virtual void ldaplusplus::em::AbstractEStep< Scalar >::e_step ( )
inlineoverridevirtual

Implement an empty e_step because almost nobody needs to perform some action at the end of each corpus epoch.

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

Reimplemented in ldaplusplus::em::FastSupervisedEStep< Scalar >.

template<typename Scalar >
PRNG& ldaplusplus::em::AbstractEStep< Scalar >::get_prng ( )
inlineprotected

Return a PRNG for use with any distribution.

Although this isn't all that different from making random_ protected it could allow for future change of the object returned since it can be anything that satisfies the UniformRandomBitGenerator (see: http://en.cppreference.com/w/cpp/concept/UniformRandomBitGenerator).


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