ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
meta::stats::dirichlet< T > Class Template Reference

Represents a Dirichlet distribution. More...

#include <dirichlet.h>

Classes

union  parameters
 

Public Member Functions

 dirichlet (double alpha, uint64_t n)
 Constructs a symmetric Dirichlet with concentration parameter \(\alpha\) and dimension \(n\). More...
 
template<class Iter >
 dirichlet (Iter begin, Iter end)
 Constructs a Dirichlet from a sequence of parameters that make up the parameter vector \(\mathbf{\alpha}\). More...
 
 dirichlet (const dirichlet &other)
 Copy constructor.
 
 dirichlet (dirichlet &&other)
 Move constructor.
 
dirichletoperator= (dirichlet rhs)
 Assignment operator.
 
 ~dirichlet ()
 Destructor.
 
double pseudo_counts (const T &event) const
 Obtains the number of "pseudo-counts" associated with a given event when used as a prior for a multinomial distribution. More...
 
double pseudo_counts () const
 Obtains the number of total "pseudo-counts" associated with this distribution when used as a prior for a multinomial distribution.
 
void swap (dirichlet &other)
 Swaps this dirichlet with the parameter. More...
 

Private Types

enum  type { SYMMETRIC, ASYMMETRIC }
 

Private Attributes

enum meta::stats::dirichlet::type type_
 
union meta::stats::dirichlet::parameters params_
 
double alpha_sum_
 

Detailed Description

template<class T>
class meta::stats::dirichlet< T >

Represents a Dirichlet distribution.

Typically used as a prior for multinomials in the language modeling, topic modeling, classification, and sequence labeling components.

Constructor & Destructor Documentation

template<class T >
meta::stats::dirichlet< T >::dirichlet ( double  alpha,
uint64_t  n 
)

Constructs a symmetric Dirichlet with concentration parameter \(\alpha\) and dimension \(n\).

Parameters
alphaThe concentration parameter
nThe dimensionality of the Dirichlet
template<class T >
template<class Iter >
meta::stats::dirichlet< T >::dirichlet ( Iter  begin,
Iter  end 
)

Constructs a Dirichlet from a sequence of parameters that make up the parameter vector \(\mathbf{\alpha}\).

Each element is expected to be a std::pair<T, double>.

Parameters
beginAn iterator to the beginning of the sequence
endAn iterator to the ending of the sequence

Member Function Documentation

template<class T>
double meta::stats::dirichlet< T >::pseudo_counts ( const T &  event) const

Obtains the number of "pseudo-counts" associated with a given event when used as a prior for a multinomial distribution.

Parameters
eventThe event in question
Returns
the hyperparameter for the given event
template<class T >
void meta::stats::dirichlet< T >::swap ( dirichlet< T > &  other)

Swaps this dirichlet with the parameter.

Parameters
otherThe dirichlet to swap with

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