milk.classifiers
Class TLDSimple

java.lang.Object
  |
  +--milk.classifiers.MIClassifier
        |
        +--milk.classifiers.TLDSimple
All Implemented Interfaces:
java.lang.Cloneable, weka.core.OptionHandler, java.io.Serializable

public class TLDSimple
extends MIClassifier
implements weka.core.OptionHandler

0657.594 Thesis A simpler version of TLD, \mu random but \sigma^2 fixed and estimated via data

See Also:
Serialized Form

Field Summary
protected  double[] m_Class
          The class label of each exemplar
protected  double m_Cutoff
           
protected  int m_Dimension
          The dimension of each exemplar, i.e.
protected  double[][] m_MeanN
          The mean for each attribute of each negative exemplar
protected  double[][] m_MeanP
          The mean for each attribute of each positive exemplar
protected  int m_NumClasses
          The number of class labels in the data
protected  double[] m_ParamsN
          The parameters to be estimated for each negative exemplar
protected  double[] m_ParamsP
          The parameters to be estimated for each positive exemplar
protected  int m_Run
           
protected  long m_Seed
           
protected  double[] m_SgmSqN
          Estimated sigma^2 in negative bags
protected  double[] m_SgmSqP
          Estimated sigma^2 in positive bags
protected  double[][] m_SumN
          The effective sum of weights of each negative exemplar in each dimension
protected  double[][] m_SumP
          The effective sum of weights of each positive exemplar in each dimension
protected  boolean m_UseEmpiricalCutOff
           
static double ZERO
          The very small number representing zero
 
Constructor Summary
TLDSimple()
           
 
Method Summary
 void buildClassifier(Exemplars exs)
          Generates a classifier.
 double classifyExemplar(Exemplar e)
          Classifies the given test instance.
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options Valid options are:
static void main(java.lang.String[] args)
          Main method for testing.
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Gets a string describing the classifier.
 
Methods inherited from class milk.classifiers.MIClassifier
distributionForExemplar, forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_MeanP

protected double[][] m_MeanP
The mean for each attribute of each positive exemplar


m_MeanN

protected double[][] m_MeanN
The mean for each attribute of each negative exemplar


m_SumP

protected double[][] m_SumP
The effective sum of weights of each positive exemplar in each dimension


m_SumN

protected double[][] m_SumN
The effective sum of weights of each negative exemplar in each dimension


m_SgmSqP

protected double[] m_SgmSqP
Estimated sigma^2 in positive bags


m_SgmSqN

protected double[] m_SgmSqN
Estimated sigma^2 in negative bags


m_ParamsP

protected double[] m_ParamsP
The parameters to be estimated for each positive exemplar


m_ParamsN

protected double[] m_ParamsN
The parameters to be estimated for each negative exemplar


m_Dimension

protected int m_Dimension
The dimension of each exemplar, i.e. (numAttributes-2)


m_Class

protected double[] m_Class
The class label of each exemplar


m_NumClasses

protected int m_NumClasses
The number of class labels in the data


ZERO

public static double ZERO
The very small number representing zero


m_Run

protected int m_Run

m_Seed

protected long m_Seed

m_Cutoff

protected double m_Cutoff

m_UseEmpiricalCutOff

protected boolean m_UseEmpiricalCutOff
Constructor Detail

TLDSimple

public TLDSimple()
Method Detail

buildClassifier

public void buildClassifier(Exemplars exs)
                     throws java.lang.Exception
Description copied from class: MIClassifier
Generates a classifier. Must initialize all fields of the classifier that are not being set via options (ie. multiple calls of buildClassifier must always lead to the same result). Must not change the dataset in any way.

Specified by:
buildClassifier in class MIClassifier
Parameters:
exs - the training exemplars
Throws:
if - the model cannot be built properly
java.lang.Exception - if the classifier has not been generated successfully

classifyExemplar

public double classifyExemplar(Exemplar e)
                        throws java.lang.Exception
Description copied from class: MIClassifier
Classifies the given test instance. The instance has to belong to a dataset when it's being classified. Classifiers either have to implement this or distributionForExemplar().

Overrides:
classifyExemplar in class MIClassifier
Parameters:
e - the instance to be classified
Returns:
the classification
Throws:
java.lang.Exception - if the exemplar could not be classified successfully

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options Valid options are:

-C Set whether or not use empirical log-odds cut-off instead of 0 (default: Not use) -R Set the number of multiple runs needed for searching the MLE. (default: 1)

Specified by:
listOptions in interface weka.core.OptionHandler
Returns:
an enumeration of all the available options

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Specified by:
setOptions in interface weka.core.OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface weka.core.OptionHandler
Returns:
an array of strings suitable for passing to setOptions

toString

public java.lang.String toString()
Gets a string describing the classifier.

Overrides:
toString in class java.lang.Object
Returns:
a string describing the classifer built.

main

public static void main(java.lang.String[] args)
Main method for testing.

Parameters:
args - the options for the classifier