Functions | |
template<class RngType > | |
bool | coinToss (RngType &rng, double pHeads=0.5) |
Flips a coin with probability of heads being pHeads by drawing random numbers from rng. More... | |
template<class RngType > | |
double | uni (RngType &rng, double lower=0.0, double upper=1.0) |
Draws a number uniformly in [lower,upper] by drawing random numbers from rng. More... | |
template<class RngType , class T > | |
T | discrete (RngType &rng, T low, T high) |
Draws a discrete number in {low,low+1,...,high} by drawing random numbers from rng. More... | |
template<class RngType > | |
double | gauss (RngType &rng, double mean=0.0, double variance=1.0) |
Draws a number from the normal distribution with given mean and variance by drawing random numbers from rng. More... | |
template<class RngType > | |
double | logNormal (RngType &rng, double m=0.0, double v=1.0) |
Draws a number from the log-normal distribution as exp(gauss(m,v)) More... | |
template<class RngType > | |
double | truncExp (RngType &rng, double lambda, double maximum, double Z=-1.0) |
draws a number from the truncated exponential distribution More... | |
Variables | |
SHARK_EXPORT_SYMBOL rng_type | globalRng |
bool shark::random::coinToss | ( | RngType & | rng, |
double | pHeads = 0.5 |
||
) |
Flips a coin with probability of heads being pHeads by drawing random numbers from rng.
Definition at line 48 of file Random.h.
Referenced by createProblem(), shark::CircleInSquare::draw(), shark::DropoutLayer< VectorType >::eval(), shark::IndicatorBasedRealCodedNSGAII< NSGA3Indicator >::generateOffspring(), main(), shark::PolynomialMutator::operator()(), shark::SimulatedBinaryCrossover< RealVector >::operator()(), shark::BitflipMutator::operator()(), shark::MultiNomialDistribution::operator()(), shark::BipolarLayer::sample(), and shark::BinaryLayer::sample().
T shark::random::discrete | ( | RngType & | rng, |
T | low, | ||
T | high | ||
) |
Draws a discrete number in {low,low+1,...,high} by drawing random numbers from rng.
Definition at line 62 of file Random.h.
Referenced by shark::bootstrap(), shark::createCVIID(), shark::IndicatorBasedSteadyStateMOCMA< Indicator >::doInit(), shark::IndicatorBasedMOCMA< Indicator >::doInit(), shark::SMSEMOA::doInit(), shark::IndicatorBasedRealCodedNSGAII< NSGA3Indicator >::doInit(), shark::PamiToy::draw(), shark::ImagePatches::draw(), shark::IndicatorBasedSteadyStateMOCMA< Indicator >::generateOffspring(), getSamples(), main(), shark::PartiallyMappedCrossover::operator()(), shark::OnePointCrossover::operator()(), shark::MultiNomialDistribution::operator()(), shark::MultiObjectiveBenchmark< Objectives >::proposeStartingPoint(), shark::shuffle(), shark::RFTrainer< unsigned int >::train(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), and shark::RFTrainer< RealVector >::train().
double shark::random::gauss | ( | RngType & | rng, |
double | mean = 0.0 , |
||
double | variance = 1.0 |
||
) |
Draws a number from the normal distribution with given mean and variance by drawing random numbers from rng.
Definition at line 69 of file Random.h.
References shark::mean(), and shark::variance().
Referenced by shark::Wave::draw(), shark::PamiToy::draw(), shark::MultiVariateNormalDistributionCholesky::generate(), shark::MultiObjectiveBenchmark< Objectives >::init(), shark::initRandomNormal(), logNormal(), main(), shark::MultiVariateNormalDistribution::operator()(), shark::Schwefel::proposeStartingPoint(), shark::Sphere::proposeStartingPoint(), shark::ConstrainedSphere::proposeStartingPoint(), shark::MultiObjectiveBenchmark< Objectives >::proposeStartingPoint(), and shark::GaussianLayer::sample().
double shark::random::logNormal | ( | RngType & | rng, |
double | m = 0.0 , |
||
double | v = 1.0 |
||
) |
double shark::random::truncExp | ( | RngType & | rng, |
double | lambda, | ||
double | maximum, | ||
double | Z = -1.0 |
||
) |
draws a number from the truncated exponential distribution
draws from the exponential distribution p(x|lambda)= 1/Z exp(-lambda*x) subject to x < maximum as optuonal third argument it is possible to return the precomputed value of Z.
Definition at line 85 of file Random.h.
Referenced by shark::TruncatedExponentialLayer::sample().
double shark::random::uni | ( | RngType & | rng, |
double | lower = 0.0 , |
||
double | upper = 1.0 |
||
) |
Draws a number uniformly in [lower,upper] by drawing random numbers from rng.
Definition at line 55 of file Random.h.
Referenced by shark::Chessboard::draw(), shark::Wave::draw(), shark::CircleInSquare::draw(), shark::DiagonalWithCircle::draw(), shark::BoxConstraintHandler< SearchPointType >::generateRandomPoint(), initializeFFNet(), shark::initRandomUniform(), main(), shark::RouletteWheelSelection::operator()(), shark::PolynomialMutator::operator()(), shark::SimulatedBinaryCrossover< RealVector >::operator()(), shark::DiffPowers::proposeStartingPoint(), shark::Himmelblau::proposeStartingPoint(), shark::Ackley::proposeStartingPoint(), shark::Cigar::proposeStartingPoint(), shark::Discus::proposeStartingPoint(), shark::Ellipsoid::proposeStartingPoint(), shark::CigarDiscus::proposeStartingPoint(), shark::Rosenbrock::proposeStartingPoint(), shark::CIGTAB2::proposeStartingPoint(), shark::ELLI1::proposeStartingPoint(), shark::ELLI2::proposeStartingPoint(), shark::CIGTAB1::proposeStartingPoint(), and truncExp().
SHARK_EXPORT_SYMBOL rng_type shark::random::globalRng |
Referenced by shark::bootstrap(), shark::createCVBatch(), shark::createCVIID(), createProblem(), shark::Chessboard::draw(), shark::Wave::draw(), shark::PamiToy::draw(), shark::CircleInSquare::draw(), shark::DiagonalWithCircle::draw(), shark::ImagePatches::draw(), getSamples(), initializeFFNet(), shark::initRandomNormal(), shark::initRandomUniform(), main(), shark::partial_shuffle(), shark::UnlabeledData< InputType >::shuffle(), shark::LabeledData< InputType, LabelType >::shuffle(), shark::LinearSAGTrainer< InputType, LabelType >::train(), shark::RFTrainer< unsigned int >::train(), shark::KernelBudgetedSGDTrainer< InputType, CacheType >::train(), shark::RFTrainer< RealVector >::train(), and trainRBM().