LDA++
SupervisedEStep.hpp
1 #ifndef _LDAPLUSPLUS_EM_SUPERVISEDESTEP_HPP_
2 #define _LDAPLUSPLUS_EM_SUPERVISEDESTEP_HPP_
3 
4 #include "ldaplusplus/em/AbstractEStep.hpp"
5 
6 namespace ldaplusplus {
7 namespace em {
8 
9 
28 template <typename Scalar>
29 class SupervisedEStep : public AbstractEStep<Scalar>
30 {
31  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;
32  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
33 
34  public:
51  size_t e_step_iterations = 10,
52  Scalar e_step_tolerance = 1e-2,
53  size_t fixed_point_iterations = 20,
54  Scalar compute_likelihood = 1.0,
55  int random_state = 0
56  );
57 
90  std::shared_ptr<parameters::Parameters> doc_e_step(
91  const std::shared_ptr<corpus::Document> doc,
92  const std::shared_ptr<parameters::Parameters> parameters
93  ) override;
94 
95  private:
96  // The maximum number of iterations in E-step.
97  size_t e_step_iterations_;
98  // The maximum number of iterations while maximizing phi in E-step.
99  size_t fixed_point_iterations_;
100  // The convergence tolerance for the maximazation of the ELBO w.r.t.
101  // phi and gamma in E-step.
102  Scalar e_step_tolerance_;
103  // Compute the likelihood of that many documents (pecentile)
104  Scalar compute_likelihood_;
105 };
106 
107 } // namespace em
108 } // namespace ldaplusplus
109 
110 #endif // _LDAPLUSPLUS_EM_SUPERVISEDESTEP_HPP_
Definition: SupervisedEStep.hpp:29
std::shared_ptr< parameters::Parameters > doc_e_step(const std::shared_ptr< corpus::Document > doc, const std::shared_ptr< parameters::Parameters > parameters) override
Definition: SupervisedEStep.cpp:25
SupervisedEStep(size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, size_t fixed_point_iterations=20, Scalar compute_likelihood=1.0, int random_state=0)
Definition: SupervisedEStep.cpp:10
Definition: AbstractEStep.hpp:21
Definition: Document.hpp:11