statistics
Class Density

java.lang.Object
  extended by statistics.Density
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DensityDiagonal, DensityFull

public abstract class Density
extends java.lang.Object
implements java.io.Serializable

The abstract Density class provides the basic assets of a Gaussian density.

Author:
sikoried
See Also:
Serialized Form

Field Summary
 double apr
          prior probability
 double ascore
          cached score from the last evaluate call, with prior!
 double[] cov
          covariance matrix: either diagonal, or packed lower triangle
 int fd
          feature dimension
 int id
          Density ID
 double lh
          log likelihood: log(apr*score)
static double MIN_PROB
          minimum density score
 double[] mue
          mean vector
static double REGULARIZER
          regularizer for density score
 double score
          cached score from the last evaluate call, no prior, no exponentiation (only good for ranking)!
 
Constructor Summary
Density(int dim)
          Create a new density with a certain feature dimension
 
Method Summary
 void clear()
          Reset all the components.
abstract  Density clone()
          Clone the instance (deep copy)
 java.lang.String covarianceAsGnuplot()
          Generate the gnuplot command (parametric) for this density, accounting for the first 2 dimensions
abstract  double evaluate(double[] x)
          Evaluate the density for the given sample vector x.
 void fill(double apr, double[] mue, double[] cov)
          Set the parameters of the density.
 double[] superVector(boolean prior, boolean mue, boolean cov)
           
abstract  void update()
          Update the internally cached variables.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

apr

public double apr
prior probability


ascore

public transient double ascore
cached score from the last evaluate call, with prior!


cov

public double[] cov
covariance matrix: either diagonal, or packed lower triangle


fd

public int fd
feature dimension


id

public int id
Density ID


lh

public transient double lh
log likelihood: log(apr*score)


MIN_PROB

public static final double MIN_PROB
minimum density score

See Also:
Constant Field Values

mue

public double[] mue
mean vector


REGULARIZER

public static final double REGULARIZER
regularizer for density score

See Also:
Constant Field Values

score

public transient double score
cached score from the last evaluate call, no prior, no exponentiation (only good for ranking)!

Constructor Detail

Density

public Density(int dim)
Create a new density with a certain feature dimension

Parameters:
dim - Feature dimesion
Method Detail

clear

public void clear()
Reset all the components.


clone

public abstract Density clone()
Clone the instance (deep copy)

Overrides:
clone in class java.lang.Object

covarianceAsGnuplot

public java.lang.String covarianceAsGnuplot()
Generate the gnuplot command (parametric) for this density, accounting for the first 2 dimensions


evaluate

public abstract double evaluate(double[] x)
Evaluate the density for the given sample vector x. score keeps the probability (without the prior).

Parameters:
x - feature vector
Returns:
prior times score

fill

public void fill(double apr,
                 double[] mue,
                 double[] cov)
Set the parameters of the density.

Parameters:
apr - prior probability
mue - mean vector
cov - covariance vector

superVector

public double[] superVector(boolean prior,
                            boolean mue,
                            boolean cov)

update

public abstract void update()
Update the internally cached variables. Required after modification.