Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.dist
Class SimpleDistribution.Trainer

    java.lang.Object
      org.biojava.bio.dist.SimpleDistribution.Trainer

All Implemented Interfaces:
  DistributionTrainer

Enclosing class:
  SimpleDistribution

    protected class SimpleDistribution.Trainer

extends Object
implements DistributionTrainer

A simple implementation of a trainer for this class.

Since:
  1.0
Author:
  Matthew Pocock

Constructor Summary
`SimpleDistribution.Trainer()` Create a new trainer.

Method Summary
`void` | `addCount(DistributionTrainerContext dtc, AtomicSymbol sym, double times)` Registers that sym was counted in this state.
`void` | `clearCounts(DistributionTrainerContext dtc)` Clears all of the counts to zero.
`double` | `getCount(DistributionTrainerContext dtc, AtomicSymbol sym)` Get the current count for this state.
`void` | `train(DistributionTrainerContext dtc, double weight)` Trains the Distribution, given a null model.
`protected void` | `trainImpl(DistributionTrainerContext dtc, double weight)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleDistribution.Trainer

    public SimpleDistribution.Trainer()

  Create a new trainer.

Method Detail

### addCount

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

### getCount

    public double getCount(DistributionTrainerContext dtc,
                           AtomicSymbol sym)
                    throws IllegalSymbolException

  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

### clearCounts

    public void clearCounts(DistributionTrainerContext dtc)

  Description copied from interface: `DistributionTrainer`
  Clears all of the counts to zero.

  Specified by:
    `clearCounts` in interface `DistributionTrainer`

### train

    public void train(DistributionTrainerContext dtc,
                      double weight)
               throws ChangeVetoException

  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

### trainImpl

    protected void trainImpl(DistributionTrainerContext dtc,
                             double weight)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD