org.biojava.bio.dist
Class SimpleDistributionTrainer

java.lang.Object
  extended by org.biojava.bio.dist.SimpleDistributionTrainer
All Implemented Interfaces:
Serializable, DistributionTrainer

Deprecated. Distribution impls should be providing custom trainers.

public final class SimpleDistributionTrainer
extends Object
implements DistributionTrainer, Serializable

A simple implemenation of a distribution trainer.

This requires the distribuiton being trained to have a working setWeight method that doesn't throw an UnsupportedOperationExcepiton.

Author:
Matthew Pocock
See Also:
Serialized Form

Constructor Summary
SimpleDistributionTrainer(Distribution dis)
          Deprecated.  
 
Method Summary
 void addCount(DistributionTrainerContext dtc, AtomicSymbol sym, double count)
          Deprecated.  Registers that sym was counted in this state.
 void clearCounts(DistributionTrainerContext dtc)
          Deprecated. Clears all of the counts to zero.
 double getCount(DistributionTrainerContext dtc, AtomicSymbol sym)
          Deprecated.  Get the current count for this state.
 void train(DistributionTrainerContext dtc, double weight)
          Deprecated.  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
Deprecated. 
Throws:
IllegalAlphabetException
Method Detail

addCount

public void addCount(DistributionTrainerContext dtc,
                     AtomicSymbol sym,
                     double count)
              throws IllegalSymbolException
Deprecated. 
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
Parameters:
dtc - the DistributionTrainerContext within which the count was added
sym - the Symbol seen
count - the number of times to add
Throws:
IllegalSymbolException - if sym is not recognised

getCount

public double getCount(DistributionTrainerContext dtc,
                       AtomicSymbol sym)
                throws IllegalSymbolException
Deprecated. 
Description copied from interface: DistributionTrainer

Get the current count for this state.

This method may be called multiple times with the same symbol. Each time it should return the agregate of the counts added with addCount since the last invocation of clearCounts.

Specified by:
getCount in interface DistributionTrainer
Parameters:
dtc - the DistributionTrainerContext within which the count was added
sym - the Symbol seen
Returns:
the agregate of the counts
Throws:
IllegalSymbolException - if sym is not recognised

train

public void train(DistributionTrainerContext dtc,
                  double weight)
           throws ChangeVetoException
Deprecated. 
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
Parameters:
dtc - the context to use
weight - how many lots of the null model to add
Throws:
ChangeVetoException - if the distribution could not have its weights modified

clearCounts

public void clearCounts(DistributionTrainerContext dtc)
Deprecated. 
Description copied from interface: DistributionTrainer
Clears all of the counts to zero.

Specified by:
clearCounts in interface DistributionTrainer