calhoun.analysis.crf.solver
Class CacheProcessorDeluxe
java.lang.Object
calhoun.analysis.crf.solver.CacheProcessorBasic
calhoun.analysis.crf.solver.CacheProcessorDeluxe
- All Implemented Interfaces:
- CacheProcessor
public class CacheProcessorDeluxe
- extends CacheProcessorBasic
A policy based cache processor. This is the main cache processor used. It uses the cache
policies specified by the feature managers to efficent cache all feature values.
The distinct caching strategies recognized by this CacheProcessor are:
COMPOSITE - must drill down further to a non-composite FeatureManager to learn the strategy
CONSTANT - Triplets (potential, featureIndex, value) that do not depend on position
DENSE - Triplets (potential, featureIndex, lookupTable), where lookupTable is of size totalPositions and different
doublets (potential, featureIndex), if they always have the same value, can share the same lookupTable to save space.
SPARSE - Quadruplets (cumulativePosition, potential, featureIndex, value) of nonzero evaluation stored in order first by cumulativePosition,
and then arbitrarily, similar to the way the previous "FeatureCache" worked but without need to sub-order by potentials in "model order".
LENGTHFUNCTION - Quadruplets (length, state, featureIndex, value).
Otherwise, treated as SPARSE
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
invalidTransitions
public boolean[] invalidTransitions
CacheProcessorDeluxe
public CacheProcessorDeluxe()
CacheProcessorDeluxe
public CacheProcessorDeluxe(CacheStrategySpec.CacheStrategy strategy)
setTrainingData
public void setTrainingData(ModelManager fm,
java.util.List<? extends TrainingSequence<?>> data)
- Specified by:
setTrainingData in interface CacheProcessor- Overrides:
setTrainingData in class CacheProcessorBasic
checkConstraintsInTrainingData
public void checkConstraintsInTrainingData()
evaluatePosition
public void evaluatePosition(int seq,
int pos)
evaluateSegmentsEndingAt
public void evaluateSegmentsEndingAt(int seq,
int pos)
- The job of this function is to update the table "LengthFeatureEvaluation[][] lengthEvals"
The first dimension is index by those states which have at least one explicit length node feature,
corresponding to the state of an interval which ends at position currently under consideration.
The size of this dimension is predetermined and is equal to modelInfo.statesWithLookback.length
The second dimension is the length of the lookback, i.e. how many bases is
the length of interval currently being considered. The size of this dimension is variable, and
after the last of which one inserts a LengthFeatureEvaluation whose lookback is -1
A LengthFeatureEvaluation contains the lookback and a FeatureEvaluation for nodes, plus and
edgeEvaluation (which for now we set to null). The FeatureEvaluations we have seen before;
they are comprised of index and value arrays, which are of variable length,
and after last entry you put a -1 in the index array.
getInvalidTransitions
public boolean[] getInvalidTransitions()
setSemiMarkovSetup
public void setSemiMarkovSetup(SemiMarkovSetup setup)
isAllPaths
public boolean isAllPaths()
setAllPaths
public void setAllPaths(boolean allPaths)
getLookbackArrayFeatureSize
public int getLookbackArrayFeatureSize()
- Returns:
- Returns the lookbackArrayFeatureSize.
setLookbackArrayFeatureSize
public void setLookbackArrayFeatureSize(int lookbackArrayFeatureSize)
- Parameters:
lookbackArrayFeatureSize - The lookbackArrayFeatureSize to set.
getLookbackArraySize
public int getLookbackArraySize()
- Returns:
- Returns the lookbackArraySize.
setLookbackArraySize
public void setLookbackArraySize(int lookbackArraySize)
- Parameters:
lookbackArraySize - The lookbackArraySize to set.
isIgnoreInvalidTrainingData
public boolean isIgnoreInvalidTrainingData()
setIgnoreInvalidTrainingData
public void setIgnoreInvalidTrainingData(boolean ignoreInvalidTrainingData)