Fleet  0.0.9
Inference in the LOT
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t > Class Template Reference

#include <LOTHypothesis.h>

Inheritance diagram for LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >:
Inheritance graph
[legend]
Collaboration diagram for LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >:
Collaboration graph
[legend]

Public Types

typedef Bayesable< _datum_t, _data_t >::datum_t datum_t
 
typedef Bayesable< _datum_t, _data_t >::data_t data_t
 
using Grammar_t = _Grammar_t
 
using input_t = _input_t
 
using output_t = _output_t
 
using VirtualMachineState_t = _VirtualMachineState_t
 
- Public Types inherited from Bayesable< Args... >
typedef Args... datum_t
 
typedef std::vector< Args... > data_t
 

Public Member Functions

 LOTHypothesis ()
 
 LOTHypothesis (Node &x)
 
 LOTHypothesis (Node &&x)
 
 LOTHypothesis (std::string s)
 
 LOTHypothesis (const LOTHypothesis &c)
 
 LOTHypothesis (const LOTHypothesis &&c)
 
LOTHypothesisoperator= (const LOTHypothesis &c)
 
LOTHypothesisoperator= (const LOTHypothesis &&c)
 
virtual std::pair< this_t, double > propose () const override
 Default proposal is rational-rules style regeneration. More...
 
virtual this_t restart () const override
 This is used to restart chains, sampling from prior but ONLY for nodes that are can_resample. More...
 
Nodeget_value ()
 
const Nodeget_value () const
 
void set_value (Node &v)
 Set the value to v. (NOTE: This compiles into a program) More...
 
void set_value (Node &&v)
 
Grammar_tget_grammar () const
 
virtual double compute_prior () override
 Compute the prior – defaultly just the PCFG (grammar) prior. More...
 
virtual double compute_single_likelihood (const datum_t &datum) override
 
void compile ()
 
virtual void push_program (Program< VirtualMachineState_t > &s) override
 This puts the code from my node onto s. Used internally in e.g. recursion. More...
 
virtual std::string string (std::string prefix="") const override
 
virtual std::string string (std::string prefix, bool usedot) const
 
virtual size_t hash () const override
 
virtual bool operator== (const this_t &h) const override
 Equality is checked on equality of values; note that greater-than is still on posteriors. More...
 
virtual void complete () override
 Modify this hypothesis's value by filling in all the gaps. More...
 
virtual output_t callOne (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. (This uses a nullptr virtual machine pool, so will throw an error on flip) More...
 
virtual DiscreteDistribution< output_tcall (const input_t x, const output_t &err=output_t{})
 Run the virtual machine on input x, and marginalize over execution paths to return a distribution on outputs. Note that loader must be a program loader, and that is to handle recursion and other function calls. More...
 
virtual int neighbors () const override
 Count the number of neighbors that are possible. (This should be size_t but int is more convenient.) More...
 
virtual void expand_to_neighbor (int k) override
 Modify this hypothesis to become the k'th neighbor. NOTE This does not compile since it might not be complete. More...
 
virtual double neighbor_prior (int k) override
 What is the prior of the k'th neighbor? This does not need to return the full prior, only relative (among ks) More...
 
virtual bool is_evaluable () const override
 A node is "evaluable" if it is complete (meaning no null subnodes) More...
 
size_t recursion_count ()
 Count up how many times I use recursion – we keep a list of recursion here. More...
 
virtual std::string serialize () const override
 Convert this into a string which can be written to a file. More...
 
- Public Member Functions inherited from MCMCable< this_t, _datum_t, _data_t >
 MCMCable ()
 
virtual bool operator!= (const this_t &h) const
 
- Public Member Functions inherited from Bayesable< Args... >
 Bayesable ()
 
virtual double compute_single_likelihood (const datum_t &datum)
 Compute the likelihood of a single data point. More...
 
virtual void clear_bayes ()
 
virtual double compute_likelihood (const data_t &data, const double breakout=-infinity)
 Compute the likelihood of a collection of data, by calling compute_single_likelihood on each. This stops if our likelihood falls below breakout. More...
 
virtual double compute_posterior (const data_t &data, const std::pair< double, double > breakoutpair=std::make_pair(-infinity, 1.0))
 Compute the posterior, by calling prior and likelihood. This includes only a little bit of fanciness, which is that if our prior is -inf, then we don't both computing the likelihood. More...
 
virtual double at_temperature (double t) const
 
virtual bool operator< (const Bayesable< datum_t, data_t > &l) const
 
virtual void print (std::string prefix="")
 
- Public Member Functions inherited from Searchable< this_t, _input_t, _output_t >
virtual this_t make_neighbor (int k) const
 Return a new hypothesis which is the k'th neighbor (just calls expand_to_neighbor) NOTE This does not compile since it might not be complete. More...
 
- Public Member Functions inherited from ProgramLoader< _VirtualMachineState_t >
virtual void push_program (Program< _VirtualMachineState_t > &s, const short a)
 
virtual void push_program (Program< _VirtualMachineState_t > &s, const int a)
 
virtual void push_program (Program< _VirtualMachineState_t > &s, const std::string k)
 

Static Public Member Functions

static this_t sample ()
 
static this_t from_string (Grammar_t *g, std::string s)
 
static this_t deserialize (const std::string &s)
 Convert this from a string which was in a file. More...
 
- Static Public Member Functions inherited from MCMCable< this_t, _datum_t, _data_t >
static this_t sample ()
 Static function for making a hypothesis. Be careful using this with references because they may not foward right (for reasons that are unclear to me) More...
 
- Static Public Member Functions inherited from Serializable< this_t >
static this_t deserialize (const std::string &)
 

Public Attributes

unsigned long total_instruction_count_last_call
 
unsigned long total_vms_steps
 
Program< VirtualMachineState_tprogram
 
- Public Attributes inherited from Bayesable< Args... >
double prior
 
double likelihood
 
double posterior
 
uintmax_t born
 
size_t born_chain_idx
 
- Public Attributes inherited from ProgramLoader< _VirtualMachineState_t >
bool was_called
 

Static Public Attributes

static const char SerializationDelimiter = '\t'
 
static const size_t MAX_NODES = 64
 

Protected Attributes

Node value
 

Detailed Description

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
class LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >

Author
piantado
Date
05/05/20

Member Typedef Documentation

◆ data_t

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
typedef Bayesable<_datum_t,_data_t>::data_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::data_t

◆ datum_t

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
typedef Bayesable<_datum_t,_data_t>::datum_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::datum_t

◆ Grammar_t

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
using LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::Grammar_t = _Grammar_t

◆ input_t

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
using LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::input_t = _input_t

◆ output_t

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
using LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::output_t = _output_t

◆ VirtualMachineState_t

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
using LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::VirtualMachineState_t = _VirtualMachineState_t

Constructor & Destructor Documentation

◆ LOTHypothesis() [1/6]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::LOTHypothesis ( )
inline

◆ LOTHypothesis() [2/6]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::LOTHypothesis ( Node x)
inline

◆ LOTHypothesis() [3/6]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::LOTHypothesis ( Node &&  x)
inline

◆ LOTHypothesis() [4/6]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::LOTHypothesis ( std::string  s)
inline

◆ LOTHypothesis() [5/6]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::LOTHypothesis ( const LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t > &  c)
inline

◆ LOTHypothesis() [6/6]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::LOTHypothesis ( const LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t > &&  c)
inline

Member Function Documentation

◆ call()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual DiscreteDistribution<output_t> LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::call ( const input_t  x,
const output_t err = output_t{} 
)
inlinevirtual

Run the virtual machine on input x, and marginalize over execution paths to return a distribution on outputs. Note that loader must be a program loader, and that is to handle recursion and other function calls.

Parameters
x- input
err- output value on error
loader- where to load recursive calls
Returns

Reimplemented in MyHypothesis.

◆ callOne()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual output_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::callOne ( const input_t  x,
const output_t err = output_t{} 
)
inlinevirtual

A variant of call that assumes no stochasticity and therefore outputs only a single value. (This uses a nullptr virtual machine pool, so will throw an error on flip)

Parameters
x
err
Returns

◆ compile()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
void LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::compile ( )
inline

◆ complete()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual void LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::complete ( )
inlineoverridevirtual

Modify this hypothesis's value by filling in all the gaps.

Implements Searchable< this_t, _input_t, _output_t >.

Reimplemented in MyHypothesis.

◆ compute_prior()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual double LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::compute_prior ( )
inlineoverridevirtual

Compute the prior – defaultly just the PCFG (grammar) prior.

Returns

Implements Bayesable< Args... >.

Reimplemented in MyHypothesis, MyHypothesis, and MyHypothesis.

◆ compute_single_likelihood()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual double LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::compute_single_likelihood ( const datum_t datum)
inlineoverridevirtual

◆ deserialize()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
static this_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::deserialize ( const std::string &  s)
inlinestatic

Convert this from a string which was in a file.

Parameters
s
Returns

◆ expand_to_neighbor()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual void LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::expand_to_neighbor ( int  k)
inlineoverridevirtual

Modify this hypothesis to become the k'th neighbor. NOTE This does not compile since it might not be complete.

Parameters
k

Implements Searchable< this_t, _input_t, _output_t >.

Reimplemented in MyHypothesis.

◆ from_string()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
static this_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::from_string ( Grammar_t g,
std::string  s 
)
inlinestatic

◆ get_grammar()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
Grammar_t* LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::get_grammar ( ) const
inline

◆ get_value() [1/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
Node& LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::get_value ( )
inline

◆ get_value() [2/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
const Node& LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::get_value ( ) const
inline

◆ hash()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual size_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::hash ( ) const
inlineoverridevirtual

Implements Bayesable< Args... >.

Reimplemented in MyHypothesis.

◆ is_evaluable()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual bool LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::is_evaluable ( ) const
inlineoverridevirtual

A node is "evaluable" if it is complete (meaning no null subnodes)

Returns

Implements Searchable< this_t, _input_t, _output_t >.

◆ neighbor_prior()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual double LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::neighbor_prior ( int  k)
inlineoverridevirtual

What is the prior of the k'th neighbor? This does not need to return the full prior, only relative (among ks)

Parameters
k

Implements Searchable< this_t, _input_t, _output_t >.

◆ neighbors()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual int LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::neighbors ( ) const
inlineoverridevirtual

Count the number of neighbors that are possible. (This should be size_t but int is more convenient.)

Implements Searchable< this_t, _input_t, _output_t >.

◆ operator=() [1/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis& LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::operator= ( const LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t > &  c)
inline

◆ operator=() [2/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
LOTHypothesis& LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::operator= ( const LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t > &&  c)
inline

◆ operator==()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual bool LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::operator== ( const this_t &  h) const
inlineoverridevirtual

Equality is checked on equality of values; note that greater-than is still on posteriors.

Parameters
h
Returns

Implements MCMCable< this_t, _datum_t, _data_t >.

Reimplemented in MyHypothesis.

◆ propose()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual std::pair<this_t,double> LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::propose ( ) const
inlineoverridevirtual

Default proposal is rational-rules style regeneration.

Returns

Implements MCMCable< this_t, _datum_t, _data_t >.

Reimplemented in MyHypothesis, InnerHypothesis, and MyHypothesis.

◆ push_program()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual void LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::push_program ( Program< VirtualMachineState_t > &  s)
inlineoverridevirtual

This puts the code from my node onto s. Used internally in e.g. recursion.

Parameters
s
k

Reimplemented from ProgramLoader< _VirtualMachineState_t >.

◆ recursion_count()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
size_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::recursion_count ( )
inline

Count up how many times I use recursion – we keep a list of recursion here.

Returns

◆ restart()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual this_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::restart ( ) const
inlineoverridevirtual

This is used to restart chains, sampling from prior but ONLY for nodes that are can_resample.

Returns

Implements MCMCable< this_t, _datum_t, _data_t >.

Reimplemented in MyHypothesis.

◆ sample()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
static this_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::sample ( )
inlinestatic

◆ serialize()

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual std::string LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::serialize ( ) const
inlineoverridevirtual

Convert this into a string which can be written to a file.

Returns

Implements Serializable< this_t >.

◆ set_value() [1/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
void LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::set_value ( Node v)
inline

Set the value to v. (NOTE: This compiles into a program)

Parameters
v

◆ set_value() [2/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
void LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::set_value ( Node &&  v)
inline

◆ string() [1/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual std::string LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::string ( std::string  prefix = "") const
inlineoverridevirtual

Implements Bayesable< Args... >.

Reimplemented in MyHypothesis.

◆ string() [2/2]

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
virtual std::string LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::string ( std::string  prefix,
bool  usedot 
) const
inlinevirtual

Member Data Documentation

◆ MAX_NODES

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
const size_t LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::MAX_NODES = 64
static

◆ program

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
Program<VirtualMachineState_t> LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::program

◆ SerializationDelimiter

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
const char LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::SerializationDelimiter = '\t'
static

◆ total_instruction_count_last_call

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
unsigned long LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::total_instruction_count_last_call

◆ total_vms_steps

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
unsigned long LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::total_vms_steps

◆ value

template<typename this_t, typename _input_t, typename _output_t, typename _Grammar_t, _Grammar_t * grammar, typename _datum_t = defaultdatum_t<_input_t, _output_t>, typename _data_t = std::vector<_datum_t>, typename _VirtualMachineState_t = typename _Grammar_t::VirtualMachineState_t>
Node LOTHypothesis< this_t, _input_t, _output_t, _Grammar_t, grammar, _datum_t, _data_t, _VirtualMachineState_t >::value
protected

The documentation for this class was generated from the following file: