Safe Haskell | None |
---|

Marginalization is a tricky procedure involving a lot of type hackery. All user-facing interfaces use the Marginalize class, and all internal interfaces use the Marginalize' class. Essentially, TypeLens class converts the Type lens for our user's data type into a type level number. The Marginalize' class then takes this type number and uses it as an index into an appropriate type list that represents the data type.

The TemplateHaskell module has more info.

# Documentation

class (Marginalize' (TypeLensIndex index) dist, TypeLens index) => Marginalize index dist whereSource

type MarginalizeOut index dist Source

getMargin :: index -> dist -> Margin index distSource

marginalizeOut :: index -> dist -> MarginalizeOut index distSource

condition :: index -> Datapoint (Margin' (TypeLensIndex index) dist) -> dist -> MarginalizeOut' (TypeLensIndex index) distSource

(Marginalize' (TypeLensIndex index) dist, TypeLens index) => Marginalize index dist |

class Marginalize' index dist whereSource

type Margin' index dist Source

type MarginalizeOut' index dist Source

getMargin' :: index -> dist -> Margin' index distSource

marginalizeOut' :: index -> dist -> MarginalizeOut' index distSource

condition' :: index -> dist -> Datapoint (Margin' index dist) -> MarginalizeOut' index distSource

(Marginalize' (Nat1Box n) (MultivariateTF (Concat (* -> * -> *) xs) prob), ~ * (MarginalizeOut' (Nat1Box n) (MultivariateTF (Concat (* -> * -> *) xs) prob)) (MultivariateTF (Concat (* -> * -> *) (Replace2D (* -> * -> *) n xs (Ignore' (Index * (HList2TypeList * (GetHList dp)) n)))) prob)) => Marginalize' (Nat1Box n) (Multivariate dp xs prob) | |

(NumDP basedist, ~ * (Ring basedist) prob, Monoid basedist, ~ * (HCons label (Datapoint basedist)) (HList (: * label ts)), Ord label) => Marginalize' (Nat1Box Zero) (CatContainer label basedist prob) | |

Marginalize' (Nat1Box n) basedist => Marginalize' (Nat1Box (Succ n)) (Ignore' label basedist prob) | |

(Marginalize' (Nat1Box n) basedist, Monoid basedist, PDF (Margin' (Nat1Box n) basedist), ~ * prob (Probability (Margin' (Nat1Box n) basedist)), ~ * prob (Ring basedist), Module basedist, Ord label, Num prob) => Marginalize' (Nat1Box (Succ n)) (CatContainer label basedist prob) | |

Marginalize' (Nat1Box Zero) (Container * dist sample basedist prob) | |

Marginalize' (Nat1Box n) basedist => Marginalize' (Nat1Box (Succ n)) (Container k dist sample basedist prob) |