Class GuideTableDiscreteSampler

    • Method Detail

      • of

        public static SharedStateDiscreteSampler of​(UniformRandomProvider rng,
                                                    double[] probabilities)
        Create a new sampler for an enumerated distribution using the given probabilities. The samples corresponding to each probability are assumed to be a natural sequence starting at zero.

        The size of the guide table is probabilities.length.

        Parameters:
        rng - Generator of uniformly distributed random numbers.
        probabilities - The probabilities.
        Returns:
        the sampler
        Throws:
        IllegalArgumentException - if probabilities is null or empty, a probability is negative, infinite or NaN, or the sum of all probabilities is not strictly positive.
      • of

        public static SharedStateDiscreteSampler of​(UniformRandomProvider rng,
                                                    double[] probabilities,
                                                    double alpha)
        Create a new sampler for an enumerated distribution using the given probabilities. The samples corresponding to each probability are assumed to be a natural sequence starting at zero.

        The size of the guide table is alpha * probabilities.length.

        Parameters:
        rng - Generator of uniformly distributed random numbers.
        probabilities - The probabilities.
        alpha - The alpha factor used to set the guide table size.
        Returns:
        the sampler
        Throws:
        IllegalArgumentException - if probabilities is null or empty, a probability is negative, infinite or NaN, the sum of all probabilities is not strictly positive, or alpha is not strictly positive.