jsat.distributions.multivariate
Class SymmetricDirichlet
- java.lang.Object
-
- jsat.distributions.multivariate.MultivariateDistributionSkeleton
-
- jsat.distributions.multivariate.SymmetricDirichlet
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, MultivariateDistribution
public class SymmetricDirichlet extends MultivariateDistributionSkeleton
The Symmetric Dirichlet Distribution is a special case of theDirichletdistribution, and occurs when all alphas have the same value.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SymmetricDirichlet(double alpha, int dim)Creates a new Symmetric Dirichlet distribution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SymmetricDirichletclone()doublegetAlpha()Returns the alpha value used by this distributionintgetDimension()Returns the dimension size of the current distributiondoublelogPdf(Vec x)Computes the log of the probability density function.doublepdf(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.voidsetAlpha(double alpha)Sets the alpha value used for the distributionvoidsetDimension(int dim)Sets the dimension size of the distribution<V extends Vec>
booleansetUsingData(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
-
Methods inherited from interface jsat.distributions.multivariate.MultivariateDistribution
logPdf, pdf, setUsingData, setUsingData, setUsingData, setUsingDataList
-
-
-
-
Constructor Detail
-
SymmetricDirichlet
public SymmetricDirichlet(double alpha, int dim)Creates a new Symmetric Dirichlet distribution.- Parameters:
alpha- the positive alpha value for the distributiondim- the dimension of the distribution.- Throws:
java.lang.ArithmeticException- if a non positive alpha or dimension value is given
-
-
Method Detail
-
setDimension
public void setDimension(int dim)
Sets the dimension size of the distribution- Parameters:
dim- the new dimension size
-
getDimension
public int getDimension()
Returns the dimension size of the current distribution- Returns:
- the number of dimensions in this distribution
-
setAlpha
public void setAlpha(double alpha) throws java.lang.ArithmeticExceptionSets the alpha value used for the distribution- Parameters:
alpha- the positive value for the distribution- Throws:
java.lang.ArithmeticException- if the value given is not a positive value
-
getAlpha
public double getAlpha()
Returns the alpha value used by this distribution- Returns:
- the alpha value used by this distribution
-
clone
public SymmetricDirichlet clone()
- Specified by:
clonein interfaceMultivariateDistribution- Specified by:
clonein classMultivariateDistributionSkeleton
-
logPdf
public double logPdf(Vec x)
Description copied from interface:MultivariateDistributionComputes the log of the probability density function. If the probability of the input is zero, the log of zero would beDouble.NEGATIVE_INFINITY. Instead, -Double.MAX_VALUEis returned.- Specified by:
logPdfin interfaceMultivariateDistribution- Overrides:
logPdfin classMultivariateDistributionSkeleton- 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:MultivariateDistributionReturns 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:MultivariateDistributionSets 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 pointsparallel-trueif the training should be done using multiple-cores,falsefor 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:MultivariateDistributionPerforms sampling on the current distribution.- Parameters:
count- the number of iid samples to drawrand- the source of randomness- Returns:
- a list of sample vectors from this distribution
-
-
DataMelt 3.0 © DataMelt by jWork.ORG