Documentation of 'jsat.distributions.multivariate.Dirichlet' Java class
Dirichlet
jsat.distributions.multivariate

Class Dirichlet

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, MultivariateDistribution


    public class Dirichlet
    extends MultivariateDistributionSkeleton
    An implementation of the Dirichlet distribution. The Dirichlet distribution takes a vector of positive alphas as its argument, which also specifies the dimension of the distribution. The Dirichlet distribution has a non zero PDF only when the input vector sums to 1.0, and contains no negative or zero values.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      Dirichlet(Vec alphas)
      Creates a new Dirichlet distribution.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Dirichlet clone() 
      Vec getAlphas()
      Returns the backing vector that contains the alphas specifying the current distribution.
      double logPdf(Vec x)
      Computes the log of the probability density function.
      double pdf(Vec x)
      Returns the probability of a given vector from this distribution.
      java.util.List<Vec> sample(int count, java.util.Random rand)
      Performs sampling on the current distribution.
      void setAlphas(Vec alphas)
      Sets the alphas of the distribution.
      <V extends Vec>
      boolean
      setUsingData(java.util.List<V> dataSet, boolean parallel)
      Sets the parameters of the distribution to attempt to fit the given list of vectors.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Dirichlet

        public Dirichlet(Vec alphas)
        Creates a new Dirichlet distribution.
        Parameters:
        alphas - the positive alpha values for the distribution. The length of the vector indicates the dimension
        Throws:
        java.lang.ArithmeticException - if any of the alpha values are not positive
    • Method Detail

      • setAlphas

        public void setAlphas(Vec alphas)
                       throws java.lang.ArithmeticException
        Sets the alphas of the distribution. A copy is made, so altering the input does not effect the distribution.
        Parameters:
        alphas - the parameter values
        Throws:
        java.lang.ArithmeticException - if any of the alphas are not positive numbers
      • getAlphas

        public Vec getAlphas()
        Returns the backing vector that contains the alphas specifying the current distribution. Mutable operations should not be applied.
        Returns:
        the alphas that make the current distribution.
      • logPdf

        public double logPdf(Vec x)
        Description copied from interface: MultivariateDistribution
        Computes the log of the probability density function. If the probability of the input is zero, the log of zero would be Double.NEGATIVE_INFINITY. Instead, -Double.MAX_VALUE is returned.
        Specified by:
        logPdf in interface MultivariateDistribution
        Overrides:
        logPdf in class MultivariateDistributionSkeleton
        Parameters:
        x - the vector the get the log probability of
        Returns:
        the log of the probability.
      • pdf

        public double pdf(Vec x)
        Description copied from interface: MultivariateDistribution
        Returns the probability of a given vector from this distribution. By definition, the probability will always be in the range [0, 1].
        Parameters:
        x - the vector the get the log probability of
        Returns:
        the probability
      • setUsingData

        public <V extends Vec> boolean setUsingData(java.util.List<V> dataSet,
                                                    boolean parallel)
        Description copied from interface: MultivariateDistribution
        Sets the parameters of the distribution to attempt to fit the given list of vectors. All vectors are assumed to have the same weight.
        Type Parameters:
        V - the vector type
        Parameters:
        dataSet - the list of data points
        parallel - true if the training should be done using multiple-cores, false for single threaded.
        Returns:
        true if the distribution was fit to the data, or false if the distribution could not be fit to the data set.
      • sample

        public java.util.List<Vec> sample(int count,
                                          java.util.Random rand)
        Description copied from interface: MultivariateDistribution
        Performs sampling on the current distribution.
        Parameters:
        count - the number of iid samples to draw
        rand - the source of randomness
        Returns:
        a list of sample vectors from this distribution

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.