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 dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt>sampleBernoulliDistribution(double p)Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt>sampleBernoulliDistribution(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> p)Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt>sampleCategoricalDistribution(double[] probabilities)Draw a sample from the set {0, ..., probabilities.length - 1} with probabilities[i] indicating the probability of drawing i.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt>sampleCategoricalDistribution(List<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> probabilities)Draw a sample from the set {0, ..., probabilities.size() - 1} with probabilities.get(i) indicating the probability of drawing i.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt>sampleCategoricalDistribution(List<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> probabilities, boolean normalized)Draw a sample from the set {0, ..., probabilities.size() - 1} with probabilities.get(i) indicating the probability of drawing i.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>sampleExponentialDistribution(double b)Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>sampleExponentialDistribution(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> b)Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>sampleLaplaceDistribution(double b)Draw a sample from a Laplace distribution with location 0 and scale b > 0.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>sampleLaplaceDistribution(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> b)Draw a sample from a Laplace distribution with location 0 and scale b gt; 0.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>sampleNormalDistribution()Draw a sample from a normal distribution with mean 0 and variance 1.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt>sampleRademacherDistribution()Draw a sample from a Rademacher distribution.dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>sampleUniformDistribution()Draw a sample form a uniform distribution on [0, 1).static Samplerusing(dk.alexandra.fresco.framework.builder.numeric.ProtocolBuilderNumeric builder)
-
Method Details
-
using
-
sampleBernoulliDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleBernoulliDistribution(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> p)Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1. -
sampleBernoulliDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleBernoulliDistribution(double p)Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1. -
sampleCategoricalDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleCategoricalDistribution(List<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> probabilities)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
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.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
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleCategoricalDistribution(List<dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed>> probabilities, boolean normalized)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
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleExponentialDistribution(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> b)Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0. -
sampleExponentialDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleExponentialDistribution(double b)Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0. -
sampleLaplaceDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleLaplaceDistribution(double b)Draw a sample from a Laplace distribution with location 0 and scale b > 0. -
sampleLaplaceDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleLaplaceDistribution(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> b)Draw a sample from a Laplace distribution with location 0 and scale b gt; 0. -
sampleNormalDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleNormalDistribution()Draw a sample from a normal distribution with mean 0 and variance 1. -
sampleRademacherDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleRademacherDistribution()Draw a sample from a Rademacher distribution. -
sampleUniformDistribution
dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleUniformDistribution()Draw a sample form a uniform distribution on [0, 1).
-