bnmf-algs
Public Member Functions | List of all members
bnmf_algs::details::CollapsedGibbsComputer< T, Scalar > Class Template Reference

Computer type that will compute the next collapsed gibbs sample when its operator() is invoked. More...

#include <collapsed_gibbs.hpp>

Public Member Functions

 CollapsedGibbsComputer (const matrix_t< T > &X, size_t z, const alloc_model::Params< Scalar > &model_params, size_t max_iter, double eps)
 Construct a new CollapsedGibbsComputer. More...
 
void operator() (size_t curr_step, tensor_t< T, 3 > &S_prev)
 Function call operator that will compute the next tensor sample from the previous sample. More...
 

Detailed Description

template<typename T, typename Scalar>
class bnmf_algs::details::CollapsedGibbsComputer< T, Scalar >

Computer type that will compute the next collapsed gibbs sample when its operator() is invoked.

CollapsedGibbsComputer will compute a new bnmf_algs::tensord<3> object from the previous sample when its operator() is invoked.

Template Parameters
TType of the matrix/tensor entries.
ScalarType of the scalars used as model parameters.

Constructor & Destructor Documentation

template<typename T , typename Scalar >
bnmf_algs::details::CollapsedGibbsComputer< T, Scalar >::CollapsedGibbsComputer ( const matrix_t< T > &  X,
size_t  z,
const alloc_model::Params< Scalar > &  model_params,
size_t  max_iter,
double  eps 
)
inlineexplicit

Construct a new CollapsedGibbsComputer.

Parameters
XMatrix \(X\) of size \(x \times y\) that will be used during sampling.
zDepth of the output tensor \(S\) with size \(x \times y \times z\).
model_paramsAllocation model parameters. See bnmf_algs::alloc_model::Params<double>.
max_iterMaximum number of iterations.
epsFloating point epsilon value to be used to prevent division by 0 errors.

Member Function Documentation

template<typename T , typename Scalar >
void bnmf_algs::details::CollapsedGibbsComputer< T, Scalar >::operator() ( size_t  curr_step,
tensor_t< T, 3 > &  S_prev 
)
inline

Function call operator that will compute the next tensor sample from the previous sample.

After this function exits, the object referenced by S_prev will be modified to store the next sample.

Note that CollapsedGibbsComputer object satisfies the bnmf_algs::util::Generator and bnmf_algs::util::ComputationIterator Computer interface. Hence, a sequence of samples may be generated efficiently by using this Computer with bnmf_algs::util::Generator or bnmf_algs::util::ComputationIterator.

Parameters
curr_stepCurrent step of collapsed gibbs computation.
S_prevPreviously computed sample to modify in-place.

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