|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectFacemorph.BigMat
Facemorph.Gaussian
public class Gaussian
A Gaussian distribution class
| Constructor Summary | |
|---|---|
Gaussian()
Constructor for an empty Gaussian |
|
Gaussian(double[] mean,
BigMat covar,
boolean invert)
Construct a Gaussian using the data given |
|
Gaussian(int dim)
Constructs a Gaussian for the dimensions specified |
|
| Method Summary | |
|---|---|
boolean |
build(java.util.Vector samples)
Builds a Gaussian from a set of arrays |
boolean |
build(java.util.Vector samples,
BigMat dist)
Build a Gaussian from the supplied samples |
double |
build(java.util.Vector samples,
java.util.Vector sampleWeights,
int index)
Builds the mean and covariance matrix from the samples given |
void |
display(java.lang.String label)
DIsplay the eigenvector matrix, the eigenvalue array and the mean |
double[] |
eigenAnalysis(double[] sample)
Analyse the sample into its principal components |
double[] |
eigenSynthesis(double[] sample)
Synthesise a sample with the given principal component weights |
BigMat |
getCovar(boolean invert)
Uses the eigenvalues and eigenvectors to reconstruct the covariance matrix or it inverse |
double[] |
getDiag()
gets the variances of this Gaussian |
double[] |
getMean()
Get the mean of this Gaussian |
double[] |
getRandomSample(java.util.Random rand)
Gets a random vector sampled from this Gaussian distribution |
static void |
main(java.lang.String[] args)
Used for testing |
double |
probability(double[] sample)
Calculates the probability of a sample vector |
boolean |
read(java.io.InputStream in)
Read this Gaussian from the given InputStream |
boolean |
read(java.io.StreamTokenizer st)
Read from the given StreamTokenizer |
void |
setSize(int dim)
Sets the size of this Gaussian |
Gaussian |
slice(double[] sample,
double[] weight)
Takes a slice through the Gaussian, to produce a new Gaussian first "fixed" elements are fixed remaining elements of the Gaussian are used in the new Gaussian |
double[] |
slice1d(double[] start,
double[] direction)
Takes a 1D slice through the Gaussian along the line through start pointing in direction the output Gaussian is centred on start and the units are 1 equals the length of direction |
double |
squaredMeanDistance(double[] sample)
Get the squared distance of the mean from the sample |
double |
T_squared(Gaussian g,
double weight1,
double weight2)
Hotelling's T^2 statistic (the N-D t-test equivalent) |
boolean |
write(java.io.PrintStream out)
Writes this to the given PrintStream |
| Methods inherited from class Facemorph.BigMat |
|---|
add, add, copy, copy, displayMatlab, dotProduct, equals, equals, get, getColumn, getColumnCopy, getHeight, getRowCopy, getWidth, identity, invertSVD, jacobi, magnitude, multiply, multiply, multiply, multiplyOtherTranspose, multiplySelfTranspose, multiplyTranspose, multiplyTranspose, normaliseColumns, normaliseRows, put, qrdcmp, qrdcmp, qrsolv, read, read, readBinary, readBinary, reconstructQR, removeNaNRecords, rsolv, setColumn, setRow, setSize, SIGN, sort, squareInPlace, subMat, subMat, subMat, subMatCols, subMatRows, subtractFromInPlace, subtractInPlace, subtractInPlace, sumSquares, svbksb, svbksb, svbksbt, svbksbt, svdcmp, svdcmpt, transposeCopy, upperTriangularBacksub, upperTriangularInverseMultiply, vectorise, write, write, writeBinary, writeBinary |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Gaussian()
public Gaussian(int dim)
dim - the required dimensionality of this Gaussian
public Gaussian(double[] mean,
BigMat covar,
boolean invert)
mean - The mean vectorcovar - The covariance matrixinvert - specifies if the covariane matrix should be inverted| Method Detail |
|---|
public void setSize(int dim)
throws BigMatException
dim - The number of dimensions
BigMatException - thrown if problems setting the matrix sizepublic boolean build(java.util.Vector samples)
samples - The vector of sample arrays
public boolean build(java.util.Vector samples,
BigMat dist)
samples - the data samplesdist - The a priri distribution
public double build(java.util.Vector samples,
java.util.Vector sampleWeights,
int index)
samples - the Vector of double[] samplessampleWeights - the Vector of double[] sample weightsindex - the index in each sampleWeight array of this Gaussian
public BigMat getCovar(boolean invert)
throws BigMatException
invert - flag indicating if the inverse covariance matrix is required
BigMatExceptionpublic double[] getMean()
public double[] getDiag()
public double[] eigenAnalysis(double[] sample)
sample - the sample to analyse
public double[] eigenSynthesis(double[] sample)
sample - the weights
public double squaredMeanDistance(double[] sample)
sample - the sample to test
public double probability(double[] sample)
throws BigMatException
sample - The sample to test
BigMatException
public double T_squared(Gaussian g,
double weight1,
double weight2)
throws BigMatException
g - The Gaussian to compare withweight1 - the weight of this Gaussianweight2 - the weight of g
BigMatExceptionpublic double[] getRandomSample(java.util.Random rand)
rand - A random number generating object
public Gaussian slice(double[] sample,
double[] weight)
throws BigMatException
sample - the fixed values of the first n dimensionsweight - an optional array of size 1 used to store the slice probability, can be null if not needed
BigMatException
public double[] slice1d(double[] start,
double[] direction)
start - the starting pointdirection - the direction the line is going in
public void display(java.lang.String label)
display in class BigMatlabel - The label to display with this Gaussianpublic boolean write(java.io.PrintStream out)
write in class BigMatout - the PrintStream to write to
public boolean read(java.io.InputStream in)
in - the InputStream to read from
public boolean read(java.io.StreamTokenizer st)
read in class BigMatst - the StreamTokenizer to read from
public static void main(java.lang.String[] args)
throws BigMatException
args - the command line arguments
BigMatException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||