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 SearchNode t = SearchNode {}
- data SearchTree t = SearchTree {
- _node :: !(SearchNode (Maybe t))
- _children :: ![SearchTree t]
- searchTree :: Probe t -> SearchTree t
- i2f :: Integral a => a -> Float
- update :: SearchNode t -> Float -> Bool -> (SearchNode t, Bool)
- ucb :: Int64 -> Float -> Float -> SearchNode t -> Float
- insertOn :: Ord b => (a -> b) -> a -> [a] -> [a]
- insert :: Float -> Float -> Int64 -> SearchTree a -> [SearchTree a] -> [SearchTree a]
- data PlayoutResult t = PlayoutResult {}
- playoutM :: Monad m => (t -> m Float) -> Float -> Float -> SearchTree t -> m (PlayoutResult t)
- maximize_ :: Monad m => (m [(t, Float)] -> m [(t, Float)]) -> (t -> m Float) -> Probe t -> m [(t, Float)]
- maximize :: (t -> Float) -> Probe t -> [(t, Float)]
- minimize :: (t -> Float) -> Probe t -> [(t, Float)]
- type OptimizeM m t = (t -> m Float) -> Probe t -> m [(t, Float)]
- invert :: Monad m => OptimizeM m t -> OptimizeM m t
- maximizeM :: Monad m => (t -> m Float) -> Probe t -> m [(t, Float)]
- minimizeM :: Monad m => (t -> m Float) -> Probe t -> m [(t, Float)]
- maximizeIO :: (t -> IO Float) -> Probe t -> IO [(t, Float)]
- minimizeIO :: (t -> IO Float) -> Probe t -> IO [(t, Float)]
- highestYet_ :: Ord b => (a -> b) -> [a] -> [a]
- lowestYet_ :: (Num b, Ord b) => (a -> b) -> [a] -> [a]
- highestYet :: [(a, Float)] -> [(a, Float)]
- lowestYet :: [(a, Float)] -> [(a, Float)]
- getTimeInUsecs :: IO Int64
- evaluateForusecs :: Int -> [a] -> IO [a]
Documentation
data SearchTree t Source
SearchTree | |
|
Show t => Show (SearchTree t) |
searchTree :: Probe t -> SearchTree t Source
update :: SearchNode t -> Float -> Bool -> (SearchNode t, Bool) Source
insert :: Float -> Float -> Int64 -> SearchTree a -> [SearchTree a] -> [SearchTree a] Source
data PlayoutResult t Source
playoutM :: Monad m => (t -> m Float) -> Float -> Float -> SearchTree t -> m (PlayoutResult t) Source
maximize_ :: Monad m => (m [(t, Float)] -> m [(t, Float)]) -> (t -> m Float) -> Probe t -> m [(t, Float)] Source
maximize :: (t -> Float) -> Probe t -> [(t, Float)] Source
Fairly self-explanatory. Maximize the objective function eval
over the
given Probe
. Keeps lazily generating samples until it explores the whole
search space so you almost certainly want to apply some cut-off criterion.
minimize :: (t -> Float) -> Probe t -> [(t, Float)] Source
The opposite of maximize.
minimize eval = map (fmap negate) . maximize (negate . eval)
maximizeM :: Monad m => (t -> m Float) -> Probe t -> m [(t, Float)] Source
Maximize in the given monad. The underlying bind operator must be lazy if you want to generate the result list incrementally.
maximizeIO :: (t -> IO Float) -> Probe t -> IO [(t, Float)] Source
The equivalent of maximize, but running in the IO Monad. Generates the output list lazily.
highestYet_ :: Ord b => (a -> b) -> [a] -> [a] Source
lowestYet_ :: (Num b, Ord b) => (a -> b) -> [a] -> [a] Source
highestYet :: [(a, Float)] -> [(a, Float)] Source
Preserves only those elements (_, b)
for which b
is higher than for
all previous previous values in the list. Designed for use with
maximization
lowestYet :: [(a, Float)] -> [(a, Float)] Source
Preserves only those elements (_, b)
for which b
is lower than for all
previous values in the list. Designed for use with minimization.
lowestYet xs == map (fmap negate) . highestYet . map (fmap negate)
evaluateForusecs :: Int -> [a] -> IO [a] Source
Take the largest prefix of xs
which can be evaluated within dt
microseconds.