![]() |
Fleet
0.0.9
Inference in the LOT
|
Functions | |
double | can_resample (const Node &n) |
Helper function for whether we can resample from a node (just accesses n.can_resample) More... | |
template<typename GrammarType > | |
std::optional< std::pair< Node, double > > | prior_proposal (GrammarType *grammar, const Node &from) |
template<typename GrammarType > | |
double | p_regeneration_propose_to (GrammarType *grammar, const Node &a, const Node &b) |
Probability of proposing from a to b under regeneration. More... | |
template<typename GrammarType > | |
std::optional< std::pair< Node, double > > | regenerate (GrammarType *grammar, const Node &from) |
A little helper function that resamples everything below when we can. If we can't, then we'll recurse. More... | |
template<typename GrammarType , int D> | |
std::optional< std::pair< Node, double > > | regenerate_shallow (GrammarType *grammar, const Node &from) |
Regenerate with rational-rules style proposals, but only allow proposals to trees with a max depth of D. This encourages smaller changes, but also gets you stuck pretty bad in local maxima since you can't take big hops. Probably will work best with restarts. More... | |
template<typename GrammarType > | |
std::optional< std::pair< Node, double > > | insert_tree (GrammarType *grammar, const Node &from) |
template<typename GrammarType > | |
std::optional< std::pair< Node, double > > | delete_tree (GrammarType *grammar, const Node &from) |
template<typename GrammarType > | |
std::optional< std::pair< Node, double > > | sample_function_leaving_args (GrammarType *grammar, const Node &from) |
This samples functions f(a,b) -> g(a,b) (e.g. without destroying what's below). This uses a little trick that the node only stores the rule, so we can swap it out if we want. More... | |
template<typename GrammarType > | |
std::optional< std::pair< Node, double > > | swap_args (GrammarType *grammar, const Node &from) |
This propose swaps around arguments of the same type. More... | |
double Proposals::can_resample | ( | const Node & | n | ) |
Helper function for whether we can resample from a node (just accesses n.can_resample)
n | - what node are we asking about? |
std::optional<std::pair<Node, double> > Proposals::delete_tree | ( | GrammarType * | grammar, |
const Node & | from | ||
) |
backward is we choose the new s, then generate everything else, and choose anything equal
std::optional<std::pair<Node, double> > Proposals::insert_tree | ( | GrammarType * | grammar, |
const Node & | from | ||
) |
backward is we choose t exactly, then we pick anything below that is equal to s
double Proposals::p_regeneration_propose_to | ( | GrammarType * | grammar, |
const Node & | a, | ||
const Node & | b | ||
) |
Probability of proposing from a to b under regeneration.
grammar | |
a | |
b |
std::optional<std::pair<Node,double> > Proposals::prior_proposal | ( | GrammarType * | grammar, |
const Node & | from | ||
) |
std::optional<std::pair<Node,double> > Proposals::regenerate | ( | GrammarType * | grammar, |
const Node & | from | ||
) |
A little helper function that resamples everything below when we can. If we can't, then we'll recurse.
grammar | |
from | Regenerate with a rational-rules (Goodman et al.) style regeneration proposal: pick a node uniformly and regenerate it from the grammar. |
grammar | - what grammar to use |
from | - what node are we proposing from |
std::optional<std::pair<Node,double> > Proposals::regenerate_shallow | ( | GrammarType * | grammar, |
const Node & | from | ||
) |
Regenerate with rational-rules style proposals, but only allow proposals to trees with a max depth of D. This encourages smaller changes, but also gets you stuck pretty bad in local maxima since you can't take big hops. Probably will work best with restarts.
grammar | |
from |
std::optional<std::pair<Node,double> > Proposals::sample_function_leaving_args | ( | GrammarType * | grammar, |
const Node & | from | ||
) |
This samples functions f(a,b) -> g(a,b) (e.g. without destroying what's below). This uses a little trick that the node only stores the rule, so we can swap it out if we want.
grammar | |
from |