## org.biojava.bio.dist
Class SimpleDistributionTrainerContext

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

Direct Known Subclasses:
  SimpleModelTrainer

public class SimpleDistributionTrainerContext
extends java.lang.Object
implements DistributionTrainerContext, java.io.Serializable

A no-frills implementation of DistributionTrainerContext.

Author:
  Matthew Pocock
See Also:
  Serialized Form

Constructor Summary
`SimpleDistributionTrainerContext()`

Method Summary
`void` `addCount(Distribution dist, Symbol sym, double times)` Registers that sym was counted in this state.
`void` `clearDistributionCounts()` Clears all of the counts to zero.
`DistributionTrainer` `getDistributionTrainer(Distribution dist)` Return the Distribution trainer object from the current context.
`Distribution` `getNullModel()` Retrieve the background distribution
`double` `getNullModelWeight()` Retrieve the weight of the background distribution
`void` `registerDistribution(Distribution dist)` Register a distribution object
`void` `registerDistributionTrainer(Distribution dist, DistributionTrainer trainer)` Register a distribution and an associated distributiontrainer object
`void` `setNullModel(Distribution nullModel)` Assign a background distribution
`void` `setNullModelWeight(double nullModelWeight)` Assign a weight to the background distribution
`void` `trainDistributions()` 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

### SimpleDistributionTrainerContext

    public SimpleDistributionTrainerContext()

Method Detail

### getNullModel

    public Distribution getNullModel()

  Retrieve the background distribution

### setNullModel

    public void setNullModel(Distribution nullModel)

  Assign a background distribution
  Parameters:
    `nullModel` - the background distribution to assign

### getNullModelWeight

    public double getNullModelWeight()

  Retrieve the weight of the background distribution

### setNullModelWeight

    public void setNullModelWeight(double nullModelWeight)

  Assign a weight to the background distribution
  Parameters:
    `nullModelWeight` - the weight of the null model to assign.

### registerDistribution

    public void registerDistribution(Distribution dist)

  Description copied from interface: DistributionTrainerContext
  Register a distribution object
  Specified by:
    registerDistribution in interface DistributionTrainerContext

### registerDistributionTrainer

    public void registerDistributionTrainer(Distribution dist,
                                            DistributionTrainer trainer)

  Description copied from interface: DistributionTrainerContext
  Register a distribution and an associated distributiontrainer object
  Specified by:
    registerDistributionTrainer in interface DistributionTrainerContext
  Tags copied from interface: DistributionTrainerContext
  Parameters:
    `dist` - the distribution to be registered.
    `trainer` - the distribution's trainer object to be registered.

### getDistributionTrainer

    public DistributionTrainer getDistributionTrainer(Distribution dist)

  Description copied from interface: DistributionTrainerContext
  Return the Distribution trainer object from the current context.
  Specified by:
    getDistributionTrainer in interface DistributionTrainerContext
  Tags copied from interface: DistributionTrainerContext
  Parameters:
    `dist` - the Distribution whose trainer is required.

### addCount

    public void addCount(Distribution dist,
                         Symbol sym,
                         double times)
                  throws IllegalSymbolException

  Description copied from interface: DistributionTrainerContext
  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 DistributionTrainerContext
  Tags copied from interface: DistributionTrainerContext
  Parameters:
    `dist` - the Distribution that the symbol was associated with
    `sym` - the Symbol seen
    `times` - the number of times to add

### trainDistributions

    public void trainDistributions()
                            throws IllegalSymbolException

  Description copied from interface: DistributionTrainerContext
  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.

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

### clearDistributionCounts

    public void clearDistributionCounts()

  Description copied from interface: DistributionTrainerContext
  Clears all of the counts to zero.
  Specified by:
    clearDistributionCounts in interface DistributionTrainerContext