public class Dirichlet extends MultivariateDistributionSkeleton
PDF
only when the input
vector sums to 1.0, and contains no negative or zero values.Constructor and Description |
---|
Dirichlet(Vec alphas)
Creates a new Dirichlet distribution.
|
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.
|
List<Vec> |
sample(int count,
Random rand)
Performs sampling on the current distribution.
|
void |
setAlphas(Vec alphas)
Sets the alphas of the distribution.
|
<V extends Vec> |
setUsingData(List<V> dataSet)
Sets the parameters of the distribution to attempt to fit the given list of vectors.
|
boolean |
setUsingDataList(List<DataPoint> dataPoint)
Sets the parameters of the distribution to attempt to fit the given list of data points.
|
logPdf, pdf, setUsingData, setUsingData, setUsingData, setUsingDataList
public Dirichlet(Vec alphas)
alphas
- the positive alpha values for the distribution. The length of the vector indicates the dimensionArithmeticException
- if any of the alpha values are not positivepublic void setAlphas(Vec alphas) throws ArithmeticException
alphas
- the parameter valuesArithmeticException
- if any of the alphas are not positive numberspublic Vec getAlphas()
public Dirichlet clone()
clone
in interface MultivariateDistribution
clone
in class MultivariateDistributionSkeleton
public double logPdf(Vec x)
MultivariateDistribution
Double.NEGATIVE_INFINITY
. Instead, -Double.MAX_VALUE
is returned.logPdf
in interface MultivariateDistribution
logPdf
in class MultivariateDistributionSkeleton
x
- the vector the get the log probability ofpublic double pdf(Vec x)
MultivariateDistribution
x
- the vector the get the log probability ofpublic <V extends Vec> boolean setUsingData(List<V> dataSet)
MultivariateDistribution
V
- the vector typedataSet
- the list of data pointspublic boolean setUsingDataList(List<DataPoint> dataPoint)
MultivariateDistribution
weights
of the data points will be used.dataPoint
- the list of data points to usepublic List<Vec> sample(int count, Random rand)
MultivariateDistribution
count
- the number of iid samples to drawrand
- the source of randomnessCopyright © 2017. All rights reserved.