gibbs

package
v0.0.0-...-d568a9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Infer

func Infer(model []GibbsSample, burnin, thinning int) []variable.RandomVariable

Select values for all latent variables using Gibbs sampling. We iterate over the model in the provided order. We run `burnin` iterations to allow the model to become calibrated, and then sample each variable in turn with `thinning` full rounds of sampling in between each variable's draw. Returns the sampled values for all variables, in the same order as specified in `model.`

Types

type DistSampler

type DistSampler struct {
	Dist dist.Dist
}

DistSampler is a ValueSampler which samples from some distribution.

func (DistSampler) SampleValue

func (sampler DistSampler) SampleValue(v variable.RandomVariable, factors []factor.Factor)

type GibbsSample

type GibbsSample struct {
	Variable variable.RandomVariable
	Factors  []factor.Factor
	Sampler  ValueSampler
}

Indicates that a particular variable should be sampled with a particular sampler in the order provided to InferByGibbsSampling().

type ProdValueSampler

type ProdValueSampler struct{}

A ValueSampler which samples discrete values in proportion to the product of all factors.

func (ProdValueSampler) SampleValue

func (sampler ProdValueSampler) SampleValue(v variable.RandomVariable, factors []factor.Factor)

type ValueSampler

type ValueSampler interface {
	SampleValue(v variable.RandomVariable, factors []factor.Factor)
}

A ValueSampler samples a new value for a random variable based on the scores of its adjacent factors. The variable's value is updated in the process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL