Class DefaultSampler

java.lang.Object
dk.alexandra.fresco.stat.DefaultSampler
All Implemented Interfaces:
Sampler

public class DefaultSampler
extends Object
implements Sampler
  • 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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sampleBernoulliDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleBernoulliDistribution​(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> p)
      Description copied from interface: Sampler
      Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1.
      Specified by:
      sampleBernoulliDistribution in interface Sampler
    • sampleBernoulliDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleBernoulliDistribution​(double p)
      Description copied from interface: Sampler
      Draw a sample from a Bernoulli distribution with parameter p with 0 ≤ p ≤ 1.
      Specified by:
      sampleBernoulliDistribution in interface Sampler
    • sampleCategoricalDistribution

      public 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)
      Description copied from interface: Sampler
      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.
      Specified by:
      sampleCategoricalDistribution in interface Sampler
    • sampleCategoricalDistribution

      public 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)
      Description copied from interface: Sampler
      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 to false.
      Specified by:
      sampleCategoricalDistribution in interface Sampler
    • sampleCategoricalDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleCategoricalDistribution​(double[] probabilities)
      Description copied from interface: Sampler
      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.
      Specified by:
      sampleCategoricalDistribution in interface Sampler
    • sampleExponentialDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleExponentialDistribution​(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> b)
      Description copied from interface: Sampler
      Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0.
      Specified by:
      sampleExponentialDistribution in interface Sampler
    • sampleExponentialDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleExponentialDistribution​(double b)
      Description copied from interface: Sampler
      Draw a sample from an exponential distribution with parameter λ = 1 / b with b gt; 0.
      Specified by:
      sampleExponentialDistribution in interface Sampler
    • sampleLaplaceDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleLaplaceDistribution​(double b)
      Description copied from interface: Sampler
      Draw a sample from a Laplace distribution with location 0 and scale b > 0.
      Specified by:
      sampleLaplaceDistribution in interface Sampler
    • sampleLaplaceDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleLaplaceDistribution​(dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> b)
      Description copied from interface: Sampler
      Draw a sample from a Laplace distribution with location 0 and scale b gt; 0.
      Specified by:
      sampleLaplaceDistribution in interface Sampler
    • sampleNormalDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleNormalDistribution()
      Description copied from interface: Sampler
      Draw a sample from a normal distribution with mean 0 and variance 1.
      Specified by:
      sampleNormalDistribution in interface Sampler
    • sampleRademacherDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.framework.value.SInt> sampleRademacherDistribution()
      Description copied from interface: Sampler
      Draw a sample from a Rademacher distribution.
      Specified by:
      sampleRademacherDistribution in interface Sampler
    • sampleUniformDistribution

      public dk.alexandra.fresco.framework.DRes<dk.alexandra.fresco.lib.fixed.SFixed> sampleUniformDistribution()
      Description copied from interface: Sampler
      Draw a sample form a uniform distribution on [0, 1).
      Specified by:
      sampleUniformDistribution in interface Sampler