ModErn Text Analysis META Enumerates Textual Applications
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...

class  running_stats
Online computation for mean and standard deviation using Welford's method as presented by Knuth. 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.

## § expected_value()

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
 dist The distribution the expectation should be calculated against fun The function to compute the expectation of
Returns
the expected value of the function under the given distribution

## § entropy()

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
 dist The distribution to compute the entropy over
Returns
the entropy of the supplied distribution