|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.AbstractCondProbDistrib blog.distrib.MultivarGaussian
public class MultivarGaussian
Gaussian (normal) distribution over real vectors of some fixed
dimensionality d. This CPD can be initialized with one, two, or
three parameters. If three parameters are given, then they are the
dimension, mean, and covariance matrix. If two parameters are given,
they are interpreted as the dimension and covariance matrix; in this
case the mean must be passed as an argument to the getProb
and sampleVal
methods. If only one parameter is given, it
is the dimension, and the mean and covariance matrix must both be given
as arguments.
Constructor Summary | |
---|---|
MultivarGaussian(java.util.List params)
Sets mean and covariance and ensures that their dimensions match. |
|
MultivarGaussian(Jama.Matrix mean,
Jama.Matrix covariance)
Creates a new MultivarGaussian distribution with the given mean vector and covariance matrix. |
Method Summary | |
---|---|
Jama.Matrix |
getCovar()
Returns the covariance matrix of this distribution, or null if the covariance is not fixed. |
double |
getLogProb(Jama.Matrix x)
Returns the natural log of the probability returned by getProb. |
Jama.Matrix |
getMean()
Returns the mean of this distribution, or null if the mean is not fixed. |
double |
getProb(java.util.List args,
java.lang.Object value)
Ensures that x = value is a column matrix of appropriate dimension d and returns the density of this Gaussian distribution at x. |
double |
getProb(Jama.Matrix x)
Given a d-dimensional column vector x, returns the density value p = 1/sqrt((2*pi)^d*|sigma|)*exp{-0.5(x-mean)'*inverse(sigma)*(x-mean)} |
Jama.Matrix |
sampleVal()
Samples a value from this multivariate Gaussian by generating d independent samples from univariate Gaussians with unit variance, one for each mean in the mean vector, and multiplying the obtained vector on the left by the square root of sigma (Cholesky decomposition of sigma). |
java.lang.Object |
sampleVal(java.util.List args,
Type childType)
Samples a value from this multivariate Gaussian by generating d independent samples from univariate Gaussians with unit variance, one for each dimension, and multiplying the obtained vector on the left by the square root of sigma (Cholesky decomposition of sigma). |
Methods inherited from class blog.AbstractCondProbDistrib |
---|
getLogProb, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MultivarGaussian(Jama.Matrix mean, Jama.Matrix covariance)
mean
- 1-by-d mean vectorcovariance
- d-by-d covariance matrixpublic MultivarGaussian(java.util.List params)
Method Detail |
---|
public double getProb(java.util.List args, java.lang.Object value)
public double getProb(Jama.Matrix x)
java.lang.IllegalStateException
- if this distribution does not have fixed
mean and covariancepublic double getLogProb(Jama.Matrix x)
public java.lang.Object sampleVal(java.util.List args, Type childType)
initParams
is called
first).
public Jama.Matrix sampleVal()
initParams
is called
first).
public Jama.Matrix getMean()
public Jama.Matrix getCovar()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |