ModErn Text Analysis
META Enumerates Textual Applications
Classes | Functions
meta::stats Namespace Reference

Probability distributions and other statistics functions. More...

Classes

class  dirichlet
 Represents a Dirichlet distribution. More...
 
class  multinomial
 Represents a multinomial/categorical distribution. More...
 

Functions

template<class T >
multinomial< T > operator+ (const multinomial< T > &lhs, const multinomial< T > &rhs)
 
template<class T >
multinomial< T > operator+ (multinomial< T > &&lhs, const multinomial< T > &rhs)
 
template<class T >
multinomial< T > operator+ (const multinomial< T > &lhs, multinomial< T > &&rhs)
 
template<class T >
multinomial< T > operator+ (multinomial< T > &&lhs, multinomial< T > &&rhs)
 
template<class Dist , class Fun >
double expected_value (Dist &&dist, Fun &&fun)
 Computation for \(E_d[f(x)]\) where \(d\) is specified by the dist parameter and \(f(x)\) is the fun parameter. More...
 
template<class Dist >
double entropy (Dist &&dist)
 Computes the entropy \(H(X) = - \sum_{x \in X} p(x) \log_2 p(x)\). More...
 

Detailed Description

Probability distributions and other statistics functions.

Function Documentation

template<class Dist , class Fun >
double meta::stats::expected_value ( Dist &&  dist,
Fun &&  fun 
)

Computation for \(E_d[f(x)]\) where \(d\) is specified by the dist parameter and \(f(x)\) is the fun parameter.

dist must be a distribution over input type accepted by f.

Parameters
distThe distribution the expectation should be calculated against
funThe function to compute the expectation of
Returns
the expected value of the function under the given distribution
template<class Dist >
double meta::stats::entropy ( Dist &&  dist)

Computes the entropy \(H(X) = - \sum_{x \in X} p(x) \log_2 p(x)\).

Parameters
distThe distribution to compute the entropy over
Returns
the entropy of the supplied distribution