diva.sketch.classification
Class WeightSet

java.lang.Object
  extended by diva.sketch.classification.WeightSet
Direct Known Subclasses:
GaussianWeightSet

public abstract class WeightSet
extends Object

A WeightSet object represents a training type (e.g. square, class, circle, etc.) It has a mu vector and a sigma vector. Each element in the mu vector represents the average value (e.g. mean) for a particular feature of this class, and the corresponding sigma value indicates how much the value of the feature may vary (e.g. standard deviation). However, the exact statistical calculation for mu and sigma vary depending on the type of classification algorithms.

Version:
$Revision: 1.5 $
Author:
Heloise Hse (hwawen@eecs.berkeley.edu), Michael Shilman (michaels@eecs.berkeley.edu)

Constructor Summary
WeightSet(String type)
          Construct a WeightSet of the specified type.
 
Method Summary
 void addExample(FeatureSet f)
          Add an example to this classifier.
 void clearExamples()
          Clear the examples.
protected abstract  FeatureSet computeMu()
          Calculate the mu values for each feature in this class.
protected abstract  FeatureSet computeSigma()
          Calculate the sigma values for each feature in this class.
protected  void debug(String s)
           
protected  Iterator examples()
          Return an iterator over the examples of this classifier.
 int getExampleCount()
          Return the number of examples.
 FeatureSet getMuValues()
          Return the mu values.
 FeatureSet getSigmaValues()
          Return the sigma values.
 String getType()
          Return the type of this classifier.
 String toString()
          The text representation of this weight set.
 void train()
          Train on the examples by computing the mu and sigma values for each feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeightSet

public WeightSet(String type)
Construct a WeightSet of the specified type.

Method Detail

addExample

public void addExample(FeatureSet f)
Add an example to this classifier. The example will be used to compute mu and sigma.


clearExamples

public void clearExamples()
Clear the examples. Once the training is complete it is a waste of memory to retain all of the examples.


computeMu

protected abstract FeatureSet computeMu()
                                 throws ClassifierException
Calculate the mu values for each feature in this class. Return the feature set representing the mu values.

Throws:
ClassifierException

computeSigma

protected abstract FeatureSet computeSigma()
                                    throws ClassifierException
Calculate the sigma values for each feature in this class. Return the feature set representing the sigma values.

Throws:
ClassifierException

debug

protected void debug(String s)

examples

protected Iterator examples()
Return an iterator over the examples of this classifier. The examples are cleared once training is complete, so this method will return an empty iterator if it is called post-training.


getExampleCount

public int getExampleCount()
Return the number of examples.


getMuValues

public FeatureSet getMuValues()
Return the mu values.


getSigmaValues

public FeatureSet getSigmaValues()
Return the sigma values.


getType

public String getType()
Return the type of this classifier.


train

public void train()
           throws ClassifierException
Train on the examples by computing the mu and sigma values for each feature. This method clears the examples once the training is complete, to avoid wasted space.

Throws:
ClassifierException

toString

public String toString()
The text representation of this weight set.

Overrides:
toString in class Object


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.