|
Parsing Engine | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanbikel.parser.Model
danbikel.parser.InterpolatedKnesserNeyModel
public class InterpolatedKnesserNeyModel
Implements a model that uses interpolated Knesser-Ney smoothing.
| Field Summary | |
|---|---|
protected double |
optimalDiscountEstimate
|
| Constructor Summary | |
|---|---|
InterpolatedKnesserNeyModel(ProbabilityStructure structure)
Constructs a Model instance that uses interpolated Knesser-Ney
smoothing instead of the default smoothing method when estimating
probabilities. |
|
| Method Summary | |
|---|---|
void |
deriveCounts(CountsTable trainerCounts,
Filter filter,
double threshold,
FlexibleMap canonical,
boolean deriveOtherModelCounts)
Derives all counts from the specified counts table, using the probability structure specified in the constructor. |
protected double |
estimateProb(ProbabilityStructure probStructure,
TrainerEvent event)
Returns the smoothed probability estimate of a transition contained in the specified TrainerEvent object. |
protected void |
precomputeProbs(MapToPrimitive.Entry transEntry,
double[] lambdas,
double[] estimates,
Transition[] transitions,
Event[] histories,
int lastLevel)
Precomputes the probabilities and smoothing values for the Transition object contained as a key within the specified
map entry, where the value is the count of the transition. |
protected void |
precomputeProbs(TrainerEvent event,
Transition[] transitions,
Event[] histories)
Deprecated. This method is called by Model.precomputeProbs(CountsTable,Filter), which is also deprecated. |
protected void |
storePrecomputedProbs(double[] lambdas,
double[] estimates,
Transition[] transitions,
Event[] histories,
int lastLevel)
Stores the specified smoothing values (lambdas) and smoothed probability estimates in the Model.precomputedProbs and Model.smoothingParams
map arrays. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected double optimalDiscountEstimate
| Constructor Detail |
|---|
public InterpolatedKnesserNeyModel(ProbabilityStructure structure)
Model instance that uses interpolated Knesser-Ney
smoothing instead of the default smoothing method when estimating
probabilities.
structure - the probability structure for which this model will
estimate probabilities| Method Detail |
|---|
public void deriveCounts(CountsTable trainerCounts,
Filter filter,
double threshold,
FlexibleMap canonical,
boolean deriveOtherModelCounts)
Model
deriveCounts in class ModeltrainerCounts - a map from TrainerEvent objects to
their counts (as doubles) from which to derive countsfilter - used to filter out TrainerEvent objects
whose derived counts should not be derived for this modelthreshold - a (currently unused) count cut-off thresholdcanonical - a reflexive map used to canonicalize objects
created when deriving countsderiveOtherModelCounts - an unused parameter, as this class
does not contain other, internal Model instances
protected double estimateProb(ProbabilityStructure probStructure,
TrainerEvent event)
TrainerEvent object. The smoothing method employed
will be the interpolated version of Knesser-Ney.
estimateProb in class ModelprobStructure - a ProbabilityStructure object that is
either Model.structure or a copy of it, used for
temporary storage during the computation performed by
this methodevent - the TrainerEvent containing a transition
from a history to a future whose smoothed probability
is to be computed
TrainerEvent object
protected void precomputeProbs(MapToPrimitive.Entry transEntry,
double[] lambdas,
double[] estimates,
Transition[] transitions,
Event[] histories,
int lastLevel)
ModelTransition object contained as a key within the specified
map entry, where the value is the count of the transition.
precomputeProbs in class ModeltransEntry - a map entry mapping a Transition
object to its count (a double)lambdas - an array in which to store the smoothing value for
each of the back-off levelsestimates - an array in which to store the maximum-likelihood
estimate at each of the back-off levelstransitions - an array in which to store the Transition
instance for each of the back-off levelshistories - an array in which to store the history, an
Event instance, for each of the back-off levelslastLevel - the last back-off level (the value equal to
Model.numLevels - 1)Model.precomputeProbs()
protected void storePrecomputedProbs(double[] lambdas,
double[] estimates,
Transition[] transitions,
Event[] histories,
int lastLevel)
ModelModel.precomputedProbs and Model.smoothingParams
map arrays.
storePrecomputedProbs in class Modellambdas - an array containing the smoothing value for each of the
back-off levelsestimates - an array containing the maximum-likelihood estimate at
each of the back-off levelstransitions - an array containing the Transition
instance for each of the back-off levelshistories - an array in which to store the history, an
Event instance, for each of the back-off levelslastLevel - the last back-off level (the value equal to
Model.numLevels - 1)Model.precomputeProbs()
protected void precomputeProbs(TrainerEvent event,
Transition[] transitions,
Event[] histories)
Model.precomputeProbs(CountsTable,Filter), which is also deprecated.
precomputeProbs in class Modelevent - the TrainerEvent object from which probabilities
are to be precomputedtransitions - temporary storage to be used during an invocation
of this methodhistories - temporary storage to be used during an invocation
of this method
|
Parsing Engine | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||