org.biojava.bio.dist
Class SimpleDistributionTrainer

java.lang.Object
  |
  +--org.biojava.bio.dist.SimpleDistributionTrainer

public final class SimpleDistributionTrainer
extends java.lang.Object
implements DistributionTrainer, java.io.Serializable

An implemenation of a simple distribution trainer

See Also:
Serialized Form

Constructor Summary
SimpleDistributionTrainer(Distribution dis)
           
 
Method Summary
 void addCount(DistributionTrainerContext dtc, Symbol sym, double count)
          Registers that sym was counted in this state.
 void clearCounts()
          Clears all of the counts to zero.
 void train(Distribution nullModel, double weight)
          Trains the Distribution, given a null model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDistributionTrainer

public SimpleDistributionTrainer(Distribution dis)
                          throws IllegalAlphabetException
Method Detail

addCount

public void addCount(DistributionTrainerContext dtc,
                     Symbol sym,
                     double count)
              throws IllegalSymbolException
Description copied from interface: DistributionTrainer
Registers that sym was counted in this state.

This method may be called multiple times with the same symbol. In this case, the times should be summed.

Specified by:
addCount in interface DistributionTrainer
Tags copied from interface: DistributionTrainer
Parameters:
dtc - the DistributionTrainerContext within which the count was added
sym - the Symbol seen
times - the number of times to add

train

public void train(Distribution nullModel,
                  double weight)
           throws IllegalSymbolException
Description copied from interface: DistributionTrainer
Trains the Distribution, given a null model.

This will use the information collected with multiple addCount calls, and the null model to generate the new weights.

This method should not modify the underlying counts.

Specified by:
train in interface DistributionTrainer
Tags copied from interface: DistributionTrainer
Parameters:
nullModel - the null model Distribution
weight - how many lots of the null model to add

clearCounts

public void clearCounts()
Description copied from interface: DistributionTrainer
Clears all of the counts to zero.
Specified by:
clearCounts in interface DistributionTrainer