Package org.biojava.bio.dist
Class IgnoreCountsTrainer
- java.lang.Object
-
- org.biojava.bio.dist.IgnoreCountsTrainer
-
- All Implemented Interfaces:
DistributionTrainer
public class IgnoreCountsTrainer extends Object implements DistributionTrainer
A distribution trainer that just ignores all counts.- Since:
- 1.0
- Author:
- Matthew Pocock
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IgnoreCountsTrainer()
Constructor intended for sub-classes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.static IgnoreCountsTrainer
getInstance()
Returns the global singleton instance of the IgnoreCountsTrainer.void
train(DistributionTrainerContext dtc, double weight)
Trains the Distribution, given a null model.
-
-
-
Constructor Detail
-
IgnoreCountsTrainer
protected IgnoreCountsTrainer()
Constructor intended for sub-classes.
-
-
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 interfaceDistributionTrainer
- Parameters:
dtc
- the DistributionTrainerContext within which the count was addedsym
- the Symbol seentimes
- 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 interfaceDistributionTrainer
- Parameters:
dtc
- the DistributionTrainerContext within which the count was addedsym
- the Symbol seen- Returns:
- the agregate of the counts
- Throws:
IllegalSymbolException
- if sym is not recognised
-
train
public void train(DistributionTrainerContext dtc, double weight)
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 interfaceDistributionTrainer
- Parameters:
dtc
- the context to useweight
- how many lots of the null model to add
-
clearCounts
public void clearCounts(DistributionTrainerContext dtc)
Description copied from interface:DistributionTrainer
Clears all of the counts to zero.- Specified by:
clearCounts
in interfaceDistributionTrainer
-
getInstance
public static IgnoreCountsTrainer getInstance()
Returns the global singleton instance of the IgnoreCountsTrainer.- Returns:
- the singleton instance of this trainer
-
-