LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::beta_distribution< RealType > Class Template Reference

#include <beta.hpp>

Collaboration diagram for lbann::beta_distribution< RealType >:
[legend]

Classes

class  param_type
 

Public Types

using result_type = RealType
 

Public Member Functions

 beta_distribution (RealType a, RealType b)
 
 beta_distribution (const param_type &p)
 
result_type a () const
 
result_type b () const
 
void reset ()
 
param_type param () const
 
void param (const param_type &p)
 
template<typename Generator >
result_type operator() (Generator &g)
 
template<typename Generator >
result_type operator() (Generator &g, const param_type &p)
 
result_type min () const
 
result_type max () const
 
bool operator== (const beta_distribution< result_type > &other) const
 
bool operator!= (const beta_distribution< result_type > &other) const
 

Private Types

using gamma_dist = std::gamma_distribution< RealType >
 

Private Member Functions

template<typename Generator >
result_type generate (Generator &g)
 
template<typename Generator >
result_type generate (Generator &g, const param_type &p)
 
template<typename Generator >
result_type generate_johnk (Generator &g, result_type a, result_type b)
 
template<typename Generator >
result_type generate_gamma (Generator &g, gamma_dist &gamma_a, gamma_dist &gamma_b)
 

Private Attributes

param_type m_params
 
gamma_dist m_gamma_a
 
gamma_dist m_gamma_b
 

Detailed Description

template<typename RealType = double>
class lbann::beta_distribution< RealType >

Produces random floating point values drawn from a Beta distribution with parameters a > 0 and b > 0.

See:

https://en.wikipedia.org/wiki/Beta_distribution

for more details.

Definition at line 51 of file beta.hpp.

Member Typedef Documentation

◆ gamma_dist

template<typename RealType = double>
using lbann::beta_distribution< RealType >::gamma_dist = std::gamma_distribution<RealType>
private

Definition at line 131 of file beta.hpp.

◆ result_type

template<typename RealType = double>
using lbann::beta_distribution< RealType >::result_type = RealType

Definition at line 54 of file beta.hpp.

Constructor & Destructor Documentation

◆ beta_distribution() [1/2]

template<typename RealType = double>
lbann::beta_distribution< RealType >::beta_distribution ( RealType  a,
RealType  b 
)
inlineexplicit

Definition at line 85 of file beta.hpp.

◆ beta_distribution() [2/2]

template<typename RealType = double>
lbann::beta_distribution< RealType >::beta_distribution ( const param_type p)
inlineexplicit

Definition at line 88 of file beta.hpp.

Member Function Documentation

◆ a()

template<typename RealType = double>
result_type lbann::beta_distribution< RealType >::a ( ) const
inline

Definition at line 92 of file beta.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ b()

template<typename RealType = double>
result_type lbann::beta_distribution< RealType >::b ( ) const
inline

Definition at line 93 of file beta.hpp.

Here is the call graph for this function:

◆ generate() [1/2]

template<typename RealType = double>
template<typename Generator >
result_type lbann::beta_distribution< RealType >::generate ( Generator &  g)
inlineprivate

Definition at line 136 of file beta.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate() [2/2]

template<typename RealType = double>
template<typename Generator >
result_type lbann::beta_distribution< RealType >::generate ( Generator &  g,
const param_type p 
)
inlineprivate

Definition at line 147 of file beta.hpp.

Here is the call graph for this function:

◆ generate_gamma()

template<typename RealType = double>
template<typename Generator >
result_type lbann::beta_distribution< RealType >::generate_gamma ( Generator &  g,
gamma_dist gamma_a,
gamma_dist gamma_b 
)
inlineprivate

Generate Beta-distributed values based on Gamma distributions. See: https://en.wikipedia.org/wiki/Beta_distribution#Generating_beta-distributed_random_variates for details.

Definition at line 219 of file beta.hpp.

Here is the caller graph for this function:

◆ generate_johnk()

template<typename RealType = double>
template<typename Generator >
result_type lbann::beta_distribution< RealType >::generate_johnk ( Generator &  g,
result_type  a,
result_type  b 
)
inlineprivate

Generate Beta-distributed values using Johnk's algorithm. This is a rejection-sampling algorithm that only needs a few uniformly random values.

See:

Johnk, H. D. "Erzeugung von betaverteilten und gammaverteilten
Zufallszahlen." Metrika 8, no. 1 (1964).

For an English-language presentation, see:

Atkinson, A. C. and M. C. Pearce. "The computer generation of beta,
gamma and normal random variables." Journal of the Royal Statistical
Society: Series A (General) 139, no. 4 (1976).

This includes fixes for numerical stability when the parameters are small, see:

https://github.com/numpy/numpy/issues/5851

for discussion there; and a catch for the (extremely rare) case of the RNG giving us U and V both exactly 0.

Note: There should be an umlaut on the "o" in "Johnk", but blame poor unicode support.

Definition at line 186 of file beta.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max()

template<typename RealType = double>
result_type lbann::beta_distribution< RealType >::max ( ) const
inline

Definition at line 117 of file beta.hpp.

◆ min()

template<typename RealType = double>
result_type lbann::beta_distribution< RealType >::min ( ) const
inline

Definition at line 116 of file beta.hpp.

◆ operator!=()

template<typename RealType = double>
bool lbann::beta_distribution< RealType >::operator!= ( const beta_distribution< result_type > &  other) const
inline

Definition at line 123 of file beta.hpp.

Here is the call graph for this function:

◆ operator()() [1/2]

template<typename RealType = double>
template<typename Generator >
result_type lbann::beta_distribution< RealType >::operator() ( Generator &  g)
inline

Definition at line 106 of file beta.hpp.

Here is the call graph for this function:

◆ operator()() [2/2]

template<typename RealType = double>
template<typename Generator >
result_type lbann::beta_distribution< RealType >::operator() ( Generator &  g,
const param_type p 
)
inline

Definition at line 111 of file beta.hpp.

Here is the call graph for this function:

◆ operator==()

template<typename RealType = double>
bool lbann::beta_distribution< RealType >::operator== ( const beta_distribution< result_type > &  other) const
inline

Definition at line 119 of file beta.hpp.

Here is the call graph for this function:

◆ param() [1/2]

template<typename RealType = double>
param_type lbann::beta_distribution< RealType >::param ( ) const
inline

Definition at line 97 of file beta.hpp.

Here is the caller graph for this function:

◆ param() [2/2]

template<typename RealType = double>
void lbann::beta_distribution< RealType >::param ( const param_type p)
inline

Definition at line 98 of file beta.hpp.

Here is the call graph for this function:

◆ reset()

template<typename RealType = double>
void lbann::beta_distribution< RealType >::reset ( )
inline

Definition at line 95 of file beta.hpp.

Member Data Documentation

◆ m_gamma_a

template<typename RealType = double>
gamma_dist lbann::beta_distribution< RealType >::m_gamma_a
private

Definition at line 132 of file beta.hpp.

◆ m_gamma_b

template<typename RealType = double>
gamma_dist lbann::beta_distribution< RealType >::m_gamma_b
private

Definition at line 132 of file beta.hpp.

◆ m_params

template<typename RealType = double>
param_type lbann::beta_distribution< RealType >::m_params
private

Definition at line 129 of file beta.hpp.


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