Package dk.alexandra.fresco.stat
Interface Sampler
- All Known Implementing Classes:
DefaultSampler
public interface Sampler
This computation library contains functions which samples random values from various distributions.
-
Method Summary
Modifier and Type Method Description DRes<SInt>
sampleBernoulliDistribution(double p)
Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1.DRes<SInt>
sampleBernoulliDistribution(DRes<SFixed> p)
Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1.DRes<SInt>
sampleCategoricalDistribution(double[] probabilities)
Draw a sample from the set {0, ..., probabilities.length - 1} with probabilities[i] indicating the probability of drawing i.DRes<SInt>
sampleCategoricalDistribution(List<DRes<SFixed>> probabilities)
Draw a sample from the set {0, ..., probabilities.size() - 1} with probabilities.get(i) indicating the probability of drawing i.DRes<SInt>
sampleCategoricalDistribution(List<DRes<SFixed>> probabilities, boolean normalized)
Draw a sample from the set {0, ..., probabilities.size() - 1} with probabilities.get(i) indicating the probability of drawing i.DRes<SFixed>
sampleExponentialDistribution(double b)
Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0.DRes<SFixed>
sampleExponentialDistribution(DRes<SFixed> b)
Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0.DRes<SFixed>
sampleLaplaceDistribution(double b)
Draw a sample from a Laplace distribution with location 0 and scale b > 0.DRes<SFixed>
sampleLaplaceDistribution(DRes<SFixed> b)
Draw a sample from a Laplace distribution with location 0 and scale b gt; 0.DRes<SFixed>
sampleNormalDistribution()
Draw a sample from a normal distribution with mean 0 and variance 1.DRes<SInt>
sampleRademacherDistribution()
Draw a sample from a Rademacher distribution.DRes<SFixed>
sampleUniformDistribution()
Draw a sample form a uniform distribution on [0, 1).static Sampler
using(ProtocolBuilderNumeric builder)
-
Method Details
-
using
-
sampleBernoulliDistribution
DRes<SInt> sampleBernoulliDistribution(DRes<SFixed> p)Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1. -
sampleBernoulliDistribution
DRes<SInt> sampleBernoulliDistribution(double p)Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1. -
sampleCategoricalDistribution
Draw a sample from the set {0, ..., probabilities.size() - 1} with probabilities.get(i) indicating the probability of drawing i. Note that the sum of probabilities should be equal to 1. -
sampleCategoricalDistribution
DRes<SInt> sampleCategoricalDistribution(double[] probabilities)Draw a sample from the set {0, ..., probabilities.length - 1} with probabilities[i] indicating the probability of drawing i. Note that the sum of probabilities should be equal to 1. -
sampleCategoricalDistribution
Draw a sample from the set {0, ..., probabilities.size() - 1} with probabilities.get(i) indicating the probability of drawing i. If it is not known whether the sum of the probabilities is equal to 1, the normalized parameter should be set tofalse
. -
sampleExponentialDistribution
DRes<SFixed> sampleExponentialDistribution(DRes<SFixed> b)Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0. -
sampleExponentialDistribution
DRes<SFixed> sampleExponentialDistribution(double b)Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0. -
sampleLaplaceDistribution
DRes<SFixed> sampleLaplaceDistribution(double b)Draw a sample from a Laplace distribution with location 0 and scale b > 0. -
sampleLaplaceDistribution
DRes<SFixed> sampleLaplaceDistribution(DRes<SFixed> b)Draw a sample from a Laplace distribution with location 0 and scale b gt; 0. -
sampleNormalDistribution
DRes<SFixed> sampleNormalDistribution()Draw a sample from a normal distribution with mean 0 and variance 1. -
sampleRademacherDistribution
DRes<SInt> sampleRademacherDistribution()Draw a sample from a Rademacher distribution. -
sampleUniformDistribution
DRes<SFixed> sampleUniformDistribution()Draw a sample form a uniform distribution on [0, 1).
-