Safe Haskell | None |
---|---|

Language | Haskell2010 |

- mixTargets :: HasDensity t a => [(t a, Double)] -> Target a
- mixProposals :: [(Proposal a, Double)] -> Proposal a
- chooseProposal :: Int -> (Int -> Proposal a) -> Proposal a
- mixCondProposals :: [(a -> Proposal a, Double)] -> a -> Proposal a
- updateNth :: Eq a => Int -> (a -> Proposal a) -> [a] -> Proposal [a]
- updateBlock :: Eq a => Int -> Int -> ([a] -> Proposal [a]) -> [a] -> Proposal [a]
- updateFirst :: Eq b => (a -> Proposal a) -> (a, b) -> Proposal (a, b)
- updateSecond :: Eq a => (b -> Proposal b) -> (a, b) -> Proposal (a, b)
- mixSteps :: [(Step x, Double)] -> Step x
- chooseStep :: Int -> (Int -> Target a) -> (Int -> a -> Proposal a) -> Kernel x a -> Step x
- cycleStep :: Kernel x a -> Target a -> [a -> Proposal a] -> Step x
- execute :: Monad m => Action x m a b -> x -> m (Action x m a b)
- every :: Monad m => Int -> Action x m a b -> Action x m (a, Int) b

# Target combinators

mixTargets :: HasDensity t a => [(t a, Double)] -> Target a

Create a mixture target distribution from a list of distribution-weight pairs.

The input distributions can be of any type in the `HasDensity`

class, which includes `Proposal`

and `Target`

.
The output is a `Target`

containing a `Density`

.

The input weights are meant to be relative, not required to be normalized.

# Proposal combinators

mixProposals :: [(Proposal a, Double)] -> Proposal a

Create a mixture proposal distribution from a list of distribution-weight pairs.

The input weights are meant to be relative, not required to be normalized.

chooseProposal :: Int -> (Int -> Proposal a) -> Proposal a

Create a uniform mixture of proposals based on the mapping function. The first argument is the total number of proposals in the mixture.

This is a convenience function for cases where there are a large number of index-based proposals (such as the case where there is a unique proposal for updating each dimension in a high-dimensional state).

mixCondProposals :: [(a -> Proposal a, Double)] -> a -> Proposal a

Create a mixture of *conditional* proposal distributions.
The result is a mixture of proposal distributions that are all conditioned
on the same starting state.

The input weights are meant to be relative, not required to be normalized.

:: Eq a | |

=> Int | The dimension index |

-> (a -> Proposal a) | A conditional proposal to focus on that dimension |

-> [a] -> Proposal [a] | A conditional proposal that updates only one dimension |

Update the nth dimension of a multi-dimensioanl state represented using a list.

:: Eq a | |

=> Int | The start dimension of the block |

-> Int | The end dimension of the block |

-> ([a] -> Proposal [a]) | A conditional proposal to focus on the block |

-> [a] -> Proposal [a] | A conditional proposal that updates only that block |

Update a contiguous block of dimensions of a multi-dimensional state represented using a list.

:: Eq b | |

=> (a -> Proposal a) | A conditional proposal to focus on the first element |

-> (a, b) -> Proposal (a, b) |

Update the first element of a multi-dimensional state represented as a tuple.

:: Eq a | |

=> (b -> Proposal b) | |

-> (a, b) -> Proposal (a, b) | A conditional proposal to focus on the second element |

Update the second element of a multi-dimensional state represented as a tuple.

# Step combinators

mixSteps :: [(Step x, Double)] -> Step x

Create a mixture `Step`

, representing a categorical distribution over
multiple inference procedures.

The input weights are meant to be relative, not required to be normalized.

:: Int | The total number of |

-> (Int -> Target a) | The mapping function over targets |

-> (Int -> a -> Proposal a) | The mapping function over conditional proposals |

-> Kernel x a | The transition kernel to use across all |

-> Step x | The mixture step |

The analogue of `chooseProposal`

, to use a specific `Step`

for each dimension of a multi-dimensional state.

The same `Kernel`

value is used for creating each `Step`

in the mixture.

cycleStep :: Kernel x a -> Target a -> [a -> Proposal a] -> Step x

Create a cycled transition kernel. This combinator applies the provided transition kernel to the target, and to the conditional proposals in the order that they appear in the list. Each application generates an intermediate state that is passed to the next conditional proposal in the list.