|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.dist.SimpleDistributionTrainer
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.
Constructor Summary | |
SimpleDistributionTrainer(Distribution dis)
|
Method Summary | |
void |
addCount(DistributionTrainerContext dtc,
AtomicSymbol sym,
double count)
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleDistributionTrainer(Distribution dis) throws IllegalAlphabetException
Method Detail |
public void addCount(DistributionTrainerContext dtc, AtomicSymbol sym, double count) throws IllegalSymbolException
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.
addCount
in interface DistributionTrainer
dtc
- the DistributionTrainerContext within which the count was addedsym
- the Symbol seencount
- the number of times to add
IllegalSymbolException
public double getCount(DistributionTrainerContext dtc, AtomicSymbol sym) throws IllegalSymbolException
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.
getCount
in interface DistributionTrainer
dtc
- the DistributionTrainerContext within which the count was addedsym
- the Symbol seen
IllegalSymbolException
public void train(DistributionTrainerContext dtc, double weight) throws ChangeVetoException
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.
train
in interface DistributionTrainer
weight
- how many lots of the null model to add
ChangeVetoException
- if the distribution could not have its weights
modifiedpublic void clearCounts(DistributionTrainerContext dtc)
DistributionTrainer
clearCounts
in interface DistributionTrainer
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |