mrftools.PairedDual module

Paired dual learner class

class mrftools.PairedDual.PairedDual(inference_type, bp_iter=2, warm_up=5)[source]

Bases: mrftools.Learner.Learner

Objects that learn with paired inner dual optimization.

learn(weights, optimizer=<function ada_grad>, callback=None, opt_args=None)[source]

Fit model parameters my jointly solving the full dual saddle-point objective that includes optimization over estimated expectations of output variables and latent variables as well as weight optimization.

Parameters:
  • weights – Initial weight vector. Can be used to warm start from a previous solution.
  • optimizer – gradient-based optimization function, as defined in opt.py
  • callback – callback function run during each iteration of the optimizer. The function receives the weights as input. Can be useful for diagnostics, live plotting, storing records, etc.
  • opt_args – optimization arguments. Usually a dictionary of parameter values
Returns:

learned weights