LDA++
MultinomialSupervisedEStep.hpp
1 #ifndef _LDAPLUSPLUS_EM_MULTINOMIALSUPERVISEDESTEP_HPP_
2 #define _LDAPLUSPLUS_EM_MULTINOMIALSUPERVISEDESTEP_HPP__
3 
4 #include "ldaplusplus/em/AbstractEStep.hpp"
5 
6 namespace ldaplusplus {
7 namespace em {
8 
9 
10 template<typename Scalar>
12 {
13  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;
14  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
15 
16  public:
36  size_t e_step_iterations = 10,
37  Scalar e_step_tolerance = 1e-2,
38  Scalar mu = 2,
39  Scalar eta_weight = 1,
40  Scalar compute_likelihood = 1.0,
41  int random_state = 0
42  );
43 
68  std::shared_ptr<parameters::Parameters> doc_e_step(
69  const std::shared_ptr<corpus::Document> doc,
70  const std::shared_ptr<parameters::Parameters> parameters
71  ) override;
72 
73  private:
74  // The maximum number of iterations in E-step.
75  size_t e_step_iterations_;
76  // The convergence tolerance for the maximazation of the ELBO w.r.t.
77  // phi and gamma in E-step.
78  Scalar e_step_tolerance_;
79  // The Dirichlet prior for the class predicting parameters.
80  Scalar mu_;
81  // A weighting parameter that either increases or decreases the
82  // influence of the supervised part.
83  Scalar eta_weight_;
84  // Compute the likelihood of that many documents (pecentile)
85  Scalar compute_likelihood_;
86 };
87 
88 } // namespace em
89 } // namespace ldaplusplus
90 
91 #endif // _LDAPLUSPLUS_EM_MULTINOMIALSUPERVISEDESTEP_HPP_
std::shared_ptr< parameters::Parameters > doc_e_step(const std::shared_ptr< corpus::Document > doc, const std::shared_ptr< parameters::Parameters > parameters) override
Definition: MultinomialSupervisedEStep.cpp:27
Definition: MultinomialSupervisedEStep.hpp:11
MultinomialSupervisedEStep(size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar mu=2, Scalar eta_weight=1, Scalar compute_likelihood=1.0, int random_state=0)
Definition: MultinomialSupervisedEStep.cpp:10
Definition: AbstractEStep.hpp:21
Definition: Document.hpp:11