epfl.classifier
Class MultMixtureModelClassifier

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

public class MultMixtureModelClassifier
extends AbstractClassifier

A classifier based on multivariate mixture models


Inner Class Summary
static class MultMixtureModelClassifier.MultClassModel
           
 
Constructor Summary
MultMixtureModelClassifier(int nClasses, int dimension, int nKernels, double[] priorProb, double minMu, double maxMu, double sigma, java.lang.String name)
          Creates a new mixture model classifier without stream connection
MultMixtureModelClassifier(int nClasses, int dimension, int nKernels, double[] priorProb, double minMu, double maxMu, double sigma, java.lang.String name, VectorReader in)
          Creates a mixture model classifier with stream connection
MultMixtureModelClassifier(TagReader config, java.lang.String name)
          Creates a new mixture model classifier without stream connection
MultMixtureModelClassifier(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
 int dimension()
          Returns the vector space dimension
 MultMixtureModelClassifier.MultClassModel getClassModel(int index)
          Returns the model of the given class
 int nClasses()
          Returns the number of classes
 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

MultMixtureModelClassifier

public MultMixtureModelClassifier(int nClasses,
                                  int dimension,
                                  int nKernels,
                                  double[] priorProb,
                                  double minMu,
                                  double maxMu,
                                  double sigma,
                                  java.lang.String name,
                                  VectorReader in)
Creates a mixture model classifier with stream connection
Parameters:
nClasses - the number of classes
dimension - the vector space dimension
priorProb - the prior class distribution (if null then p = 1/nClasses)
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 classifier's name
in - the underlying vector reader

MultMixtureModelClassifier

public MultMixtureModelClassifier(int nClasses,
                                  int dimension,
                                  int nKernels,
                                  double[] priorProb,
                                  double minMu,
                                  double maxMu,
                                  double sigma,
                                  java.lang.String name)
Creates a new mixture model classifier without stream connection

MultMixtureModelClassifier

public MultMixtureModelClassifier(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

MultMixtureModelClassifier

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

getClassModel

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

nClasses

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

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

dimension

public int dimension()
Returns the vector space dimension

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