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, wait
getLogTargetProbability
public 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)
RuleWeighting
getLogProbability
in interface RuleWeighting
public void prepareProbability(int state)
RuleWeighting
prepareProbability
in interface RuleWeighting
public double getStateStartLogProbability(int position)
RuleWeighting
getStateStartLogProbability
in interface RuleWeighting
public void prepareStartProbability()
RuleWeighting
prepareStartProbability
in interface RuleWeighting
public void reset()
RuleWeighting
reset
in interface RuleWeighting
public void adapt(TreeSample<Rule> treSamp, boolean deterministic)
RuleWeighting
adapt
in interface RuleWeighting
deterministic
- indicates whether we can assume the underlying
automaton to be unambiguous.public TreeAutomaton getAutomaton()
RuleWeighting
getAutomaton
in interface RuleWeighting
public int getNumberOfStartStates()
RuleWeighting
getNumberOfStartStates
in interface RuleWeighting
public int getStartStateByNumber(int number)
RuleWeighting
getStartStateByNumber
in interface RuleWeighting
public int getRuleNumber(int state, double choicePoint)
RuleWeighting
getRuleNumber
in interface RuleWeighting
public Rule getRuleByNumber(int state, int number)
RuleWeighting
getRuleByNumber
in interface RuleWeighting
public int getStartStateNumber(double choicePoint)
RuleWeighting
getStartStateNumber
in interface RuleWeighting
public double getLogProbability(Rule r)
RuleWeighting
getLogProbability
in interface RuleWeighting
Copyright © 2017. All rights reserved.