11 defaultdatum_t<BindingTree*,std::string>,
28 InnerHypothesis&
operator=(
const InnerHypothesis& c) {
30 CachedCallHypothesis::operator=(c);
33 InnerHypothesis&
operator=(
const InnerHypothesis&& c) {
35 CachedCallHypothesis::operator=(c);
60 [[nodiscard]]
virtual std::optional<std::pair<InnerHypothesis,double>>
propose()
const override {
62 std::optional<std::pair<Node,double>> p;
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 tr...
Definition: Proposers.h:331
void set_value(Node &v)
Definition: InnerHypothesis.h:39
LOTHypothesis< InnerHypothesis, BindingTree *, bool, MyGrammar, grammar, defaultdatum_t< BindingTree *, bool >, std::vector< defaultdatum_t< BindingTree *, bool > >, typename MyGrammar ::VirtualMachineState_t > Super
Definition: DeterministicLOTHypothesis.h:17
virtual double compute_prior() override
Compute the prior – defaultly just the PCFG (grammar) prior.
Definition: InnerHypothesis.h:53
void set_value(Node &v, bool should_compile=true)
Set the value to v. (NOTE: This compiles into a program)
Definition: LOTHypothesis.h:168
Super::output_t output_t
Definition: DeterministicLOTHypothesis.h:21
virtual std::optional< std::pair< InnerHypothesis, double > > propose() const override
Default proposal is rational-rules style regeneration.
Definition: InnerHypothesis.h:60
Node value
Definition: LOTHypothesis.h:72
Definition: InnerHypothesis.h:9
double prior
Definition: Bayesable.h:42
virtual output_t call(const input_t x, const output_t &err=output_t{})
A variant of call that assumes no stochasticity and therefore outputs only a single value...
Definition: DeterministicLOTHypothesis.h:32
InnerHypothesis & operator=(const InnerHypothesis &c)
Definition: InnerHypothesis.h:28
bool flip(float p=0.5)
Definition: Random.h:25
input_t input
Definition: Datum.h:22
Definition: CachedCallHypothesis.h:14
std::optional< std::pair< Node, double > > delete_tree(GrammarType *grammar, const Node &from)
Definition: Proposers.h:275
void set_value(Node &&v)
Definition: InnerHypothesis.h:43
void clear_cache()
Definition: CachedCallHypothesis.h:23
constexpr double infinity
Definition: Numerics.h:20
Definition: DeterministicLOTHypothesis.h:14
Grammar_t * get_grammar() const
Definition: LOTHypothesis.h:179
InnerHypothesis & operator=(const InnerHypothesis &&c)
Definition: InnerHypothesis.h:33
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.
Definition: Proposers.h:107
double log_probability(const Node &n) const
This computes the expected length of productions from this grammar, counting terminals and nontermina...
Definition: Grammar.h:849
InnerHypothesis(const InnerHypothesis &&c)
Definition: InnerHypothesis.h:26
This is a hypothesis that allows you to cache an entire call on data. NOTE: This only catches std::ex...
LOTHypothesis & operator=(const LOTHypothesis &c)
Definition: LOTHypothesis.h:100
InnerHypothesis(const InnerHypothesis &c)
Definition: InnerHypothesis.h:25
std::optional< std::pair< Node, double > > insert_tree(GrammarType *grammar, const Node &from)
Definition: Proposers.h:192
const double MAX_NODES
Definition: InnerHypothesis.h:20
Super::output_t output_t
Definition: InnerHypothesis.h:22
Bayesable< defaultdatum_t< BindingTree *, bool >, std::vector< defaultdatum_t< BindingTree *, bool > > >::data_t data_t
Definition: LOTHypothesis.h:48
virtual bool cached_call_wrapper(const defaultdatum_t< BindingTree *, std::string > &di) override
This is how we access the data before calling – needed to say how this interfaces with the data...
Definition: InnerHypothesis.h:48
std::optional< std::pair< Node, double > > swap_args(GrammarType *grammar, const Node &from)
This propose swaps around arguments of the same type.
Definition: Proposers.h:389
virtual size_t count() const
How many nodes total are below me?
Definition: BaseNode.h:358
Super::data_t data_t
Definition: InnerHypothesis.h:23