Safe Haskell | None |
---|

- defaultSPSA :: SPSA
- checkSPSA :: Vector Double -> StateSPSA ()
- type StateSPSA = State SPSA
- getLoss :: StateSPSA LossFn
- getConstraint :: StateSPSA ConstraintFn
- getStop :: StateSPSA [StoppingCriteria]
- peelAll :: StateSPSA (Double, Double, Vector Double)
- getIterations :: StateSPSA Int
- setLoss :: LossFn -> StateSPSA ()
- setConstraint :: ConstraintFn -> StateSPSA ()
- pushStopCrit :: StoppingCriteria -> StateSPSA ()
- setGainA :: [Double] -> StateSPSA ()
- setGainC :: [Double] -> StateSPSA ()
- setPerturbation :: [Vector Double] -> StateSPSA ()
- incrementIteration :: StateSPSA Int
- data StoppingCriteria
- = Iterations Int
- | NormDiff Double

- shouldStop :: StoppingCriteria -> Int -> Vector Double -> Vector Double -> Bool
- type LossFn = Vector Double -> Double
- type ConstraintFn = Vector Double -> Vector Double
- runSPSA :: StateSPSA a -> Vector Double -> Vector Double
- standardGainAk :: Double -> Int -> Double -> [Double]
- standardGainCk :: Double -> Double -> [Double]
- semiautomaticTuning :: Int -> Double -> Double -> StateSPSA ()
- bernoulli :: Int -> Int -> [Vector Double]

# Documentation

defaultSPSA :: SPSASource

Make a default SPSA instance

getConstraint :: StateSPSA ConstraintFnSource

Get the constraint function out of StateSPSA

getStop :: StateSPSA [StoppingCriteria]Source

Get the stopping functions out of StateSPSA

peelAll :: StateSPSA (Double, Double, Vector Double)Source

Peel the next value from the two gain sequences and the perturbation vectors

getIterations :: StateSPSA IntSource

Get the iteration count

setConstraint :: ConstraintFn -> StateSPSA ()Source

Set the constraint function

pushStopCrit :: StoppingCriteria -> StateSPSA ()Source

Push a stopping criteria onto SPSA

setPerturbation :: [Vector Double] -> StateSPSA ()Source

Set the perturbation sequence

incrementIteration :: StateSPSA IntSource

Increment the iteration count

data StoppingCriteria Source

A stopping criteria is a function of current iteration number, last iteration theta, and current theta

shouldStop :: StoppingCriteria -> Int -> Vector Double -> Vector Double -> BoolSource

Check to see if we should stop based on the critieria, iteration count, last and current iteration

runSPSA :: StateSPSA a -> Vector Double -> Vector DoubleSource

Exported runSPSA function to extract the SPSA type

standardGainAk :: Double -> Int -> Double -> [Double]Source

Standard gain sequence for a_k = a / (k + 1 + A) ^ alpha | a is the most important and variable tuning parameter. Start with it set to get desired change in first iteration. | A is usually set to 10% of expected iterations | alpha is usually set to 0.602, but is valid up to 1.0 (the optimal for infinite iterations)

standardGainCk :: Double -> Double -> [Double]Source

Standard gain sequence for c_k

semiautomaticTuning :: Int -> Double -> Double -> StateSPSA ()Source

Set semiautomatic tuning for the gain sequences | c should be about the standard deviation of a measurement | a is set how much you want the first iteration to move | A is set to be 10% of expected iterations | alpha and gamma are set to the lowest values for best finite iteration performance (not infinitely optimal)