org.biojava.bio.dp
Class AbstractTrainer

java.lang.Object
  extended by org.biojava.bio.dp.AbstractTrainer
All Implemented Interfaces:
TrainingAlgorithm
Direct Known Subclasses:
BaumWelchSampler, BaumWelchTrainer

public abstract class AbstractTrainer
extends Object
implements TrainingAlgorithm

An abstract implementation of TrainingAlgorithm that provides a framework for plugging in per-cycle code for parameter optimization.

Author:
Matthew Pocock, Thomas Down

Constructor Summary
protected AbstractTrainer()
           
  AbstractTrainer(DP dp)
           
 
Method Summary
 double getCurrentScore()
           
 int getCycle()
           
 DP getDP()
           
 double getLastScore()
           
protected abstract  double singleSequenceIteration(ModelTrainer trainer, SymbolList symList)
           
 void train(SequenceDB db, double nullModelWeight, StoppingCriteria stopper)
          Trains the sequences in db until stopper says to finnish.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTrainer

public AbstractTrainer(DP dp)

AbstractTrainer

protected AbstractTrainer()
Method Detail

getLastScore

public double getLastScore()
Specified by:
getLastScore in interface TrainingAlgorithm

getCurrentScore

public double getCurrentScore()
Specified by:
getCurrentScore in interface TrainingAlgorithm

getCycle

public int getCycle()
Specified by:
getCycle in interface TrainingAlgorithm

getDP

public DP getDP()
Specified by:
getDP in interface TrainingAlgorithm

singleSequenceIteration

protected abstract double singleSequenceIteration(ModelTrainer trainer,
                                                  SymbolList symList)
                                           throws IllegalSymbolException,
                                                  IllegalTransitionException,
                                                  IllegalAlphabetException
Throws:
IllegalSymbolException
IllegalTransitionException
IllegalAlphabetException

train

public void train(SequenceDB db,
                  double nullModelWeight,
                  StoppingCriteria stopper)
           throws IllegalSymbolException,
                  BioException
Trains the sequences in db until stopper says to finnish.

Specified by:
train in interface TrainingAlgorithm
Throws:
IllegalSymbolException
BioException