prob-fx-0.1.0.2: A library for modular probabilistic modelling
Safe HaskellNone
LanguageHaskell2010

PrimDist

Description

A GADT encoding of (a selection of) primitive distributions along with their corresponding sampling and density functions.

Synopsis

Primitive distribution

data PrimDist a where Source #

Primitive distribution

Constructors

BernoulliDist 

Fields

BetaDist 

Fields

BinomialDist 

Fields

CategoricalDist 

Fields

CauchyDist 

Fields

HalfCauchyDist 

Fields

DeterministicDist 

Fields

DirichletDist 

Fields

DiscreteDist 

Fields

DiscrUniformDist 

Fields

GammaDist 

Fields

NormalDist 

Fields

HalfNormalDist 

Fields

PoissonDist 

Fields

UniformDist 

Fields

Instances

Instances details
Eq (PrimDist a) Source # 
Instance details

Defined in PrimDist

Methods

(==) :: PrimDist a -> PrimDist a -> Bool #

(/=) :: PrimDist a -> PrimDist a -> Bool #

Show a => Show (PrimDist a) Source # 
Instance details

Defined in PrimDist

Methods

showsPrec :: Int -> PrimDist a -> ShowS #

show :: PrimDist a -> String #

showList :: [PrimDist a] -> ShowS #

type PrimVal = '[Int, Double, [Double], Bool, String] Source #

An ad-hoc specification of primitive value types, for constraining the outputs of distributions

data IsPrimVal x where Source #

Proof that x is a primitive value

Constructors

IsPrimVal :: (Show x, Member x PrimVal) => IsPrimVal x 

pattern PrimDistPrf :: () => (Show x, Member x PrimVal) => PrimDist x -> PrimDist x Source #

For pattern-matching on an arbitrary PrimDist with proof that it generates a primitive value

data ErasedPrimDist where Source #

For erasing the types of primitive distributions

Constructors

ErasedPrimDist :: forall a. Show a => PrimDist a -> ErasedPrimDist 

Instances

Instances details
Show ErasedPrimDist Source # 
Instance details

Defined in PrimDist

Sampling

sample :: PrimDist a -> Sampler a Source #

Draw a value from a primitive distribution in the Sampler monad

Density

prob Source #

Arguments

:: PrimDist a

distribution

-> a

observed value

-> Double

density

Compute the density of a primitive distribution generating an observed value

logProb Source #

Arguments

:: PrimDist a

distribution

-> a

observed value

-> Double

log density

Compute the log density of a primitive distribution generating an observed value