LDA++
UnsupervisedEStep.hpp
1 #ifndef _LDAPLUSPLUS_EM_UNSUPERVISEDESTEP_HPP_
2 #define _LDAPLUSPLUS_EM_UNSUPERVISEDESTEP_HPP_
3 
4 #include "ldaplusplus/em/AbstractEStep.hpp"
5 
6 namespace ldaplusplus {
7 namespace em {
8 
9 
25 template <typename Scalar>
26 class UnsupervisedEStep : public AbstractEStep<Scalar>
27 {
28  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;
29  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
30 
31  public:
45  size_t e_step_iterations = 10,
46  Scalar e_step_tolerance = 1e-2,
47  Scalar compute_likelihood = 1.0,
48  int random_state = 0
49  );
50 
71  virtual std::shared_ptr<parameters::Parameters> doc_e_step(
72  const std::shared_ptr<corpus::Document> doc,
73  const std::shared_ptr<parameters::Parameters> parameters
74  ) override;
75 
76  private:
77  // The maximum number of iterations in E-step.
78  size_t e_step_iterations_;
79  // The convergence tolerance for the maximazation of the ELBO w.r.t.
80  // phi and gamma in E-step
81  Scalar e_step_tolerance_;
82  // Compute the likelihood of that many documents (pecentile)
83  Scalar compute_likelihood_;
84 };
85 
86 } // namespace em
87 } // namespace ldaplusplus
88 
89 #endif // _LDAPLUSPLUS_EM_UNSUPERVISEDESTEP_HPP_
virtual std::shared_ptr< parameters::Parameters > doc_e_step(const std::shared_ptr< corpus::Document > doc, const std::shared_ptr< parameters::Parameters > parameters) override
Definition: UnsupervisedEStep.cpp:26
UnsupervisedEStep(size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar compute_likelihood=1.0, int random_state=0)
Definition: UnsupervisedEStep.cpp:13
Definition: UnsupervisedEStep.hpp:26
Definition: AbstractEStep.hpp:21
Definition: Document.hpp:11