lppl  v2.0.0
Optimizer< V, O, Ts > Struct Template Reference

Optimizes a value function and returns the argmax value. More...

#include "query.hpp"

Inheritance diagram for Optimizer< V, O, Ts >:
Queryer< Optimizer, V, O, Ts... >

Public Types

using map_fn_t = std::function< V(record_t< DTypes< Ts... > > &, O &, double &w)>
 
using value_fn_t = std::function< double(record_t< DTypes< Ts... > > &, O &, double &w)>
 

Public Member Functions

 Optimizer (map_fn_t map_fn, value_fn_t value_fn)
 Construct a new Optimizer object. More...
 
void clear ()
 
emit ()
 
double optimum_value ()
 Returns the (approximate global) maximum of the value function. More...
 
void update (record_t< DTypes< Ts... >> &r, O output, double weight, inf_options_t opts)
 
- Public Member Functions inherited from Queryer< Optimizer, V, O, Ts... >
emit ()
 Emits the result of the query.
 
void update (record_t< DTypes< Ts... >> &r, O output, double weight, inf_options_t opts)
 Updates the state of the queryer. More...
 

Public Attributes

map_fn_t map_fn
 
opt
 
double value
 
value_fn_t value_fn
 

Detailed Description

template<typename V, typename O, typename... Ts>
struct Optimizer< V, O, Ts >

Optimizes a value function and returns the argmax value.

Given a stream of records \(r\), outputs \(o\), and computed log weights \(w\) from a posterior distribution \(p(z|x)\), a mapping \( v = m(r, o, w) \) from into the value type \(v\), and a value function \(V(r, o, w)\) into the reals, computes the (approximate global) maximum of \(V\) and returns \(v^* = \arg \max_{v = m(r, o, w)} V(r, o, w)\).

Template Parameters
VThe type returned by the mapping function
OThe output type of the probabilistic program
TsThe types of distributions in the probabilistic program

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