public abstract class RegularizedKLRuleWeighting extends Object implements RuleWeighting
| Modifier and Type | Field and Description |
|---|---|
static double |
ALMOST_ZERO
The threshold for when we consider a number close enough to 0.0 to
pick a choice point.
|
| Constructor and Description |
|---|
RegularizedKLRuleWeighting(TreeAutomaton basis,
int regularizationExponent,
double regularizationDivisor,
LearningRate rate)
Creates a new instance with the regularization given by the specified values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
adapt(TreeSample<Rule> treSamp,
boolean deterministic)
Adapts the proposal distribution with the assumption that
treSamp is an importance sample generated from this proposal distribution.
|
TreeAutomaton |
getAutomaton()
Returns the underlying tree automaton from which the rules and start
states are drawn.
|
double |
getLogProbability(int state,
int ruleNumber)
Returns the log of the probability of choosing the rule identified by the number given the state.
|
double |
getLogProbability(Rule r)
Returns the proposal probability of the given rule given its parent.
|
int |
getNumberOfStartStates()
Returns the overall number of start states available.
|
Rule |
getRuleByNumber(int state,
int number)
Returns the rule identified by the given state and number.
|
int |
getRuleNumber(int state,
double choicePoint)
Returns the number of the first rule such that the cumulative probability of
the earlier rules plus this one is larger than choicePoint.
|
int |
getStartStateByNumber(int number)
Returns the start state with the given number.
|
int |
getStartStateNumber(double choicePoint)
Returns the start first start state such that the cumulative probability
of earlier start states plus this one is larger than choicePoint.
|
double |
getStateStartLogProbability(int position)
Returns the log of the proposal probability of the given start state.
|
void |
prepareProbability(int state)
Tells the class to recompute the proposal probabilities for the rules of the given state.
|
void |
prepareStartProbability()
Recomputes the proposal probabilities for the start states.
|
void |
reset()
Resets any adaption of the proposal distribution.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLogTargetProbabilitypublic static double ALMOST_ZERO
public RegularizedKLRuleWeighting(TreeAutomaton basis, int regularizationExponent, double regularizationDivisor, LearningRate rate)
basis - regularizationExponent - regularizationDivisor - rate - public double getLogProbability(int state,
int ruleNumber)
RuleWeightinggetLogProbability in interface RuleWeightingpublic void prepareProbability(int state)
RuleWeightingprepareProbability in interface RuleWeightingpublic double getStateStartLogProbability(int position)
RuleWeightinggetStateStartLogProbability in interface RuleWeightingpublic void prepareStartProbability()
RuleWeightingprepareStartProbability in interface RuleWeightingpublic void reset()
RuleWeightingreset in interface RuleWeightingpublic void adapt(TreeSample<Rule> treSamp, boolean deterministic)
RuleWeightingadapt in interface RuleWeightingdeterministic - indicates whether we can assume the underlying
automaton to be unambiguous.public TreeAutomaton getAutomaton()
RuleWeightinggetAutomaton in interface RuleWeightingpublic int getNumberOfStartStates()
RuleWeightinggetNumberOfStartStates in interface RuleWeightingpublic int getStartStateByNumber(int number)
RuleWeightinggetStartStateByNumber in interface RuleWeightingpublic int getRuleNumber(int state,
double choicePoint)
RuleWeightinggetRuleNumber in interface RuleWeightingpublic Rule getRuleByNumber(int state, int number)
RuleWeightinggetRuleByNumber in interface RuleWeightingpublic int getStartStateNumber(double choicePoint)
RuleWeightinggetStartStateNumber in interface RuleWeightingpublic double getLogProbability(Rule r)
RuleWeightinggetLogProbability in interface RuleWeightingCopyright © 2017. All rights reserved.