| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Inference.Conjugate
Synopsis
- class Distribution a where
- newtype AsPrior p = AsPrior p
- class (Distribution p, Distribution l, Support p ~ Params l) => Conjugate p l where
- priorSingleton :: p
- updatePrior :: l -> Params p -> Support l -> Params p
- predLogP :: l -> Params p -> Support l -> Double
- type family Hyper (a :: k)
- type family Probs (a :: k)
- newtype HyperRep p = HyperRep {}
- newtype ProbsRep p = ProbsRep {}
- class Jeffreys (a :: k) where
- jeffreysPrior :: Hyper a
- class GJeffreys (t :: k -> Type) where
- gjeffreysPrior :: forall (p :: k). t p
- class Uniform (a :: k) where
- uniformPrior :: Hyper a
- class GUniform (t :: k -> Type) where
- guniformPrior :: forall (p :: k). t p
- class Prior (a :: k) where
- sampleProbs :: forall (m :: Type -> Type). PrimMonad m => Hyper a -> Prob m (Probs a)
- expectedProbs :: Hyper a -> Probs a
- class GPrior (i :: k -> Type) (o :: k -> Type) where
- gsampleProbs :: forall (m :: Type -> Type) (p :: k). PrimMonad m => i p -> Prob m (o p)
- gexpectedProbs :: forall (p :: k). i p -> o p
- type Accessor (r :: (k -> Type) -> Type) (p :: k) = forall (f :: k -> Type). Lens' (r f) (f p)
- class Monad m => RandomInterpreter (m :: Type -> Type) (r :: (Type -> Type) -> Type) | m -> r where
- type SampleCtx (m :: Type -> Type) a
- sampleValue :: (Conjugate p l, SampleCtx m l) => String -> l -> Accessor r p -> m (Support l)
- sampleConst :: (Distribution d, SampleCtx m d) => String -> d -> Params d -> m (Support d)
- permutationPlate :: Ord a => Int -> (Int -> m a) -> m [a]
- newtype Trace (r :: (Type -> Type) -> Type) = Trace {}
- observeValue :: forall p l (m :: Type -> Type) (r :: (Type -> Type) -> Type). (Conjugate p l, Typeable (Support l), Monad m) => String -> l -> Accessor r p -> Support l -> StateT (Trace r) m ()
- observeConst :: forall d (m :: Type -> Type) (r :: (Type -> Type) -> Type). (Distribution d, Typeable (Support d), Monad m) => String -> d -> Params d -> Support d -> StateT (Trace r) m ()
- takeTrace :: forall a (r :: (Type -> Type) -> Type). Typeable a => Trace r -> Maybe ((String, a), Trace r)
- peekTrace :: forall (r :: (Type -> Type) -> Type). Trace r -> Maybe (String, Dynamic)
- newtype SampleI (m :: Type -> Type) (r :: (Type -> Type) -> Type) a = SampleI (ReaderT (r ProbsRep) (Prob m) a)
- sampleResult :: p ProbsRep -> SampleI m p a -> Gen (PrimState m) -> m a
- newtype TraceI (m :: Type -> Type) (r :: (Type -> Type) -> Type) a = TraceI (ReaderT (r ProbsRep) (StateT (Trace r) (Prob m)) a)
- sampleTrace :: r ProbsRep -> TraceI m r a -> Gen (PrimState m) -> m (a, Trace r)
- newtype EvalTraceI (r :: (Type -> Type) -> Type) a = EvalTraceI (ReaderT (r ProbsRep) (StateT (Trace r, Double) Maybe) a)
- runTraceLogP :: r ProbsRep -> Trace r -> EvalTraceI r a -> Maybe (a, (Trace r, Double))
- evalTraceLogP :: r ProbsRep -> Trace r -> EvalTraceI r a -> Maybe (a, Double)
- newtype EvalPredTraceI (r :: (Type -> Type) -> Type) a = EvalPredTraceI (ReaderT (r HyperRep) (StateT (Trace r, Double) Maybe) a)
- runTracePredLogP :: r HyperRep -> Trace r -> EvalPredTraceI r a -> Maybe (a, (Trace r, Double))
- evalTracePredLogP :: r HyperRep -> Trace r -> EvalPredTraceI r a -> Maybe (a, Double)
- newtype UpdatePriorsI (r :: (Type -> Type) -> Type) a = UpdatePriorsI (StateT (Trace r, r HyperRep) Maybe a)
- getPosterior :: r HyperRep -> Trace r -> UpdatePriorsI r a -> Maybe (r HyperRep)
- newtype ShowTraceI (r :: (Type -> Type) -> Type) a = ShowTraceI (MaybeT (WriterT String (State (Trace r))) a)
- showTraceItem :: forall l (r :: (Type -> Type) -> Type). (Show (Support l), Typeable l, Typeable (Support l)) => String -> ShowTraceI r (Support l)
- showTrace :: forall (r :: (Type -> Type) -> Type) a. Trace r -> ShowTraceI r a -> (Maybe a, String)
- printTrace :: forall (r :: (Type -> Type) -> Type) a. Trace r -> ShowTraceI r a -> IO ()
- newtype TraceTraceI (r :: (Type -> Type) -> Type) a = TraceTraceI (State (Trace r) a)
- traceTraceItem :: forall l (r :: (Type -> Type) -> Type). (Show (Support l), Typeable l, Typeable (Support l)) => String -> TraceTraceI r (Support l)
- traceTrace :: forall (r :: (Type -> Type) -> Type) a. Trace r -> TraceTraceI r a -> a
- data Beta = Beta
- data Bernoulli = Bernoulli
- newtype Binomial = Binomial Int
- data Categorical (n :: Nat) = Categorical
- data Dirichlet (n :: Nat) = Dirichlet
- data Geometric0 = Geometric0
- data Geometric1 = Geometric1
- replicateMWithI :: Applicative m => Int -> (Int -> m a) -> m [a]
Documentation
class Distribution a where Source #
Describes a family of distributions with a fixed form.
For example, a Bernoulli distribution is parameterized by a probability p
and produces binary samples
(True with probability p, False with probability 1-p).
Its Distribution instance is:
> instance Distribution Bernoulli where
> type Params Bernoulli = Double
> type Support Bernoulli = Bool
> distSample _ = uncurry bernoulli
> distLogP _ p True = log p
> distLogP _ p False = log (1 - p)
Methods
distSample :: forall (m :: Type -> Type). PrimMonad m => a -> Params a -> Prob m (Support a) Source #
Instances
A type-level marker for treating a distribution as a prior.
Constructors
| AsPrior p |
Instances
| Jeffreys (AsPrior Beta) Source # | |
Defined in Inference.Conjugate | |
| KnownNat n => Jeffreys (AsPrior (Dirichlet n) :: Type) Source # | |
Defined in Inference.Conjugate | |
| Prior (AsPrior Beta) Source # | |
| Prior (AsPrior (Dirichlet n) :: Type) Source # | |
| Uniform (AsPrior Beta) Source # | |
Defined in Inference.Conjugate | |
| KnownNat n => Uniform (AsPrior (Dirichlet n) :: Type) Source # | |
Defined in Inference.Conjugate | |
| type Hyper (AsPrior p :: Type) Source # | |
Defined in Inference.Conjugate | |
| type Probs (AsPrior p :: Type) Source # | |
Defined in Inference.Conjugate | |
class (Distribution p, Distribution l, Support p ~ Params l) => Conjugate p l where Source #
Marks two distributions as a conjugate pair of prior and likelihood.
The property of such a pair is that the posterior has the same form as the prior
(including the same Params and Support),
and that its parameters can be obtained analytically from the parameters of the prior
and a set of observations.
The class method updatePrior returns the parameters of the posterior
given the prior parameters after a single observation.
Methods
Arguments
| :: p | provides a singleton instance of the prior distribution in order to make sampling from priors easier. |
updatePrior :: l -> Params p -> Support l -> Params p Source #
Instances
| Conjugate Beta Bernoulli Source # | |
| Conjugate Beta Binomial Source # | |
| Conjugate Beta Geometric0 Source # | |
Defined in Inference.Conjugate Methods priorSingleton :: Beta Source # updatePrior :: Geometric0 -> Params Beta -> Support Geometric0 -> Params Beta Source # predLogP :: Geometric0 -> Params Beta -> Support Geometric0 -> Double Source # | |
| Conjugate Beta Geometric1 Source # | |
Defined in Inference.Conjugate Methods priorSingleton :: Beta Source # updatePrior :: Geometric1 -> Params Beta -> Support Geometric1 -> Params Beta Source # predLogP :: Geometric1 -> Params Beta -> Support Geometric1 -> Double Source # | |
| Conjugate (Dirichlet n) (Categorical n) Source # | |
Defined in Inference.Conjugate Methods priorSingleton :: Dirichlet n Source # updatePrior :: Categorical n -> Params (Dirichlet n) -> Support (Categorical n) -> Params (Dirichlet n) Source # predLogP :: Categorical n -> Params (Dirichlet n) -> Support (Categorical n) -> Double Source # | |
Instances
| Jeffreys (AsPrior p) => GJeffreys (K1 i (HyperRep p) :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p0 :: k). K1 i (HyperRep p) p0 Source # | |
| (Jeffreys k2, k2 HyperRep ~ Hyper k2) => GJeffreys (K1 i (k2 HyperRep) :: k1 -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p :: k1). K1 i (k2 HyperRep) p Source # | |
| Uniform (AsPrior p) => GUniform (K1 i (HyperRep p) :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p0 :: k). K1 i (HyperRep p) p0 Source # | |
| (Uniform k2, k2 HyperRep ~ Hyper k2) => GUniform (K1 i (k2 HyperRep) :: k1 -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p :: k1). K1 i (k2 HyperRep) p Source # | |
| Prior (AsPrior p) => GPrior (K1 i (HyperRep p) :: k -> Type) (K1 i (ProbsRep p) :: k -> Type) Source # | |
| (Prior k2, k2 HyperRep ~ Hyper k2, k2 ProbsRep ~ Probs k2) => GPrior (K1 i (k2 HyperRep) :: k1 -> Type) (K1 i (k2 ProbsRep) :: k1 -> Type) Source # | |
| Show (Hyper (AsPrior p)) => Show (HyperRep p) Source # | |
Instances
| Prior (AsPrior p) => GPrior (K1 i (HyperRep p) :: k -> Type) (K1 i (ProbsRep p) :: k -> Type) Source # | |
| (Prior k2, k2 HyperRep ~ Hyper k2, k2 ProbsRep ~ Probs k2) => GPrior (K1 i (k2 HyperRep) :: k1 -> Type) (K1 i (k2 ProbsRep) :: k1 -> Type) Source # | |
| Show (Probs (AsPrior p)) => Show (ProbsRep p) Source # | |
class Jeffreys (a :: k) where Source #
Methods
jeffreysPrior :: Hyper a Source #
Instances
| Jeffreys (AsPrior Beta) Source # | |
Defined in Inference.Conjugate | |
| KnownNat n => Jeffreys (AsPrior (Dirichlet n) :: Type) Source # | |
Defined in Inference.Conjugate | |
| (Generic (t HyperRep), GJeffreys (Rep (t HyperRep))) => Jeffreys (t :: (Type -> Type) -> Type) Source # | |
Defined in Inference.Conjugate Methods jeffreysPrior :: Hyper t Source # | |
class GJeffreys (t :: k -> Type) where Source #
Methods
gjeffreysPrior :: forall (p :: k). t p Source #
Instances
| GJeffreys (U1 :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p :: k). U1 p Source # | |
| GJeffreys (V1 :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p :: k). V1 p Source # | |
| (GJeffreys ta, GJeffreys tb) => GJeffreys (ta :*: tb :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p :: k). (ta :*: tb) p Source # | |
| Jeffreys (AsPrior p) => GJeffreys (K1 i (HyperRep p) :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p0 :: k). K1 i (HyperRep p) p0 Source # | |
| (Jeffreys k2, k2 HyperRep ~ Hyper k2) => GJeffreys (K1 i (k2 HyperRep) :: k1 -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: forall (p :: k1). K1 i (k2 HyperRep) p Source # | |
| GJeffreys t => GJeffreys (M1 i c t :: Type -> Type) Source # | |
Defined in Inference.Conjugate Methods gjeffreysPrior :: M1 i c t p Source # | |
class Uniform (a :: k) where Source #
Methods
uniformPrior :: Hyper a Source #
Instances
| Uniform (AsPrior Beta) Source # | |
Defined in Inference.Conjugate | |
| KnownNat n => Uniform (AsPrior (Dirichlet n) :: Type) Source # | |
Defined in Inference.Conjugate | |
| (Generic (t HyperRep), GUniform (Rep (t HyperRep))) => Uniform (t :: (Type -> Type) -> Type) Source # | |
Defined in Inference.Conjugate Methods uniformPrior :: Hyper t Source # | |
class GUniform (t :: k -> Type) where Source #
Methods
guniformPrior :: forall (p :: k). t p Source #
Instances
| GUniform (U1 :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p :: k). U1 p Source # | |
| GUniform (V1 :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p :: k). V1 p Source # | |
| (GUniform ta, GUniform tb) => GUniform (ta :*: tb :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p :: k). (ta :*: tb) p Source # | |
| Uniform (AsPrior p) => GUniform (K1 i (HyperRep p) :: k -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p0 :: k). K1 i (HyperRep p) p0 Source # | |
| (Uniform k2, k2 HyperRep ~ Hyper k2) => GUniform (K1 i (k2 HyperRep) :: k1 -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: forall (p :: k1). K1 i (k2 HyperRep) p Source # | |
| GUniform t => GUniform (M1 i c t :: Type -> Type) Source # | |
Defined in Inference.Conjugate Methods guniformPrior :: M1 i c t p Source # | |
class Prior (a :: k) where Source #
Methods
sampleProbs :: forall (m :: Type -> Type). PrimMonad m => Hyper a -> Prob m (Probs a) Source #
expectedProbs :: Hyper a -> Probs a Source #
class GPrior (i :: k -> Type) (o :: k -> Type) where Source #
Methods
gsampleProbs :: forall (m :: Type -> Type) (p :: k). PrimMonad m => i p -> Prob m (o p) Source #
gexpectedProbs :: forall (p :: k). i p -> o p Source #
Instances
| GPrior (U1 :: k -> Type) (U1 :: k -> Type) Source # | |
Defined in Inference.Conjugate | |
| GPrior (V1 :: k -> Type) (V1 :: k -> Type) Source # | |
Defined in Inference.Conjugate | |
| (GPrior ia oa, GPrior ib ob) => GPrior (ia :*: ib :: k -> Type) (oa :*: ob :: k -> Type) Source # | |
Defined in Inference.Conjugate | |
| (GPrior ia oa, GPrior ib ob) => GPrior (ia :+: ib :: k -> Type) (oa :+: ob :: k -> Type) Source # | |
Defined in Inference.Conjugate | |
| Prior (AsPrior p) => GPrior (K1 i (HyperRep p) :: k -> Type) (K1 i (ProbsRep p) :: k -> Type) Source # | |
| (Prior k2, k2 HyperRep ~ Hyper k2, k2 ProbsRep ~ Probs k2) => GPrior (K1 i (k2 HyperRep) :: k1 -> Type) (K1 i (k2 ProbsRep) :: k1 -> Type) Source # | |
| GPrior ti to => GPrior (M1 i c ti :: k -> Type) (M1 i' c' to :: k -> Type) Source # | |
Defined in Inference.Conjugate | |
type Accessor (r :: (k -> Type) -> Type) (p :: k) = forall (f :: k -> Type). Lens' (r f) (f p) Source #
class Monad m => RandomInterpreter (m :: Type -> Type) (r :: (Type -> Type) -> Type) | m -> r where Source #
Methods
sampleValue :: (Conjugate p l, SampleCtx m l) => String -> l -> Accessor r p -> m (Support l) Source #
sampleConst :: (Distribution d, SampleCtx m d) => String -> d -> Params d -> m (Support d) Source #
permutationPlate :: Ord a => Int -> (Int -> m a) -> m [a] Source #
Instances
| RandomInterpreter (EvalPredTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (EvalPredTraceI r) l) => String -> l -> Accessor r p -> EvalPredTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (EvalPredTraceI r) d) => String -> d -> Params d -> EvalPredTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> EvalPredTraceI r a) -> EvalPredTraceI r [a] Source # | |
| RandomInterpreter (EvalTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (EvalTraceI r) l) => String -> l -> Accessor r p -> EvalTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (EvalTraceI r) d) => String -> d -> Params d -> EvalTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> EvalTraceI r a) -> EvalTraceI r [a] Source # | |
| RandomInterpreter (ShowTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (ShowTraceI r) l) => String -> l -> Accessor r p -> ShowTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (ShowTraceI r) d) => String -> d -> Params d -> ShowTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> ShowTraceI r a) -> ShowTraceI r [a] Source # | |
| RandomInterpreter (TraceTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (TraceTraceI r) l) => String -> l -> Accessor r p -> TraceTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (TraceTraceI r) d) => String -> d -> Params d -> TraceTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> TraceTraceI r a) -> TraceTraceI r [a] Source # | |
| RandomInterpreter (UpdatePriorsI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (UpdatePriorsI r) l) => String -> l -> Accessor r p -> UpdatePriorsI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (UpdatePriorsI r) d) => String -> d -> Params d -> UpdatePriorsI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> UpdatePriorsI r a) -> UpdatePriorsI r [a] Source # | |
| PrimMonad m => RandomInterpreter (SampleI m r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (SampleI m r) l) => String -> l -> Accessor r p -> SampleI m r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (SampleI m r) d) => String -> d -> Params d -> SampleI m r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> SampleI m r a) -> SampleI m r [a] Source # | |
| PrimMonad m => RandomInterpreter (TraceI m r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (TraceI m r) l) => String -> l -> Accessor r p -> TraceI m r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (TraceI m r) d) => String -> d -> Params d -> TraceI m r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> TraceI m r a) -> TraceI m r [a] Source # | |
observeValue :: forall p l (m :: Type -> Type) (r :: (Type -> Type) -> Type). (Conjugate p l, Typeable (Support l), Monad m) => String -> l -> Accessor r p -> Support l -> StateT (Trace r) m () Source #
observeConst :: forall d (m :: Type -> Type) (r :: (Type -> Type) -> Type). (Distribution d, Typeable (Support d), Monad m) => String -> d -> Params d -> Support d -> StateT (Trace r) m () Source #
takeTrace :: forall a (r :: (Type -> Type) -> Type). Typeable a => Trace r -> Maybe ((String, a), Trace r) Source #
newtype SampleI (m :: Type -> Type) (r :: (Type -> Type) -> Type) a Source #
Instances
| Monad m => Applicative (SampleI m r) Source # | |
Defined in Inference.Conjugate | |
| Functor m => Functor (SampleI m r) Source # | |
| Monad m => Monad (SampleI m r) Source # | |
| PrimMonad m => RandomInterpreter (SampleI m r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (SampleI m r) l) => String -> l -> Accessor r p -> SampleI m r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (SampleI m r) d) => String -> d -> Params d -> SampleI m r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> SampleI m r a) -> SampleI m r [a] Source # | |
| type SampleCtx (SampleI m r) a Source # | |
Defined in Inference.Conjugate | |
newtype TraceI (m :: Type -> Type) (r :: (Type -> Type) -> Type) a Source #
Instances
| Monad m => Applicative (TraceI m r) Source # | |
Defined in Inference.Conjugate | |
| Functor m => Functor (TraceI m r) Source # | |
| Monad m => Monad (TraceI m r) Source # | |
| PrimMonad m => RandomInterpreter (TraceI m r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (TraceI m r) l) => String -> l -> Accessor r p -> TraceI m r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (TraceI m r) d) => String -> d -> Params d -> TraceI m r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> TraceI m r a) -> TraceI m r [a] Source # | |
| type SampleCtx (TraceI m r) l Source # | |
Defined in Inference.Conjugate | |
newtype EvalTraceI (r :: (Type -> Type) -> Type) a Source #
Instances
| Applicative (EvalTraceI r) Source # | |
Defined in Inference.Conjugate Methods pure :: a -> EvalTraceI r a # (<*>) :: EvalTraceI r (a -> b) -> EvalTraceI r a -> EvalTraceI r b # liftA2 :: (a -> b -> c) -> EvalTraceI r a -> EvalTraceI r b -> EvalTraceI r c # (*>) :: EvalTraceI r a -> EvalTraceI r b -> EvalTraceI r b # (<*) :: EvalTraceI r a -> EvalTraceI r b -> EvalTraceI r a # | |
| Functor (EvalTraceI r) Source # | |
Defined in Inference.Conjugate Methods fmap :: (a -> b) -> EvalTraceI r a -> EvalTraceI r b # (<$) :: a -> EvalTraceI r b -> EvalTraceI r a # | |
| Monad (EvalTraceI r) Source # | |
Defined in Inference.Conjugate Methods (>>=) :: EvalTraceI r a -> (a -> EvalTraceI r b) -> EvalTraceI r b # (>>) :: EvalTraceI r a -> EvalTraceI r b -> EvalTraceI r b # return :: a -> EvalTraceI r a # | |
| RandomInterpreter (EvalTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (EvalTraceI r) l) => String -> l -> Accessor r p -> EvalTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (EvalTraceI r) d) => String -> d -> Params d -> EvalTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> EvalTraceI r a) -> EvalTraceI r [a] Source # | |
| type SampleCtx (EvalTraceI r) l Source # | |
Defined in Inference.Conjugate | |
runTraceLogP :: r ProbsRep -> Trace r -> EvalTraceI r a -> Maybe (a, (Trace r, Double)) Source #
evalTraceLogP :: r ProbsRep -> Trace r -> EvalTraceI r a -> Maybe (a, Double) Source #
newtype EvalPredTraceI (r :: (Type -> Type) -> Type) a Source #
Instances
| Applicative (EvalPredTraceI r) Source # | |
Defined in Inference.Conjugate Methods pure :: a -> EvalPredTraceI r a # (<*>) :: EvalPredTraceI r (a -> b) -> EvalPredTraceI r a -> EvalPredTraceI r b # liftA2 :: (a -> b -> c) -> EvalPredTraceI r a -> EvalPredTraceI r b -> EvalPredTraceI r c # (*>) :: EvalPredTraceI r a -> EvalPredTraceI r b -> EvalPredTraceI r b # (<*) :: EvalPredTraceI r a -> EvalPredTraceI r b -> EvalPredTraceI r a # | |
| Functor (EvalPredTraceI r) Source # | |
Defined in Inference.Conjugate Methods fmap :: (a -> b) -> EvalPredTraceI r a -> EvalPredTraceI r b # (<$) :: a -> EvalPredTraceI r b -> EvalPredTraceI r a # | |
| Monad (EvalPredTraceI r) Source # | |
Defined in Inference.Conjugate Methods (>>=) :: EvalPredTraceI r a -> (a -> EvalPredTraceI r b) -> EvalPredTraceI r b # (>>) :: EvalPredTraceI r a -> EvalPredTraceI r b -> EvalPredTraceI r b # return :: a -> EvalPredTraceI r a # | |
| RandomInterpreter (EvalPredTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (EvalPredTraceI r) l) => String -> l -> Accessor r p -> EvalPredTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (EvalPredTraceI r) d) => String -> d -> Params d -> EvalPredTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> EvalPredTraceI r a) -> EvalPredTraceI r [a] Source # | |
| type SampleCtx (EvalPredTraceI r) l Source # | |
Defined in Inference.Conjugate | |
runTracePredLogP :: r HyperRep -> Trace r -> EvalPredTraceI r a -> Maybe (a, (Trace r, Double)) Source #
evalTracePredLogP :: r HyperRep -> Trace r -> EvalPredTraceI r a -> Maybe (a, Double) Source #
newtype UpdatePriorsI (r :: (Type -> Type) -> Type) a Source #
Constructors
| UpdatePriorsI (StateT (Trace r, r HyperRep) Maybe a) |
Instances
| Applicative (UpdatePriorsI r) Source # | |
Defined in Inference.Conjugate Methods pure :: a -> UpdatePriorsI r a # (<*>) :: UpdatePriorsI r (a -> b) -> UpdatePriorsI r a -> UpdatePriorsI r b # liftA2 :: (a -> b -> c) -> UpdatePriorsI r a -> UpdatePriorsI r b -> UpdatePriorsI r c # (*>) :: UpdatePriorsI r a -> UpdatePriorsI r b -> UpdatePriorsI r b # (<*) :: UpdatePriorsI r a -> UpdatePriorsI r b -> UpdatePriorsI r a # | |
| Functor (UpdatePriorsI r) Source # | |
Defined in Inference.Conjugate Methods fmap :: (a -> b) -> UpdatePriorsI r a -> UpdatePriorsI r b # (<$) :: a -> UpdatePriorsI r b -> UpdatePriorsI r a # | |
| Monad (UpdatePriorsI r) Source # | |
Defined in Inference.Conjugate Methods (>>=) :: UpdatePriorsI r a -> (a -> UpdatePriorsI r b) -> UpdatePriorsI r b # (>>) :: UpdatePriorsI r a -> UpdatePriorsI r b -> UpdatePriorsI r b # return :: a -> UpdatePriorsI r a # | |
| RandomInterpreter (UpdatePriorsI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (UpdatePriorsI r) l) => String -> l -> Accessor r p -> UpdatePriorsI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (UpdatePriorsI r) d) => String -> d -> Params d -> UpdatePriorsI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> UpdatePriorsI r a) -> UpdatePriorsI r [a] Source # | |
| type SampleCtx (UpdatePriorsI r) l Source # | |
Defined in Inference.Conjugate | |
getPosterior :: r HyperRep -> Trace r -> UpdatePriorsI r a -> Maybe (r HyperRep) Source #
newtype ShowTraceI (r :: (Type -> Type) -> Type) a Source #
Instances
| Applicative (ShowTraceI r) Source # | |
Defined in Inference.Conjugate Methods pure :: a -> ShowTraceI r a # (<*>) :: ShowTraceI r (a -> b) -> ShowTraceI r a -> ShowTraceI r b # liftA2 :: (a -> b -> c) -> ShowTraceI r a -> ShowTraceI r b -> ShowTraceI r c # (*>) :: ShowTraceI r a -> ShowTraceI r b -> ShowTraceI r b # (<*) :: ShowTraceI r a -> ShowTraceI r b -> ShowTraceI r a # | |
| Functor (ShowTraceI r) Source # | |
Defined in Inference.Conjugate Methods fmap :: (a -> b) -> ShowTraceI r a -> ShowTraceI r b # (<$) :: a -> ShowTraceI r b -> ShowTraceI r a # | |
| Monad (ShowTraceI r) Source # | |
Defined in Inference.Conjugate Methods (>>=) :: ShowTraceI r a -> (a -> ShowTraceI r b) -> ShowTraceI r b # (>>) :: ShowTraceI r a -> ShowTraceI r b -> ShowTraceI r b # return :: a -> ShowTraceI r a # | |
| RandomInterpreter (ShowTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (ShowTraceI r) l) => String -> l -> Accessor r p -> ShowTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (ShowTraceI r) d) => String -> d -> Params d -> ShowTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> ShowTraceI r a) -> ShowTraceI r [a] Source # | |
| type SampleCtx (ShowTraceI r) l Source # | |
Defined in Inference.Conjugate | |
showTraceItem :: forall l (r :: (Type -> Type) -> Type). (Show (Support l), Typeable l, Typeable (Support l)) => String -> ShowTraceI r (Support l) Source #
showTrace :: forall (r :: (Type -> Type) -> Type) a. Trace r -> ShowTraceI r a -> (Maybe a, String) Source #
printTrace :: forall (r :: (Type -> Type) -> Type) a. Trace r -> ShowTraceI r a -> IO () Source #
newtype TraceTraceI (r :: (Type -> Type) -> Type) a Source #
Constructors
| TraceTraceI (State (Trace r) a) |
Instances
| Applicative (TraceTraceI r) Source # | |
Defined in Inference.Conjugate Methods pure :: a -> TraceTraceI r a # (<*>) :: TraceTraceI r (a -> b) -> TraceTraceI r a -> TraceTraceI r b # liftA2 :: (a -> b -> c) -> TraceTraceI r a -> TraceTraceI r b -> TraceTraceI r c # (*>) :: TraceTraceI r a -> TraceTraceI r b -> TraceTraceI r b # (<*) :: TraceTraceI r a -> TraceTraceI r b -> TraceTraceI r a # | |
| Functor (TraceTraceI r) Source # | |
Defined in Inference.Conjugate Methods fmap :: (a -> b) -> TraceTraceI r a -> TraceTraceI r b # (<$) :: a -> TraceTraceI r b -> TraceTraceI r a # | |
| Monad (TraceTraceI r) Source # | |
Defined in Inference.Conjugate Methods (>>=) :: TraceTraceI r a -> (a -> TraceTraceI r b) -> TraceTraceI r b # (>>) :: TraceTraceI r a -> TraceTraceI r b -> TraceTraceI r b # return :: a -> TraceTraceI r a # | |
| RandomInterpreter (TraceTraceI r) r Source # | |
Defined in Inference.Conjugate Methods sampleValue :: (Conjugate p l, SampleCtx (TraceTraceI r) l) => String -> l -> Accessor r p -> TraceTraceI r (Support l) Source # sampleConst :: (Distribution d, SampleCtx (TraceTraceI r) d) => String -> d -> Params d -> TraceTraceI r (Support d) Source # permutationPlate :: Ord a => Int -> (Int -> TraceTraceI r a) -> TraceTraceI r [a] Source # | |
| type SampleCtx (TraceTraceI r) l Source # | |
Defined in Inference.Conjugate | |
traceTraceItem :: forall l (r :: (Type -> Type) -> Type). (Show (Support l), Typeable l, Typeable (Support l)) => String -> TraceTraceI r (Support l) Source #
traceTrace :: forall (r :: (Type -> Type) -> Type) a. Trace r -> TraceTraceI r a -> a Source #
Constructors
| Beta |
Instances
| Distribution Beta Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Generic Beta Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Show Beta Source # | |||||||||
| Eq Beta Source # | |||||||||
| Ord Beta Source # | |||||||||
| Conjugate Beta Bernoulli Source # | |||||||||
| Conjugate Beta Binomial Source # | |||||||||
| Conjugate Beta Geometric0 Source # | |||||||||
Defined in Inference.Conjugate Methods priorSingleton :: Beta Source # updatePrior :: Geometric0 -> Params Beta -> Support Geometric0 -> Params Beta Source # predLogP :: Geometric0 -> Params Beta -> Support Geometric0 -> Double Source # | |||||||||
| Conjugate Beta Geometric1 Source # | |||||||||
Defined in Inference.Conjugate Methods priorSingleton :: Beta Source # updatePrior :: Geometric1 -> Params Beta -> Support Geometric1 -> Params Beta Source # predLogP :: Geometric1 -> Params Beta -> Support Geometric1 -> Double Source # | |||||||||
| Jeffreys (AsPrior Beta) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Prior (AsPrior Beta) Source # | |||||||||
| Uniform (AsPrior Beta) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Params Beta Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support Beta Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep Beta Source # | |||||||||
Constructors
| Bernoulli |
Instances
| Distribution Bernoulli Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Generic Bernoulli Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Show Bernoulli Source # | |||||||||
| Eq Bernoulli Source # | |||||||||
| Ord Bernoulli Source # | |||||||||
| Conjugate Beta Bernoulli Source # | |||||||||
| type Params Bernoulli Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support Bernoulli Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep Bernoulli Source # | |||||||||
Instances
| Distribution Binomial Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Generic Binomial Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Show Binomial Source # | |||||||||
| Eq Binomial Source # | |||||||||
| Ord Binomial Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Conjugate Beta Binomial Source # | |||||||||
| type Params Binomial Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support Binomial Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep Binomial Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
data Categorical (n :: Nat) Source #
Constructors
| Categorical |
Instances
| Distribution (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Associated Types
Methods distSample :: forall (m :: Type -> Type). PrimMonad m => Categorical n -> Params (Categorical n) -> Prob m (Support (Categorical n)) Source # distLogP :: Categorical n -> Params (Categorical n) -> Support (Categorical n) -> Double Source # | |||||||||
| Generic (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Associated Types
Methods from :: Categorical n -> Rep (Categorical n) x # to :: Rep (Categorical n) x -> Categorical n # | |||||||||
| Show (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Methods showsPrec :: Int -> Categorical n -> ShowS # show :: Categorical n -> String # showList :: [Categorical n] -> ShowS # | |||||||||
| Eq (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Methods (==) :: Categorical n -> Categorical n -> Bool # (/=) :: Categorical n -> Categorical n -> Bool # | |||||||||
| Ord (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Methods compare :: Categorical n -> Categorical n -> Ordering # (<) :: Categorical n -> Categorical n -> Bool # (<=) :: Categorical n -> Categorical n -> Bool # (>) :: Categorical n -> Categorical n -> Bool # (>=) :: Categorical n -> Categorical n -> Bool # max :: Categorical n -> Categorical n -> Categorical n # min :: Categorical n -> Categorical n -> Categorical n # | |||||||||
| Conjugate (Dirichlet n) (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Methods priorSingleton :: Dirichlet n Source # updatePrior :: Categorical n -> Params (Dirichlet n) -> Support (Categorical n) -> Params (Dirichlet n) Source # predLogP :: Categorical n -> Params (Dirichlet n) -> Support (Categorical n) -> Double Source # | |||||||||
| type Params (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep (Categorical n) Source # | |||||||||
data Dirichlet (n :: Nat) Source #
Constructors
| Dirichlet |
Instances
| KnownNat n => Jeffreys (AsPrior (Dirichlet n) :: Type) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Prior (AsPrior (Dirichlet n) :: Type) Source # | |||||||||
| KnownNat n => Uniform (AsPrior (Dirichlet n) :: Type) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Distribution (Dirichlet n) Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Generic (Dirichlet n) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Show (Dirichlet n) Source # | |||||||||
| Eq (Dirichlet n) Source # | |||||||||
| Ord (Dirichlet n) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Conjugate (Dirichlet n) (Categorical n) Source # | |||||||||
Defined in Inference.Conjugate Methods priorSingleton :: Dirichlet n Source # updatePrior :: Categorical n -> Params (Dirichlet n) -> Support (Categorical n) -> Params (Dirichlet n) Source # predLogP :: Categorical n -> Params (Dirichlet n) -> Support (Categorical n) -> Double Source # | |||||||||
| type Params (Dirichlet n) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support (Dirichlet n) Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep (Dirichlet n) Source # | |||||||||
data Geometric0 Source #
Constructors
| Geometric0 |
Instances
| Distribution Geometric0 Source # | |||||||||
Defined in Inference.Conjugate Associated Types
Methods distSample :: forall (m :: Type -> Type). PrimMonad m => Geometric0 -> Params Geometric0 -> Prob m (Support Geometric0) Source # distLogP :: Geometric0 -> Params Geometric0 -> Support Geometric0 -> Double Source # | |||||||||
| Generic Geometric0 Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Show Geometric0 Source # | |||||||||
Defined in Inference.Conjugate Methods showsPrec :: Int -> Geometric0 -> ShowS # show :: Geometric0 -> String # showList :: [Geometric0] -> ShowS # | |||||||||
| Eq Geometric0 Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Ord Geometric0 Source # | |||||||||
Defined in Inference.Conjugate Methods compare :: Geometric0 -> Geometric0 -> Ordering # (<) :: Geometric0 -> Geometric0 -> Bool # (<=) :: Geometric0 -> Geometric0 -> Bool # (>) :: Geometric0 -> Geometric0 -> Bool # (>=) :: Geometric0 -> Geometric0 -> Bool # max :: Geometric0 -> Geometric0 -> Geometric0 # min :: Geometric0 -> Geometric0 -> Geometric0 # | |||||||||
| Conjugate Beta Geometric0 Source # | |||||||||
Defined in Inference.Conjugate Methods priorSingleton :: Beta Source # updatePrior :: Geometric0 -> Params Beta -> Support Geometric0 -> Params Beta Source # predLogP :: Geometric0 -> Params Beta -> Support Geometric0 -> Double Source # | |||||||||
| type Params Geometric0 Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support Geometric0 Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep Geometric0 Source # | |||||||||
data Geometric1 Source #
Constructors
| Geometric1 |
Instances
| Distribution Geometric1 Source # | |||||||||
Defined in Inference.Conjugate Associated Types
Methods distSample :: forall (m :: Type -> Type). PrimMonad m => Geometric1 -> Params Geometric1 -> Prob m (Support Geometric1) Source # distLogP :: Geometric1 -> Params Geometric1 -> Support Geometric1 -> Double Source # | |||||||||
| Generic Geometric1 Source # | |||||||||
Defined in Inference.Conjugate Associated Types
| |||||||||
| Show Geometric1 Source # | |||||||||
Defined in Inference.Conjugate Methods showsPrec :: Int -> Geometric1 -> ShowS # show :: Geometric1 -> String # showList :: [Geometric1] -> ShowS # | |||||||||
| Eq Geometric1 Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| Ord Geometric1 Source # | |||||||||
Defined in Inference.Conjugate Methods compare :: Geometric1 -> Geometric1 -> Ordering # (<) :: Geometric1 -> Geometric1 -> Bool # (<=) :: Geometric1 -> Geometric1 -> Bool # (>) :: Geometric1 -> Geometric1 -> Bool # (>=) :: Geometric1 -> Geometric1 -> Bool # max :: Geometric1 -> Geometric1 -> Geometric1 # min :: Geometric1 -> Geometric1 -> Geometric1 # | |||||||||
| Conjugate Beta Geometric1 Source # | |||||||||
Defined in Inference.Conjugate Methods priorSingleton :: Beta Source # updatePrior :: Geometric1 -> Params Beta -> Support Geometric1 -> Params Beta Source # predLogP :: Geometric1 -> Params Beta -> Support Geometric1 -> Double Source # | |||||||||
| type Params Geometric1 Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Support Geometric1 Source # | |||||||||
Defined in Inference.Conjugate | |||||||||
| type Rep Geometric1 Source # | |||||||||
replicateMWithI :: Applicative m => Int -> (Int -> m a) -> m [a] Source #