Documentation ¶
Overview ¶
Package infer contains inference algorithms: maximum likelihood estimation by gradient descent and approximation of the posterior by Markov Chain Monte Carlo methods (notably Hamiltonian Monte Carlo family of algorithms).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adam ¶
type Adam struct { Rate float64 // learning rate Beta1 float64 // first momentum factor Beta2 float64 // second momentum factor Eps float64 // stabilizer // contains filtered or unexported fields }
Adam (https://arxiv.org/abs/1412.6980).
type DepthAdapter ¶
type DepthAdapter struct { DualAveraging Depth float64 NAdpt int MinGrad float64 }
Parameters of adaptation to the target depth
type DualAveraging ¶
type DualAveraging struct {
Rate float64
}
Parameters of dual averaging.
func (*DualAveraging) Step ¶
func (da *DualAveraging) Step(t, x, gradSum float64) float64
Step implements Nesterov's primal-dual averaging, oversimplified.
chi = -gradSum/math.Sqrt(t) eta = Rate/t x = eta*chi + (1-eta)*x
type Grad ¶
Grad is the interface of gradient-based optimizers. Step makes a single step over parameters in the gradient direction.
type HMC ¶
type HMC struct { // Parameters L int // number of leapfrog steps Eps float64 // leapfrog step size // contains filtered or unexported fields }
Vanilla Hamiltonian Monte Carlo Sampler.
type Momentum ¶
type Momentum struct { Rate float64 //learning rate Decay float64 // rate decay Gamma float64 // gradient momentum factor // contains filtered or unexported fields }
Gradient ascent with momentum (https://www.nature.com/articles/323533a0). If the momentum factor is not set, and thus 0, reduces to vanilla gradient ascent.
type NUTS ¶
type NUTS struct { // Parameters Eps float64 // step size Delta float64 // lower bound on energy for doubling MaxDepth int // maximum depth // Statistics // Depth belief is encoded as a vector of beta-bernoulli // distributions. If the depth is greater than the element's // index i, Depth[i][0] is incremented; for index depth, // Depth[depth][1] is incremented. Depth [][2]float64 // depth belief // contains filtered or unexported fields }
No U-Turn Sampler (https://arxiv.org/abs/1111.4246).