Back to godoc.org
bitbucket.org/dtolpin/infergo/model

package model

v0.8.4
Latest Go to latest
Published: Apr 8, 2020 | License: MIT | Module: bitbucket.org/dtolpin/infergo

Overview

Package model specifies the interface of a probabilistc model.

Index

func DropGradient

func DropGradient(m Model)

DropGradient can be called instead of Gradient when the gradient is not required. For automaticall differentated models DropGradient will pop the frame from the tape; for elemental models it will do nothing.

func Gradient

func Gradient(m Model) []float64

Gradient automatically selects either supplied or automatic gradient.

func Shift

func Shift(px *[]float64, n int) []float64

Shift shifts n parameters from x, useful for destructuring the parameter vector.

type ElementalModel

type ElementalModel interface {
	Model
	Gradient() []float64
}

An elemental model uses a supplied gradient instead of automatic differentation.

type Model

type Model interface {
	Observe(parameters []float64) float64
}

A probabilistic model must implement interface Model. Method Observe accepts a vector of parameters and returns the loglikelihood. Computation of the gradient is automatically induced through algorithmic differentiation.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier