acid-0.1.0.0: Artificial Circuit Designer
Safe HaskellNone
LanguageHaskell2010

Lib

Description

Utility and Helper functions for EDELWACE

Synopsis

Documentation

data Algorithm Source #

Available Algorithms

Constructors

TD3

Twin Delayed Deep Deterministic Policy Gradient

SAC

Soft Actor Critic

PPO

Proximal Policy Optimization

Instances

Instances details
Eq Algorithm Source # 
Instance details

Defined in Lib

Read Algorithm Source # 
Instance details

Defined in Lib

Show Algorithm Source # 
Instance details

Defined in Lib

Generic Algorithm Source # 
Instance details

Defined in Lib

Associated Types

type Rep Algorithm :: Type -> Type #

ToJSON Algorithm Source # 
Instance details

Defined in Lib

FromJSON Algorithm Source # 
Instance details

Defined in Lib

type Rep Algorithm Source # 
Instance details

Defined in Lib

type Rep Algorithm = D1 ('MetaData "Algorithm" "Lib" "acid-0.1.0.0-Kasfqr97FKi1MHFsFLmEZd" 'False) (C1 ('MetaCons "TD3" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SAC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PPO" 'PrefixI 'False) (U1 :: Type -> Type)))

data ReplayMemory Source #

Available Replay Buffer Types

Constructors

RPB

Vanilla Replay Buffer

PER

Prioritized Experience Replay

MEM

PPO Style replay Memory

ERE

Emphasizing Recent Experience

HER

Hindsight Experience Replay

Instances

Instances details
Eq ReplayMemory Source # 
Instance details

Defined in Lib

Read ReplayMemory Source # 
Instance details

Defined in Lib

Show ReplayMemory Source # 
Instance details

Defined in Lib

Generic ReplayMemory Source # 
Instance details

Defined in Lib

Associated Types

type Rep ReplayMemory :: Type -> Type #

ToJSON ReplayMemory Source # 
Instance details

Defined in Lib

FromJSON ReplayMemory Source # 
Instance details

Defined in Lib

type Rep ReplayMemory Source # 
Instance details

Defined in Lib

type Rep ReplayMemory = D1 ('MetaData "ReplayMemory" "Lib" "acid-0.1.0.0-Kasfqr97FKi1MHFsFLmEZd" 'False) ((C1 ('MetaCons "RPB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PER" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MEM" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ERE" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HER" 'PrefixI 'False) (U1 :: Type -> Type))))

data Strategy Source #

Hindsight Experience Replay Strategies for choosing Goals

Constructors

Final

Only Final States are additional targets

Random

Replay with k random states encountered so far (basically vanilla)

Episode

Replay with k random states from same episode.

Future

Replay with k random states from same episode, that were observed after

Instances

Instances details
Eq Strategy Source # 
Instance details

Defined in Lib

Read Strategy Source # 
Instance details

Defined in Lib

Show Strategy Source # 
Instance details

Defined in Lib

Generic Strategy Source # 
Instance details

Defined in Lib

Associated Types

type Rep Strategy :: Type -> Type #

Methods

from :: Strategy -> Rep Strategy x #

to :: Rep Strategy x -> Strategy #

ToJSON Strategy Source # 
Instance details

Defined in Lib

FromJSON Strategy Source # 
Instance details

Defined in Lib

type Rep Strategy Source # 
Instance details

Defined in Lib

type Rep Strategy = D1 ('MetaData "Strategy" "Lib" "acid-0.1.0.0-Kasfqr97FKi1MHFsFLmEZd" 'False) ((C1 ('MetaCons "Final" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Random" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Episode" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Future" 'PrefixI 'False) (U1 :: Type -> Type)))

data Mode Source #

Run Mode

Constructors

Train

Start Agent Training

Cont

Continue Agent Training

Eval

Evaluate Agent

Instances

Instances details
Eq Mode Source # 
Instance details

Defined in Lib

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Read Mode Source # 
Instance details

Defined in Lib

Show Mode Source # 
Instance details

Defined in Lib

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

data Args Source #

Command Line Arguments

Constructors

Args 

Fields

Instances

Instances details
Show Args Source # 
Instance details

Defined in Lib

Methods

showsPrec :: Int -> Args -> ShowS #

show :: Args -> String #

showList :: [Args] -> ShowS #

type Transition = (Tensor, Tensor, Tensor, Tensor, Tensor) Source #

Type Alias for Transition Tuple (state, action, reward, state', done)

successRate :: Tensor -> Float Source #

Calculate success rate given 1D Boolean done Tensor

range :: Int -> [Int] Source #

Range from 0 to n - 1

fst' :: (a, b, c) -> a Source #

First of triple

delete' :: Ord a => [a] -> Set a -> Set a Source #

Delete multiple elements from a Set

splits :: [Int] -> [[Int]] Source #

Helper function creating split indices

fst3 :: (a, b, c) -> a Source #

First of Triple

both :: (a -> b) -> (a, a) -> (b, b) Source #

Apply a function to both elements of a Tuple

uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d Source #

Uncurry Triple

lookup' :: Ord k => [k] -> Map k a -> Maybe [a] Source #

Like lookup but for a list of keys.

tmap :: (Tensor -> Tensor) -> Transition -> Transition Source #

Map an appropriate function over a transition tuple

(//) :: Integral a => a -> a -> a Source #

Infix div

(%) :: Integral a => a -> a -> a Source #

Infix mod

currentTimeStamp :: String -> IO String Source #

Current Timestamp as formatted string

currentTimeStamp' :: IO String Source #

Current Timestamp with default formatting: "%Y%m%d-%H%M%S"

createModelArchiveDir :: String -> IO String Source #

Create a model archive directory for the given algorithm

createModelArchiveDir' :: String -> String -> String -> String -> String -> String -> IO String Source #

Create a model archive directory for the given algorithm, ace id and backend

saveOptim :: Adam -> FilePath -> IO () Source #

Optimizer moments at given prefix

loadOptim :: Int -> Float -> Float -> FilePath -> IO Adam Source #

Load Optimizer State

weightLimit :: Linear -> Float Source #

Calculate weight Limits based on Layer Dimensions

data Initializer Source #

Type of weight initialization

Constructors

Normal

Normally distributed weights

Uniform

Uniformally distributed weights

XavierNormal

Using T.xavierNormal

XavierUniform

Using T.xavierUniform

KaimingNormal

Using T.kaimingNormal

KaimingUniform

Using T.kaimingUniform

Dirac 
Eye 
Ones 
Zeros 
Constant 

initWeights :: Initializer -> Float -> Float -> [Int] -> IO IndependentTensor Source #

Weights for a layer given limits and dimensions.

weightInit :: Initializer -> Float -> Float -> Linear -> IO Linear Source #

Initialize Weights of Linear Layer

weightInit' :: Initializer -> Float -> Float -> Linear -> IO Linear Source #

Initialize Weights and Bias of Linear Layer

weightInitUniform :: Float -> Float -> Linear -> IO Linear Source #

Initialize weights uniformally given upper and lower bounds

weightInitUniform' :: Linear -> IO Linear Source #

Initialize weights uniformally based on Fan In

weightInitNormal :: Float -> Float -> Linear -> IO Linear Source #

Initialize weights normally given mean and std bounds

weightInitNormal' :: Linear -> IO Linear Source #

Initialize weights normally based on Fan In

softUpdate :: Tensor -> Tensor -> Tensor -> Tensor Source #

Softly update parameters from Online Net to Target Net

softSync :: Parameterized f => Tensor -> f -> f -> IO f Source #

Softly copy parameters from Online Net to Target Net

copySync :: Parameterized f => f -> f -> f Source #

Hard Copy of Parameter from one net to the other