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

#include <LDABuilder.hpp>

Inheritance diagram for ldaplusplus::LDABuilder< Scalar >:
ldaplusplus::LDABuilderInterface< Scalar >

Public Member Functions

 LDABuilder ()
 
LDABuilderset_iterations (size_t iterations)
 
LDABuilderset_workers (size_t workers)
 
std::shared_ptr< em::EStepInterface< Scalar > > get_classic_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar compute_likelihood=1.0, int random_state=0)
 
LDABuilderset_classic_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar compute_likelihood=1.0, int random_state=0)
 
std::shared_ptr< em::EStepInterface< Scalar > > get_supervised_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, size_t fixed_point_iterations=10, Scalar compute_likelihood=1.0, int random_state=0)
 
LDABuilderset_supervised_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, size_t fixed_point_iterations=10, Scalar compute_likelihood=1.0, int random_state=0)
 
std::shared_ptr< em::EStepInterface< Scalar > > get_fast_supervised_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar C=1, Scalar compute_likelihood=1.0, int random_state=0)
 
LDABuilderset_fast_supervised_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar C=1, Scalar compute_likelihood=1.0, int random_state=0)
 
std::shared_ptr< em::EStepInterface< Scalar > > get_semi_supervised_e_step (std::shared_ptr< em::EStepInterface< Scalar > > supervised_step=nullptr, std::shared_ptr< em::EStepInterface< Scalar > > unsupervised_step=nullptr)
 
LDABuilderset_semi_supervised_e_step (std::shared_ptr< em::EStepInterface< Scalar > > supervised_step=nullptr, std::shared_ptr< em::EStepInterface< Scalar > > unsupervised_step=nullptr)
 
std::shared_ptr< em::EStepInterface< Scalar > > get_multinomial_supervised_e_step (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)
 
LDABuilderset_multinomial_supervised_e_step (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)
 
std::shared_ptr< em::EStepInterface< Scalar > > get_correspondence_supervised_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar mu=2, Scalar compute_likelihood=1.0, int random_state=0)
 
LDABuilderset_correspondence_supervised_e_step (size_t e_step_iterations=10, Scalar e_step_tolerance=1e-2, Scalar mu=2, Scalar compute_likelihood=1.0, int random_state=0)
 
LDABuilderset_e (std::shared_ptr< em::EStepInterface< Scalar > > e_step)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_classic_m_step ()
 
LDABuilderset_classic_m_step ()
 
std::shared_ptr< em::MStepInterface< Scalar > > get_fast_supervised_m_step (size_t m_step_iterations=10, Scalar m_step_tolerance=1e-2, Scalar regularization_penalty=1e-2)
 
LDABuilderset_fast_supervised_m_step (size_t m_step_iterations=10, Scalar m_step_tolerance=1e-2, Scalar regularization_penalty=1e-2)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_supervised_m_step (size_t m_step_iterations=10, Scalar m_step_tolerance=1e-2, Scalar regularization_penalty=1e-2)
 
LDABuilderset_supervised_m_step (size_t m_step_iterations=10, Scalar m_step_tolerance=1e-2, Scalar regularization_penalty=1e-2)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_fast_supervised_online_m_step (size_t num_classes, Scalar regularization_penalty=1e-2, size_t minibatch_size=128, Scalar eta_momentum=0.9, Scalar eta_learning_rate=0.01, Scalar beta_weight=0.9)
 
LDABuilderset_fast_supervised_online_m_step (size_t num_classes, Scalar regularization_penalty=1e-2, size_t minibatch_size=128, Scalar eta_momentum=0.9, Scalar eta_learning_rate=0.01, Scalar beta_weight=0.9)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_fast_supervised_online_m_step (std::vector< Scalar > class_weights, Scalar regularization_penalty=1e-2, size_t minibatch_size=128, Scalar eta_momentum=0.9, Scalar eta_learning_rate=0.01, Scalar beta_weight=0.9)
 
LDABuilderset_fast_supervised_online_m_step (std::vector< Scalar > class_weights, Scalar regularization_penalty=1e-2, size_t minibatch_size=128, Scalar eta_momentum=0.9, Scalar eta_learning_rate=0.01, Scalar beta_weight=0.9)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_fast_supervised_online_m_step (Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > class_weights, Scalar regularization_penalty=1e-2, size_t minibatch_size=128, Scalar eta_momentum=0.9, Scalar eta_learning_rate=0.01, Scalar beta_weight=0.9)
 
LDABuilderset_fast_supervised_online_m_step (Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > class_weights, Scalar regularization_penalty=1e-2, size_t minibatch_size=128, Scalar eta_momentum=0.9, Scalar eta_learning_rate=0.01, Scalar beta_weight=0.9)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_semi_supervised_m_step (size_t m_step_iterations=10, Scalar m_step_tolerance=1e-2, Scalar regularization_penalty=1e-2)
 
LDABuilderset_semi_supervised_m_step (size_t m_step_iterations=10, Scalar m_step_tolerance=1e-2, Scalar regularization_penalty=1e-2)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_multinomial_supervised_m_step (Scalar mu=2.)
 
LDABuilderset_multinomial_supervised_m_step (Scalar mu=2.)
 
std::shared_ptr< em::MStepInterface< Scalar > > get_correspondence_supervised_m_step (Scalar mu=2.)
 
LDABuilderset_correspondence_supervised_m_step (Scalar mu=2.)
 
LDABuilderset_m (std::shared_ptr< em::MStepInterface< Scalar > > m_step)
 
LDABuilderinitialize_topics_seeded (const Eigen::MatrixXi &X, size_t topics, size_t N=30, int random_state=0)
 
LDABuilderinitialize_topics_seeded (std::shared_ptr< corpus::Corpus > corpus, size_t topics, size_t N=30, int random_state=0)
 
LDABuilderinitialize_topics_random (size_t words, size_t topics, int random_state=0)
 
LDABuilderinitialize_topics_from_model (std::shared_ptr< parameters::ModelParameters< Scalar > > model)
 
LDABuilderinitialize_eta_zeros (size_t num_classes)
 
LDABuilderinitialize_eta_uniform (size_t num_classes)
 
LDABuilderinitialize_eta_from_model (std::shared_ptr< parameters::SupervisedModelParameters< Scalar > > model)
 
virtual operator LDA< Scalar > () const override
 

Detailed Description

template<typename Scalar = double>
class ldaplusplus::LDABuilder< Scalar >

The LDABuilder provides a simpler interface to build an LDA.

The builder has the following three main responsibilities:

  1. Create an expectation step
  2. Create a maximization step
  3. Create & Initialize the model parameters

Examples:

LDA<double> lda = LDABuilder<double>(). initialize_topics_seeded(X, 100);

LDA<double> lda = LDABuilder<double>(). set_iterations(20). set_classic_e_step(). set_supervised_m_step(). initialize_topics_seeded(X, 100). initialize_eta_zeros(y.maxCoeff() + 1);

LDA<double> lda = LDABuilder<double>(). set_classic_e_step(50, 1e-2). set_supervised_m_step(). initialize_topics_from_model(model). initialize_eta_from_model(model);

Constructor & Destructor Documentation

template<typename Scalar >
ldaplusplus::LDABuilder< Scalar >::LDABuilder ( )

Create a default builder that will create a simple unsupervised LDA.

The default builder uses unsupervised expectation and maximization steps with 20 iterations and as many workers as there are cpus available.

Before being usable the model parameters must be initialized to set the number of topics etc.

Member Function Documentation

template<typename Scalar >
std::shared_ptr< em::EStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_classic_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)

Create an UnsupervisedEStep.

You can also see a description of the parameters at UnsupervisedEStep::UnsupervisedEStep

Parameters
e_step_iterationsThe max number of times to alternate between maximizing for \(\gamma\) and for \(\phi\).
e_step_toleranceThe minimum relative change in the variational parameter \(\gamma\).
compute_likelihoodThe percentage of documents to compute likelihood for (1.0 means compute for every document)
random_stateAn initial seed value for any random numbers needed
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_classic_m_step ( )

Create an UnsupervisedMStep.

template<typename Scalar >
std::shared_ptr< em::EStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_correspondence_supervised_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
Scalar  mu = 2,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)

Create an CorrespondenceSupervisedEStep.

You can also see a description of the parameters at CorrespondenceSupervisedEStep::CorrespondenceSupervisedEStep.

Parameters
e_step_iterationsThe maximum iterations for each document's expectation step
e_step_toleranceThe minimum relative change in the ELBO (less than that and we stop iterating)
muA uniform Dirichlet prior for the supervised parameters (default: 2)
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_correspondence_supervised_m_step ( Scalar  mu = 2.)

Create a CorrespondenceSupervisedMStep.

You can also see a description of the parameters at CorrespondenceSupervisedMStep::CorrespondenceSupervisedMStep.

Parameters
muA uniform Dirichlet prior for the supervised parameters
template<typename Scalar >
std::shared_ptr< em::EStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_fast_supervised_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
Scalar  C = 1,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)

Create a FastSupervisedEStep.

You can also see a description of the parameters at FastSupervisedEStep::FastSupervisedEStep.

Parameters
e_step_iterationsThe maximum iterations for each document's expectation step
e_step_toleranceThe minimum relative change in the ELBO (less than that and we stop iterating)
CWeight of the supervised part in the inference (default: 1)
compute_likelihoodThe percentage of documents to compute likelihood for (1.0 means compute for every document)
random_stateAn initial seed value for any random numbers needed
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_fast_supervised_m_step ( size_t  m_step_iterations = 10,
Scalar  m_step_tolerance = 1e-2,
Scalar  regularization_penalty = 1e-2 
)

Create a SupervisedMStep.

You can also see a description of the parameters at SupervisedMStep::SupervisedMStep.

Parameters
m_step_iterationsThe maximum number of gradient descent iterations
m_step_toleranceThe minimum relative improvement in the log likelihood between consecutive gradient descent iterations
regularization_penaltyThe L2 penalty for logistic regression
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_fast_supervised_online_m_step ( size_t  num_classes,
Scalar  regularization_penalty = 1e-2,
size_t  minibatch_size = 128,
Scalar  eta_momentum = 0.9,
Scalar  eta_learning_rate = 0.01,
Scalar  beta_weight = 0.9 
)

Create an FastOnlineSupervisedMStep without specifying class weights.

You can also see a description of the parameters at FastOnlineSupervisedMStep::FastOnlineSupervisedMStep.

Parameters
num_classesThe number of classes
regularization_penaltyThe L2 penalty for the logistic regression
minibatch_sizeAfter that many documents call m_step()
eta_momentumThe momentum for the SGD update of \(\eta\)
eta_learning_rateThe learning rate for the SGD update of \(\eta\)
beta_weightThe weight for the online update of \(\beta\)
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_fast_supervised_online_m_step ( std::vector< Scalar >  class_weights,
Scalar  regularization_penalty = 1e-2,
size_t  minibatch_size = 128,
Scalar  eta_momentum = 0.9,
Scalar  eta_learning_rate = 0.01,
Scalar  beta_weight = 0.9 
)

Create an FastOnlineSupervisedMStep.

You can also see a description of the parameters at FastOnlineSupervisedMStep::FastOnlineSupervisedMStep.

Parameters
class_weightsWeights to account for class imbalance
regularization_penaltyThe L2 penalty for the logistic regression
minibatch_sizeAfter that many documents call m_step()
eta_momentumThe momentum for the SGD update of \(\eta\)
eta_learning_rateThe learning rate for the SGD update of \(\eta\)
beta_weightThe weight for the online update of \(\beta\)
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_fast_supervised_online_m_step ( Eigen::Matrix< Scalar, Eigen::Dynamic, 1 >  class_weights,
Scalar  regularization_penalty = 1e-2,
size_t  minibatch_size = 128,
Scalar  eta_momentum = 0.9,
Scalar  eta_learning_rate = 0.01,
Scalar  beta_weight = 0.9 
)

Create an FastOnlineSupervisedMStep.

You can also see a description of the parameters at FastOnlineSupervisedMStep::FastOnlineSupervisedMStep.

Parameters
class_weightsWeights to account for class imbalance
regularization_penaltyThe L2 penalty for the logistic regression
minibatch_sizeAfter that many documents call m_step()
eta_momentumThe momentum for the SGD update of \(\eta\)
eta_learning_rateThe learning rate for the SGD update of \(\eta\)
beta_weightThe weight for the online update of \(\beta\)
template<typename Scalar >
std::shared_ptr< em::EStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_multinomial_supervised_e_step ( 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 
)

Create an MultinomialSupervisedEStep.

You can also see a description of the parameters at MultinomialSupervisedEStep::MultinomialSupervisedEStep.

Parameters
e_step_iterationsThe max number of times to alternate between maximizing for \(\gamma\) and for \(\phi\).
e_step_toleranceThe minimum relative change in the variational parameter \(\gamma\).
muThe uniform Dirichlet prior of \(\eta\), practically is a smoothing parameter during the maximization of \(\eta\).
eta_weightA weighting parameter that either increases or decreases the influence of the supervised part.
compute_likelihoodThe percentage of documents to compute likelihood for (1.0 means compute for every document)
random_stateAn initial seed value for any random numbers needed
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_multinomial_supervised_m_step ( Scalar  mu = 2.)

Create a MultinomialSupervisedMStep.

You can also see a description of the parameters at MultinomialSupervisedMStep::MultinomialSupervisedMStep.

Parameters
muA uniform Dirichlet prior for the supervised parameters
template<typename Scalar >
std::shared_ptr< em::EStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_semi_supervised_e_step ( std::shared_ptr< em::EStepInterface< Scalar > >  supervised_step = nullptr,
std::shared_ptr< em::EStepInterface< Scalar > >  unsupervised_step = nullptr 
)

Create a SemiSupervisedEStep.

You can also see a description of the parameters at SemiSupervisedEStep::SemiSupervisedEStep.

Parameters
supervised_stepThe supervised step to use (when nullptr is provided it defaults to FastSupervisedEStep with default parameters)
unsupervised_stepThe unsupervised step to use (when nullptr is provided it defaults to FastUnsupervisedEStep with default parameters)
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_semi_supervised_m_step ( size_t  m_step_iterations = 10,
Scalar  m_step_tolerance = 1e-2,
Scalar  regularization_penalty = 1e-2 
)

Create a SemiSupervisedMStep.

You can also see a description of the parameters at SemiSupervisedMStep::SemiSupervisedMStep.

Parameters
m_step_iterationsThe maximum number of gradient descent iterations
m_step_toleranceThe minimum relative improvement in the log likelihood between consecutive gradient descent iterations
regularization_penaltyThe L2 penalty for logistic regression
template<typename Scalar >
std::shared_ptr< em::EStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_supervised_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
size_t  fixed_point_iterations = 10,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)

Create a SupervisedEStep.

You can also see a description of the parameters at SupervisedEStep::SupervisedEStep.

Parameters
e_step_iterationsThe maximum iterations for each document's expectation step
e_step_toleranceThe minimum relative change in the ELBO (less than that and we stop iterating)
fixed_point_iterationsThe number of fixed point iterations see SupervisedEStep
template<typename Scalar >
std::shared_ptr< em::MStepInterface< Scalar > > ldaplusplus::LDABuilder< Scalar >::get_supervised_m_step ( size_t  m_step_iterations = 10,
Scalar  m_step_tolerance = 1e-2,
Scalar  regularization_penalty = 1e-2 
)

Create a SupervisedMStep.

You can also see a description of the parameters at SupervisedMStep::SupervisedMStep.

Parameters
m_step_iterationsThe maximum number of gradient descent iterations
m_step_toleranceThe minimum relative improvement in the log likelihood between consecutive gradient descent iterations
regularization_penaltyThe L2 penalty for logistic regression
template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::initialize_eta_from_model ( std::shared_ptr< parameters::SupervisedModelParameters< Scalar > >  model)
inline

Initialize the supervised model parameters from another model.

In practice copy \(\eta\) from the passed in model to a local copy.

template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::initialize_eta_uniform ( size_t  num_classes)

Initialize the supervised model parameters which generate the class label with a uniform multinomial distribution.

Parameters
num_classesThe number of classes
template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::initialize_eta_zeros ( size_t  num_classes)

Initialize the supervised model parameters which generate the class label with zeros.

Parameters
num_classesThe number of classes
template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::initialize_topics_from_model ( std::shared_ptr< parameters::ModelParameters< Scalar > >  model)
inline

Initialize the topic distributions from another model.

In practice copy \(\beta\) and \(\alpha\) from the passed in model to a local copy.

template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::initialize_topics_random ( size_t  words,
size_t  topics,
int  random_state = 0 
)

Initialize the topics over words distributions as random distributions.

This initialization also initializes alpha as 1.0 / topics

Parameters
wordsThe number of distinct words in the vocabulary
topicsThe number of topics
random_stateThe initial state of the random number generator
template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::initialize_topics_seeded ( const Eigen::MatrixXi &  X,
size_t  topics,
size_t  N = 30,
int  random_state = 0 
)

Initialize the topic over words distributions by seeding them from the passed in documents.

  1. For each topic t
  2. For N times sample a document d
  3. Add the word distribution of d to topic t

This initialization also initializes alpha as 1.0 / topics

Parameters
XThe word counts for each document
topicsThe number of topics
NThe number of documents to use for seeding
random_stateThe initial state of the random number generator
template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::initialize_topics_seeded ( std::shared_ptr< corpus::Corpus corpus,
size_t  topics,
size_t  N = 30,
int  random_state = 0 
)

Initialize the topic over words distributions by seeding them from the passed in documents.

  1. For each topic t
  2. For N times sample a document d
  3. Add the word distribution of d to topic t

This initialization also initializes alpha as 1.0 / topics

Parameters
corpusThe word counts for each document
topicsThe number of topics
NThe number of documents to use for seeding
random_stateThe initial state of the random number generator
template<typename Scalar = double>
virtual ldaplusplus::LDABuilder< Scalar >::operator LDA< Scalar > ( ) const
inlineoverridevirtual

Build a brand new LDA instance from the configuration of the builder.

Before returning it also checks a few things that would result in an unusable LDA instance and throws a runtime_error.

Implements ldaplusplus::LDABuilderInterface< Scalar >.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_classic_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)
inline

See the corresponding get_*_e_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_classic_m_step ( )
inline

See the corresponding get_*_m_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_correspondence_supervised_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
Scalar  mu = 2,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)
inline

See the corresponding get_*_e_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_correspondence_supervised_m_step ( Scalar  mu = 2.)
inline

See the corresponding get_*_m_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_e ( std::shared_ptr< em::EStepInterface< Scalar > >  e_step)
inline

Set an expectation step.

This is meant to be used with all the methods get_*_e_step() as in the following example.

auto builder = LDABuilder<double>();
builder.set_e(builder.get_fast_classic_e_step());
template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_fast_supervised_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
Scalar  C = 1,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)
inline

See the corresponding get_*_e_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_fast_supervised_m_step ( size_t  m_step_iterations = 10,
Scalar  m_step_tolerance = 1e-2,
Scalar  regularization_penalty = 1e-2 
)
inline

See the corresponding get_*_m_step() method.

template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::set_iterations ( size_t  iterations)

Choose a number of iterations see LDA::fit

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_m ( std::shared_ptr< em::MStepInterface< Scalar > >  m_step)
inline

Set a maximization step.

Can be used in conjuction with the get_*_m_step() methods.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_multinomial_supervised_e_step ( 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 
)
inline

See the corresponding get_*_e_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_multinomial_supervised_m_step ( Scalar  mu = 2.)
inline

See the corresponding get_*_m_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_semi_supervised_e_step ( std::shared_ptr< em::EStepInterface< Scalar > >  supervised_step = nullptr,
std::shared_ptr< em::EStepInterface< Scalar > >  unsupervised_step = nullptr 
)
inline

See the corresponding get_*_e_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_semi_supervised_m_step ( size_t  m_step_iterations = 10,
Scalar  m_step_tolerance = 1e-2,
Scalar  regularization_penalty = 1e-2 
)
inline

See the corresponding get_*_m_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_supervised_e_step ( size_t  e_step_iterations = 10,
Scalar  e_step_tolerance = 1e-2,
size_t  fixed_point_iterations = 10,
Scalar  compute_likelihood = 1.0,
int  random_state = 0 
)
inline

See the corresponding get_*_e_step() method.

template<typename Scalar = double>
LDABuilder& ldaplusplus::LDABuilder< Scalar >::set_supervised_m_step ( size_t  m_step_iterations = 10,
Scalar  m_step_tolerance = 1e-2,
Scalar  regularization_penalty = 1e-2 
)
inline

See the corresponding get_*_m_step() method.

template<typename Scalar >
LDABuilder< Scalar > & ldaplusplus::LDABuilder< Scalar >::set_workers ( size_t  workers)

Choose a number of parallel workers for the expectation step


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