@PublicationReference(author="Stanley Sawyer", title="Wishart Distributions and Inverse-Wishart Sampling", type=Misc, year=2007, url="http://www.math.wustl.edu/~sawyer/hmhandouts/Wishart.pdf") public class NormalInverseWishartDistribution extends AbstractDistribution<Matrix> implements ClosedFormComputableDistribution<Matrix>
Modifier and Type | Class and Description |
---|---|
static class |
NormalInverseWishartDistribution.PDF
PDF of the normal inverse-Wishart distribution.
|
Modifier and Type | Field and Description |
---|---|
protected double |
covarianceDivisor
Term that divides the covariance sampled from the inverseWishart,
must be greater than zero.
|
static double |
DEFAULT_COVARIANCE_DIVISOR
Default covariance divisor, 1.0.
|
static int |
DEFAULT_DIMENSIONALITY
Default dimensionality of the precision matrix, 2.
|
protected MultivariateGaussian |
gaussian
Generates the mean, given the covariance from the inverseWishart.
|
protected InverseWishartDistribution |
inverseWishart
Generates the covariance for the Gaussian.
|
Constructor and Description |
---|
NormalInverseWishartDistribution()
Default constructor
|
NormalInverseWishartDistribution(int dimensionality)
Creates a new instance of NormalInverseWishartDistribution
|
NormalInverseWishartDistribution(int dimensionality,
double covarianceDivisor)
Creates a new instance of NormalInverseWishartDistribution
|
NormalInverseWishartDistribution(MultivariateGaussian gaussian,
InverseWishartDistribution inverseWishart,
double covarianceDivisor)
Creates a new instance of NormalInverseWishartDistribution
|
NormalInverseWishartDistribution(NormalInverseWishartDistribution other)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
NormalInverseWishartDistribution |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters.
|
Vector |
convertToVector()
Converts the object to a vector.
|
double |
getCovarianceDivisor()
Getter for covarianceDivisor
|
MultivariateGaussian |
getGaussian()
Getter for gaussian.
|
int |
getInputDimensionality()
Gets the input dimensionality of the Gaussian and the inverse-Wishart
distributions
|
InverseWishartDistribution |
getInverseWishart()
Getter for inverseWishart
|
Matrix |
getMean()
Gets the arithmetic mean, or "first central moment" or "expectation",
of the distribution.
|
NormalInverseWishartDistribution.PDF |
getProbabilityFunction()
Gets the distribution function associated with this Distribution,
either the PDF or PMF.
|
void |
sampleInto(java.util.Random random,
int sampleCount,
java.util.Collection<? super Matrix> output)
Draws multiple random samples from the distribution and puts the result
into the given collection.
|
void |
setCovarianceDivisor(double covarianceDivisor)
Setter for covarianceDivisor
|
void |
setGaussian(MultivariateGaussian gaussian)
Setter for gaussian
|
void |
setInverseWishart(InverseWishartDistribution inverseWishart)
Setter for inverseWishart
|
sample, sample
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sample, sample
public static final int DEFAULT_DIMENSIONALITY
public static final double DEFAULT_COVARIANCE_DIVISOR
protected double covarianceDivisor
protected MultivariateGaussian gaussian
protected InverseWishartDistribution inverseWishart
public NormalInverseWishartDistribution()
public NormalInverseWishartDistribution(int dimensionality)
dimensionality
- Dimensionality of the distributionspublic NormalInverseWishartDistribution(int dimensionality, double covarianceDivisor)
dimensionality
- Dimensionality of the distributionscovarianceDivisor
- Term that divides the covariance sampled from the inverseWishart,
must be greater than zero.public NormalInverseWishartDistribution(MultivariateGaussian gaussian, InverseWishartDistribution inverseWishart, double covarianceDivisor)
gaussian
- Generates the mean, given the covariance from the inverseWishart.inverseWishart
- Generates the covariance for the Gaussian.covarianceDivisor
- Term that divides the covariance sampled from the inverseWishart,
must be greater than zero.public NormalInverseWishartDistribution(NormalInverseWishartDistribution other)
other
- NormalInverseWishartDistribution to copypublic NormalInverseWishartDistribution clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface Vectorizable
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public MultivariateGaussian getGaussian()
public void setGaussian(MultivariateGaussian gaussian)
gaussian
- Generates the mean, given the covariance from the inverseWishart.public InverseWishartDistribution getInverseWishart()
public void setInverseWishart(InverseWishartDistribution inverseWishart)
inverseWishart
- Generates the covariance for the Gaussian.public double getCovarianceDivisor()
public void setCovarianceDivisor(double covarianceDivisor)
covarianceDivisor
- Term that divides the covariance sampled from the inverseWishart,
must be greater than zero.public Matrix getMean()
DistributionWithMean
getMean
in interface DistributionWithMean<Matrix>
public void sampleInto(java.util.Random random, int sampleCount, java.util.Collection<? super Matrix> output)
Distribution
sampleInto
in interface Distribution<Matrix>
random
- Random number generator to use.sampleCount
- The number of samples to draw. Cannot be negative.output
- The collection to add the samples into.public Vector convertToVector()
Vectorizable
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
Vectorizable
convertFromVector
in interface Vectorizable
parameters
- The parameters to incorporate.public int getInputDimensionality()
public NormalInverseWishartDistribution.PDF getProbabilityFunction()
ComputableDistribution
getProbabilityFunction
in interface ComputableDistribution<Matrix>