epfl.pdf
Class MultNormalKernelPdf

java.lang.Object
  |
  +--epfl.pdf.MultNormalKernelPdf

public class MultNormalKernelPdf
extends java.lang.Object

A probability density function based on multivariate normal kernels


Inner Class Summary
static class MultNormalKernelPdf.MultNormalKernel
          A normal kernel class
 
Constructor Summary
MultNormalKernelPdf(int dimension, int nKernels, double minMu, double maxMu, double sigma, java.lang.String name)
          Creates a new pdf with multivariate normal kernels
MultNormalKernelPdf(TagReader config, java.lang.String name)
          Creates a new pdf with normal kernels read in a tag reader
 
Method Summary
 void addKernel(double weight, double[] mu, double sigma)
          Adds a new normal kernel
 boolean areKernelWeightsValid()
          Checks if the kernel weights are positive and sum to 1.0
 int dimension()
          Returns the vector space dimension
 MultNormalKernelPdf.MultNormalKernel getKernel(int index)
          Returns the kernel at the given index
 int nKernels()
          Returns the number of kernels
 double pdf(double[] x)
          Probability density function
 void tagWrite(TagWriter out)
          Writes a tag representation for this pdf in a tag writer
 void tagWrite(TagWriter out, TagWriter.Indent _indent)
          Writes a tag representation for this pdf in a tag writer
 java.lang.String toString()
          Returns a string representation for this pdf
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultNormalKernelPdf

public MultNormalKernelPdf(int dimension,
                           int nKernels,
                           double minMu,
                           double maxMu,
                           double sigma,
                           java.lang.String name)
Creates a new pdf with multivariate normal kernels
Parameters:
dimension - the vector space dimension
nKernels - the initial number of kernels
The kernel mu parameter is set to a random value between minMu and maxMu; the sigma parameters are equal to sigma and the weight value is equal to 1.0/nKernels
name - the pdf name

MultNormalKernelPdf

public MultNormalKernelPdf(TagReader config,
                           java.lang.String name)
                    throws java.io.IOException
Creates a new pdf with normal kernels read in a tag reader
Parameters:
config - the tag reader to configure the kernels
tag - the tag name enclosing the kernels parameters
The file format must be :
<tag>
  <dimension> int </dimension>
  <nKernels> int </nKernels>
  <kernels>
   {double (weight) {double (mu)}dimension double (sigma) } nKernels
  </kernels>
</tag>
Throws:
java.io.IOException - if there is an error in file format
Method Detail

pdf

public double pdf(double[] x)
Probability density function

dimension

public int dimension()
Returns the vector space dimension

getKernel

public MultNormalKernelPdf.MultNormalKernel getKernel(int index)
Returns the kernel at the given index

addKernel

public void addKernel(double weight,
                      double[] mu,
                      double sigma)
Adds a new normal kernel
Parameters:
weight - the kernel weight

nKernels

public int nKernels()
Returns the number of kernels

areKernelWeightsValid

public boolean areKernelWeightsValid()
Checks if the kernel weights are positive and sum to 1.0

toString

public java.lang.String toString()
Returns a string representation for this pdf
Overrides:
toString in class java.lang.Object

tagWrite

public void tagWrite(TagWriter out,
                     TagWriter.Indent _indent)
Writes a tag representation for this pdf in a tag writer

tagWrite

public void tagWrite(TagWriter out)
Writes a tag representation for this pdf in a tag writer