Facemorph.condensation
Class SimpleCondensation

java.lang.Object
  extended by Facemorph.condensation.SimpleCondensation

public abstract class SimpleCondensation
extends java.lang.Object

Simple condensation implementation


Constructor Summary
SimpleCondensation(double[] initial, double[] variances, int count)
          SimpleCondensation constructor
 
Method Summary
 double[] generateSample(double[] previous)
          Generates a single sample from a previous one using the variances given
 double[] getCurrentBest()
          Gets the current highest rated estimate will rate the set if not yet rated
 void nextGeneration()
          Construct the next generation.
 void rateGeneration()
          Rate a whole generation and normalise the weightings (sum to 1)
abstract  double rateSample(double[] sample)
          Method to rate an individual sample, implementation dependent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCondensation

public SimpleCondensation(double[] initial,
                          double[] variances,
                          int count)
SimpleCondensation constructor

Parameters:
initial - the initial value to work from
variances - the dynamic variance of each parameter
count - the number of samples to retain each iteration
Method Detail

generateSample

public double[] generateSample(double[] previous)
Generates a single sample from a previous one using the variances given

Parameters:
previous - the previous value of the sample
Returns:
returns the new value of the sample, randomly perturbed from the original position

rateSample

public abstract double rateSample(double[] sample)
Method to rate an individual sample, implementation dependent

Parameters:
sample - the sample to rate
Returns:
returns the weighting of this sample, should be positive

rateGeneration

public void rateGeneration()
Rate a whole generation and normalise the weightings (sum to 1)


nextGeneration

public void nextGeneration()
Construct the next generation. Will rate the generation if they haven't been rated yet.


getCurrentBest

public double[] getCurrentBest()
Gets the current highest rated estimate will rate the set if not yet rated

Returns:
returns the current best guess