|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.math.random.MultiNormal
public class MultiNormal
Samples from a multi-variate normal distribution.
This is done by sampling from several independent unit normal distributions to get a vector u. The sample value that is returned is then A u + m where A is derived from the covariance matrix and m is the mean of the result. If \Sigma is the desired covariance matrix, then you can use any value of A such that A' A = \Sigma. The Cholesky decomposition can be used to compute A if \Sigma is positive definite. Slightly more expensive is to use the SVD U S V' = \Sigma and then set A = U \sqrt{S}. Useful special cases occur when \Sigma is diagonal so that A = \sqrt(\Sigma) or where \Sigma = r I. Another special case is where m = 0.
| Constructor Summary | |
|---|---|
MultiNormal(double radius,
Vector mean)
|
|
MultiNormal(int dimension)
|
|
MultiNormal(Matrix a,
Vector mean)
Constructs a sampler with non-trivial scale matrix and mean. |
|
MultiNormal(Vector diagonal)
Constructs a sampler with diagonal scale matrix. |
|
MultiNormal(Vector diagonal,
Vector mean)
Constructs a sampler with diagonal scale matrix and (potentially) non-zero mean. |
|
| Method Summary | |
|---|---|
Vector |
getScale()
|
Vector |
sample()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiNormal(Vector diagonal)
diagonal - The diagonal elements of the scale matrix.
public MultiNormal(Vector diagonal,
Vector mean)
diagonal - The scale matrix's principal diagonal.mean - The desired mean. Set to null if zero mean is desired.
public MultiNormal(Matrix a,
Vector mean)
public MultiNormal(int dimension)
public MultiNormal(double radius,
Vector mean)
| Method Detail |
|---|
public Vector sample()
sample in interface Sampler<Vector>public Vector getScale()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||