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 ¶
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.