Copyright | Sean Burton 2015 |
---|---|
License | BSD3 |
Maintainer | burton.seanr@gmail.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell98 |
An applicative combinator library for parameter optimization designed to perform well over high-dimensional and/or discontinuous search spaces, using Monte-Carlo Tree Search with several enhancements.
- data Probe t = forall s . Probe {
- _initial :: s
- _partition :: s -> Forest s
- _draw :: s -> Maybe t
- newPartition :: (s -> [s]) -> s -> Forest s
- tipConcatMap :: (a -> Forest a) -> Tree a -> Tree a
- ave :: Num a => (a -> a -> a) -> a -> a -> a
- floatAve :: Floating a => a -> a -> a
- intAve :: Integral a => a -> a -> a
- distribution :: Floating b => (b -> a) -> Probe a
- exponential :: Floating a => a -> Probe a
- normal :: (Eq a, InvErf a) => a -> a -> Probe a
- uniform :: Floating a => a -> a -> Probe a
- bisect :: (Integral a, Num b, Ord b) => (a -> b) -> b -> a -> a -> a
- intDistribution :: (Integral a, Floating b, Ord b) => (a -> b) -> a -> a -> Probe a
- exponentialInt :: (Bounded a, Integral a) => Float -> Probe a
- normalInt :: (Bounded a, Integral a) => Float -> Float -> Probe a
- uniformInt :: (Eq a, Integral a) => a -> a -> Probe a
- constants :: [a] -> Probe a
- permutation :: [Integer] -> [a] -> Integer -> [a]
- permute :: [a] -> Probe [a]
- extractElem :: [a] -> [(a, [a])]
- sizedSublist :: Int -> [a] -> Probe [a]
- sizedWithReplacement :: Int -> [a] -> Probe [a]
- sublist :: [a] -> Probe [a]
- withReplacement :: [a] -> Probe [a]
Documentation
The main data structure for this module; it describes a search space and an associated exploration strategy.
This type is an instance of the following classes:
Functor
which does the obvious thing.Applicative
, which allows us to combine multiple search spaces and optimize over them simultaneously.Alternative
, which allows us to optimize over the disjoint union of two search spaces.
forall s . Probe | |
|
newPartition :: (s -> [s]) -> s -> Forest s Source
generate a partition function to be use in the construction of custom Probes.
tipConcatMap :: (a -> Forest a) -> Tree a -> Tree a Source
distribution :: Floating b => (b -> a) -> Probe a Source
Uses inverse transform sampling to draw from a probability distribution given the associated inverse cumulative distribution function.
exponential :: Floating a => a -> Probe a Source
Sample from the exponential distribution with given mean. Useful for constants which are potentially unbounded but probably small.
normal :: (Eq a, InvErf a) => a -> a -> Probe a Source
Sample from the normal distribution with given mean and standard deviation
intDistribution :: (Integral a, Floating b, Ord b) => (a -> b) -> a -> a -> Probe a Source
Approximately sample from a probability distribution over the range [a, b). Relies on splitting the range into regions of approximately equal probability so will be less accurate for small ranges or highly unequal distributions.
normalInt :: (Bounded a, Integral a) => Float -> Float -> Probe a Source
Sample from an approximate normal distribution with given mean and standard deviation. May fail if a very large mean and/or standard deviation is given.
uniformInt :: (Eq a, Integral a) => a -> a -> Probe a Source
Sample uniformly from the interval [a, b).
permutation :: [Integer] -> [a] -> Integer -> [a] Source
permute :: [a] -> Probe [a] Source
Samples uniformly from permutations of xs
. Makes the assumption that
permutations which are lexicographically close are likely to have similar
fitness.
extractElem :: [a] -> [(a, [a])] Source
sizedSublist :: Int -> [a] -> Probe [a] Source
Samples sublists of xs
of size k
. The order of elements in xs
is
irrelevant.
sizedWithReplacement :: Int -> [a] -> Probe [a] Source
Samples sublists of xs
of size k
with replacement.
The order of elements in xs
is irrelevant.
sublist :: [a] -> Probe [a] Source
Samples progressively larger sublists of xs
. More important
elements
(those which are likely to affect the fitness of a sample more) should
ideally be placed closest to the start of xs
.
withReplacement :: [a] -> Probe [a] Source
Samples progressively larger sublists of xs
with replacement. The order
of elements in xs
is irrelevant.