AIToolbox
A library that offers tools for AI problem solving.
Probability.hpp File Reference
#include <random>
#include <algorithm>
#include <AIToolbox/Types.hpp>
#include <AIToolbox/Utils/Core.hpp>

Go to the source code of this file.

Classes

class  AIToolbox::VoseAliasSampler
 This class represents the Alias sampling method. More...
 

Namespaces

 AIToolbox
 

Functions

static std::uniform_real_distribution< double > AIToolbox::probabilityDistribution (0.0, 1.0)
 
template<typename T >
bool AIToolbox::isProbability (const size_t size, const T &in)
 This function checks whether the supplied 1D container is a valid discrete distribution. More...
 
template<typename T >
bool AIToolbox::isProbability (const size_t rows, const size_t cols, const T &in)
 This function checks whether the rows of the input 2D container contain valid discrete distributions. More...
 
template<typename T >
bool AIToolbox::isProbability (const size_t depth, const size_t rows, const size_t cols, const T &in)
 This function checks whether the rows of the input 3D container contain valid discrete distributions. More...
 
bool AIToolbox::isProbability (const Matrix2D &in)
 This function checks whether the rows of the input matrix contain valid discrete distributions. More...
 
bool AIToolbox::isProbability (const Matrix3D &in)
 This function checks whether the rows of the input matrix contain valid discrete distributions. More...
 
bool AIToolbox::isProbability (const SparseMatrix2D &in)
 This function checks whether the rows of the input matrix contain valid discrete distributions. More...
 
bool AIToolbox::isProbability (const SparseMatrix3D &in)
 This function checks whether the rows of the input matrix contain valid discrete distributions. More...
 
template<typename T , typename G >
size_t AIToolbox::sampleProbability (const size_t d, const T &in, G &generator)
 This function samples an index from a probability vector. More...
 
template<typename G >
size_t AIToolbox::sampleProbability (const size_t d, const SparseMatrix2D::ConstRowXpr &in, G &generator)
 This function samples an index from a sparse probability vector. More...
 
template<typename G >
double AIToolbox::sampleBetaDistribution (double a, double b, G &generator)
 This function samples from a Beta distribution. More...
 
template<typename TIn , typename G >
ProbabilityVector AIToolbox::sampleDirichletDistribution (const TIn &params, G &generator)
 This function samples from the input Dirichlet distribution. More...
 
template<typename TIn , typename TOut , typename G >
void AIToolbox::sampleDirichletDistribution (const TIn &params, G &generator, TOut &&out)
 This function samples from the input Dirichlet distribution inline. More...
 
template<typename G >
ProbabilityVector AIToolbox::makeRandomProbability (const size_t S, G &generator)
 This function generates a random probability vector. More...
 
bool AIToolbox::checkEqualProbability (const ProbabilityVector &lhs, const ProbabilityVector &rhs)
 This function checks whether two input ProbabilityVector are equal. More...
 
double AIToolbox::getEntropy (const ProbabilityVector &v)
 This function returns the entropy of the input ProbabilityVector. More...
 
double AIToolbox::getEntropyBase2 (const ProbabilityVector &v)
 This function returns the entropy of the input ProbabilityVector computed using log2. More...
 
ProbabilityVector AIToolbox::projectToProbability (const Vector &v)
 This function projects the input vector to a valid probability space. More...