dist

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: MIT Imports: 3 Imported by: 11

Documentation

Overview

Package dist provides differentiatable distribution models. The package is automatically differentiated by deriv during build.

Index

Constants

This section is empty.

Variables

View Source
var Beta beta

Beta distribution, singleton instance.

View Source
var Expon expon

Exponential distribution, singleton instance.

View Source
var Gamma gamma

Gamma distribution, singleton instance.

View Source
var Normal normal

Normal distribution, singleton instance.

View Source
var SoftMax func(x, p []float64)

Outside of differentiated context, SoftMax can be used without distribution.

Functions

This section is empty.

Types

type Categorical added in v0.5.1

type Categorical struct {
	N int // number of categories
}

the categorical distribution

func (Categorical) Logp added in v0.5.1

func (dist Categorical) Logp(
	alpha []float64, y float64,
) float64

Logp computes logpdf of a single observation.

func (Categorical) Logps added in v0.5.1

func (dist Categorical) Logps(
	alpha []float64, ys ...float64,
) float64

Logps computes logpdf of a vector of observations.

func (Categorical) Observe added in v0.5.1

func (dist Categorical) Observe(x []float64) float64

Observe implements the Model interface

type Dirichlet

type Dirichlet struct {
	N int // number of dimensions
}

Dirichlet distribution

func (Dirichlet) Logp

func (dist Dirichlet) Logp(alpha []float64, y []float64) float64

Logp computes logpdf of a single observation.

func (Dirichlet) Logps

func (dist Dirichlet) Logps(alpha []float64, y ...[]float64) float64

Logps computes logpdf of a vector of observations.

func (Dirichlet) Observe

func (dist Dirichlet) Observe(x []float64) float64

Observe implements the Model interface. The parameters are alpha and observations, flattened.

func (Dirichlet) SoftMax

func (dist Dirichlet) SoftMax(x, p []float64)

SoftMax transforms unconstrained parameters to a point on the unit hyperplane suitable to be observed from Dirichlet. x is the original vector, p is a point on the unit hyperplane.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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