epfl.classifier
Class MixtureModelClassifier

java.lang.Object
  |
  +--epfl.classifier.AbstractClassifier
        |
        +--epfl.classifier.MixtureModelClassifier
All Implemented Interfaces:
Classifier, VectorReader

public class MixtureModelClassifier
extends AbstractClassifier

A classifier based on mixture models


Inner Class Summary
static class MixtureModelClassifier.ClassModel
           
 
Constructor Summary
MixtureModelClassifier(int nClasses, int nFeatures, int nKernels, double[] priorProb, double[][] mu, double[] sigma, double[][] missingVal, double recognition, java.lang.String name)
          Creates a new mixture model classifier without stream connection
MixtureModelClassifier(int nClasses, int nFeatures, int nKernels, double[] priorProb, double[][] mu, double[] sigma, double[][] missingVal, double recognition, java.lang.String name, VectorReader in)
          Creates a mixture model classifier with stream connection
MixtureModelClassifier(TagReader config, java.lang.String name)
          Creates a new mixture model classifier without stream connection
MixtureModelClassifier(TagReader config, java.lang.String name, VectorReader in)
          Creates a new mixture model classifier with parameters read in a file
 
Method Summary
 boolean areClassModelWeightsValid()
          Checks if the class models prior probability are positive and sum to 1.0
 double[] classify(double[] features)
          Classification function
 MixtureModelClassifier.ClassModel getClassModel(int index)
          Returns the model of the given class
 Pdf getFeatureClassifier(int classIndex, int featureIndex)
          Returns a pdf which represents p(class k | feature i)
 int nClasses()
          Returns the number of classes
 int nFeatures()
          Returns the number of features
 void tagWrite(TagWriter out, TagWriter.Indent _indent)
          Writes a tag representation for this classifier in a tag writer
 
Methods inherited from class epfl.classifier.AbstractClassifier
close, period, read, size, tagWrite, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MixtureModelClassifier

public MixtureModelClassifier(int nClasses,
                              int nFeatures,
                              int nKernels,
                              double[] priorProb,
                              double[][] mu,
                              double[] sigma,
                              double[][] missingVal,
                              double recognition,
                              java.lang.String name,
                              VectorReader in)
Creates a mixture model classifier with stream connection
Parameters:
nClasses - the number of classes
nFeatures - the number of feature for a class (input vector size)
nKernels - the initial number of kernels for each feature
priorProb - the prior class distribution (if null then p = 1/nClasses)
mu - mu[f][0] = min Mu; mu[f][1] = max Mu for the feature f kernels
f in range 0..nFeatures-1
sigma - sigma[f] the sigma value for the feature f kernels
f in range 0..nFeatures-1
missingVal - missingValue[f][0] = missing value code; missingValue[f][1] = missing value substitute;
f in range 0..nFeatures;
recognition - the recognition precision in range 0..1
name - the classifier's name
in - the underlying vector reader

MixtureModelClassifier

public MixtureModelClassifier(int nClasses,
                              int nFeatures,
                              int nKernels,
                              double[] priorProb,
                              double[][] mu,
                              double[] sigma,
                              double[][] missingVal,
                              double recognition,
                              java.lang.String name)
Creates a new mixture model classifier without stream connection

MixtureModelClassifier

public MixtureModelClassifier(TagReader config,
                              java.lang.String name,
                              VectorReader in)
                       throws java.io.IOException
Creates a new mixture model classifier with parameters read in a file
Parameters:
config - the configuration file
tag - the tag name enclosing the parameters
The file format must be :
<name>
  <nClasses> int </nClasses>
  { <classi>
     ClassModel
  </classi> } i in range 0..nClasses-1
</name>
in - the underlying vector reader
Throws:
java.io.IOException - if there is an error in file format

MixtureModelClassifier

public MixtureModelClassifier(TagReader config,
                              java.lang.String name)
                       throws java.io.IOException
Creates a new mixture model classifier without stream connection
Method Detail

getClassModel

public MixtureModelClassifier.ClassModel getClassModel(int index)
Returns the model of the given class
Parameters:
index - in range 0..nClasses-1

getFeatureClassifier

public Pdf getFeatureClassifier(int classIndex,
                                int featureIndex)
Returns a pdf which represents p(class k | feature i)

nClasses

public int nClasses()
Returns the number of classes
Overrides:
nClasses in class AbstractClassifier

nFeatures

public int nFeatures()
Returns the number of features

areClassModelWeightsValid

public boolean areClassModelWeightsValid()
Checks if the class models prior probability are positive and sum to 1.0

classify

public double[] classify(double[] features)
Classification function
Overrides:
classify in class AbstractClassifier

tagWrite

public void tagWrite(TagWriter out,
                     TagWriter.Indent _indent)
Writes a tag representation for this classifier in a tag writer
Overrides:
tagWrite in class AbstractClassifier