| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectFacemorph.psm.DiagonalGMM
public class DiagonalGMM
A DiagonalGaussian mixture model
| Constructor Summary | |
|---|---|
DiagonalGMM()
Constructs a GMM of count clusters  | 
|
DiagonalGMM(int count)
Constructs a GMM of count clusters  | 
|
| Method Summary | |
|---|---|
 void | 
add(DiagonalGaussian g)
 | 
static double[] | 
append(double[] s_frame,
       double[] a_frame)
Method to concatanate two arrays  | 
static java.util.Vector | 
appendVectors(java.util.Vector v1,
              java.util.Vector v2)
Method to concatanate each array of v2 onto the corresponding array of v1  | 
 void | 
copy(DiagonalGMM gmm)
Copy the given GMM  | 
static java.util.Vector | 
createDynamics(java.util.Vector samples)
Creates estimates for the dynamic coefficents by concatenating each frame with the next  | 
static java.util.Vector | 
createDynamics2(java.util.Vector samples)
Estimates the derivative of the appearance  | 
 java.util.Vector | 
EM(java.util.Vector samples)
Perform the EM algorithm to build a GMM on a number of samples  | 
 java.util.Vector | 
EM(java.util.Vector samples,
   java.util.Vector<java.lang.Double> weights)
Perform the EM algorithm to build a GMM on a number of samples  | 
 DiagonalGaussian | 
getCluster(int i)
Get the ith cluster  | 
 int | 
getCount()
Gte the number of clusters  | 
 double[] | 
getRandomSample(java.util.Random rand)
sample from one DiagonalGaussian in cluster selected according to its weight  | 
 double | 
getWeight(int i)
Gets the weight of the ith cluster  | 
static void | 
main(java.lang.String[] args)
An experimental EM clustering algorithm  | 
 double[] | 
maxProbabilties()
 | 
 double | 
maxProbabilty()
 | 
 void | 
normalise()
Forces the sum of weights to equal 1.0  | 
static void | 
normalise(java.util.ArrayList<java.lang.Double> vals)
Forces the sum of weights to equal 1.0  | 
static void | 
normaliseSampleWeights(java.util.Vector sampleWeights)
Normalise the sample weights to have sum of 1  | 
static void | 
normaliseSampleWeights(java.util.Vector sampleWeights,
                       java.util.Vector<java.lang.Double> weights)
Normalise the sample weights to have sum of 1  | 
static void | 
normaliseSampleWeights2(java.util.Vector sampleWeights)
Normalise the sample weights so that the most likely DiagonalGaussian has weight 1 and all the rest have weight zero  | 
 double | 
prob_sample_given_GMM(java.util.Vector sample)
Calculates the probability of a set of samples  | 
 double[] | 
probabilities(double[] sample)
Calculates the probability of the sample given  | 
 double | 
probability(double[] sample)
Calculates the probability of the sample given  | 
 void | 
random(java.util.Random rand,
       DiagonalGaussian gauss)
Initialises a bunch of random centres  | 
static int[] | 
rank(double[] vec)
Finds the ordering of a set of values  | 
static void | 
rank(double[] vec,
     int[] order,
     int p,
     int l)
Find the ordering of a vector  | 
 void | 
read(java.io.DataInputStream in)
Read from a DataInputStream  | 
 void | 
read(java.io.StreamTokenizer st)
Read from a StreamTokenizer  | 
 void | 
read(java.lang.String filename)
Read this GMM from a file  | 
static java.util.Vector | 
readMFCC(java.io.DataInputStream in)
Read Mel-Frequency Cepstral Coefficients (MFCC) for audio analysis  | 
static java.util.Vector | 
readMFCC(java.io.StreamTokenizer st)
Reads an MFCC file with most of the header stripped out  | 
static java.util.Vector | 
readMFCC(java.lang.String filename)
Read Mel-Frequency Cepstral Coefficients (MFCC) for audio analysis  | 
static java.util.Vector | 
readVectors(java.io.DataInputStream in)
Reads data vectors from an input stream  | 
static java.util.Vector | 
readVectors(java.io.StreamTokenizer st)
Reads vectors using a StreamTokenizer  | 
static java.util.Vector | 
readVectors(java.lang.String filename)
Reads a list of data vecors from a file  | 
 void | 
reestimate(java.util.Vector samples,
           java.util.Vector sampleWeights)
Rebuild the GMM using the cluster weight for each sample  | 
static java.util.Vector | 
resampleVectors(java.util.Vector v,
                int N)
Change the length of a 1D array using bi-linear interpolation  | 
 void | 
set(int i,
    DiagonalGaussian g,
    double w)
sets the covariance, mean and weight of cluster i  | 
 void | 
weightSamples(java.util.Vector samples,
              java.util.Vector sampleWeights)
Calculate the probability of each sample belonging to each cluster  | 
 void | 
write(java.io.PrintStream out)
Write this GMM to a printstream  | 
 void | 
write(java.lang.String filename)
Write a this GMM to a file named filename  | 
static void | 
writeVectors(java.util.Vector samples,
             java.io.PrintStream out)
Write an array of vectors to a PrintStream  | 
static void | 
writeVectors(java.util.Vector samples,
             java.lang.String filename)
Writes vectors to the file named  | 
static void | 
zeroSampleWeights(java.util.Vector sampleWeights)
Set all the values in sampleWeights to zeo  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public DiagonalGMM(int count)
count - the number of clusters to usepublic DiagonalGMM()
| Method Detail | 
|---|
public void set(int i,
                DiagonalGaussian g,
                double w)
i - index of cluster to setg - The DiagonalGaussian of the ith clusterw - the weight of the ith clusterpublic DiagonalGaussian getCluster(int i)
i - the index of the cluster to get
public double getWeight(int i)
i - The index of the cluster to get
public int getCount()
public void normalise()
public static void normalise(java.util.ArrayList<java.lang.Double> vals)
vals - the values to normalisepublic void write(java.lang.String filename)
filename - the name of the file to write topublic void write(java.io.PrintStream out)
out - The PrintStream to write topublic void read(java.lang.String filename)
filename - the name of the file to read frompublic void read(java.io.DataInputStream in)
in - The DataInputStream to read frompublic void read(java.io.StreamTokenizer st)
st - The StreamTokenizer to read from
public void random(java.util.Random rand,
                   DiagonalGaussian gauss)
rand - a Random number generatorgauss - a DiagonalGaussian with the distribution of the samplepublic java.util.Vector EM(java.util.Vector samples)
samples - the vector of samples to fit a GMM to
public java.util.Vector EM(java.util.Vector samples,
                           java.util.Vector<java.lang.Double> weights)
samples - the vector of samples to fit a GMM toweights - the weighting of each sample
public static void zeroSampleWeights(java.util.Vector sampleWeights)
sampleWeights - the sampleWeights to zeropublic static void normaliseSampleWeights(java.util.Vector sampleWeights)
sampleWeights - the set of sample weights to normalsie
public static void normaliseSampleWeights(java.util.Vector sampleWeights,
                                          java.util.Vector<java.lang.Double> weights)
sampleWeights - the set of sample weights to normalsieweights - the weight of each samplepublic static void normaliseSampleWeights2(java.util.Vector sampleWeights)
sampleWeights - The sample weights to normalise
public void weightSamples(java.util.Vector samples,
                          java.util.Vector sampleWeights)
samples - the samples to analysesampleWeights - the probability of each cluster for each sample
public void reestimate(java.util.Vector samples,
                       java.util.Vector sampleWeights)
samples - The samples to put into the GMMsampleWeights - The probability of each sample with respect to each DiagonalGaussianpublic static int[] rank(double[] vec)
vec - the vector of values whose ordering we wisht ot ind
public static void rank(double[] vec,
                        int[] order,
                        int p,
                        int l)
vec - the vector to find the order oforder - the order of the vector's valuesp - the start index of the sub array to sortl - the end index of the sub array to sortpublic double[] getRandomSample(java.util.Random rand)
rand - A Random number generator
public double probability(double[] sample)
sample - The sample to calculate the probability for
public double[] probabilities(double[] sample)
sample - The sample to calculate the probability for
public double maxProbabilty()
public double[] maxProbabilties()
public static java.util.Vector readVectors(java.lang.String filename)
filename - the name of the file to read from
public static java.util.Vector readVectors(java.io.DataInputStream in)
in - the input stream to read from
public static java.util.Vector readVectors(java.io.StreamTokenizer st)
st - The StreamTokenizer to use to parse tokens
public static void writeVectors(java.util.Vector samples,
                                java.lang.String filename)
samples - the vectors to writefilename - the name of the file to write them to
public static void writeVectors(java.util.Vector samples,
                                java.io.PrintStream out)
samples - the samples to writeout - the printstream to write topublic static java.util.Vector readMFCC(java.lang.String filename)
filename - the name of the file to read from
public static java.util.Vector readMFCC(java.io.DataInputStream in)
in - the DataInputStream to read from
public static java.util.Vector readMFCC(java.io.StreamTokenizer st)
st - the StreamTokenizer to read from
public static double[] append(double[] s_frame,
                              double[] a_frame)
s_frame - The first arraya_frame - the second array
public static java.util.Vector appendVectors(java.util.Vector v1,
                                             java.util.Vector v2)
v1 - The first vector of arraysv2 - the second vector of arrays
public static java.util.Vector resampleVectors(java.util.Vector v,
                                               int N)
v - the vector to resampleN - the desired new length of the vector
public static java.util.Vector createDynamics(java.util.Vector samples)
samples - the speech sample vectors
public static java.util.Vector createDynamics2(java.util.Vector samples)
samples - the samples to find the time deivative of
public double prob_sample_given_GMM(java.util.Vector sample)
sample - the samples in a Vector of double[]
public void copy(DiagonalGMM gmm)
gmm - the gmm to copypublic void add(DiagonalGaussian g)
g - public static void main(java.lang.String[] args)
args - The command line arguments for main
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||