Commit decc2c3a authored by Valentin Reis's avatar Valentin Reis
Browse files

[doc] adds missing docstrings.

parent e3375e39
Pipeline #10623 passed with stages
in 30 seconds
......@@ -135,7 +135,7 @@ ormolu:
'
.PHONY: doc
doc: hbandit.cabal hbandit.nix nbconvert
doc: hbandit.cabal hbandit.nix
@nix-shell -E '
with import <nixpkgs> {};
with haskellPackages;
......@@ -147,37 +147,6 @@ doc: hbandit.cabal hbandit.nix nbconvert
cabal v2-haddock hbandit --haddock-internal
'
.PHONY: nbconvert
nbconvert:
nix-shell --run "jupyter-nbconvert docs/index.ipynb"
README.md: extras/readme.md
@nix-shell --pure -E '
with import <nixpkgs> {};
with haskellPackages;
mkShell {
name="pandoc-tools";
buildInputs = [
inline-r
data-default
aeson
pretty-simple
panhandle
pandoc-citeproc
panpipe
pandoc
pkgs.which
cabal-install
R];
R_LIBS_SITE = "$${builtins.readFile r-libs-site}";
}
' --run bash <<< '
pandoc -t markdown_strict --filter $$(which pandoc-citeproc) -s $< -o $@
'
.PHONY:ihaskell
ihaskell:
nix-shell default.nix -A ihaskell --run "ihaskell-notebook"
.PHONY:clean
clean:
rm -rf .build
......
......@@ -92,10 +92,10 @@ instance Rate FixedRate where
instance Rate InverseSqrtRate where
toRate x t = coerce x / sqrt (fromIntegral t)
-- | InvLFPhi r is the inverse of the legendre-fenchel transform
-- of the convex function \(\Phi\) that parametrizes an UCB learner.
-- | InvLFPhi r is the inverse of the Legendre-Fenchel transfor
-- of the convex function \(\phi\) that parametrizes an UCB learner.
--
-- @toRate r@ returns the rate schedule.
-- @toInvLFPhi r@ returns the inverse of the LF transform of \(phi\).
class InvLFPhi a where
toInvLFPhi :: a -> Double -> Double
......
......@@ -31,6 +31,7 @@ import Data.Generics.Labels ()
import Protolude
import System.Random
-- | The state holder for the \(\epsilon\)-Greedy algorithm.
data EpsGreedy a r
= EpsGreedy
{ t :: Int,
......@@ -40,7 +41,11 @@ data EpsGreedy a r
}
deriving (Show, Generic)
data Params a = InitialScreening (Screening a) | Started (ExploreExploit a)
-- | Params a is used to distinguish between initial screening for values
-- and an ongoing exploration/exploitation process.
data Params a
= InitialScreening (Screening a)
| Started (ExploreExploit a)
deriving (Show, Generic)
-- | Still screening for initial estimates
......
......@@ -33,6 +33,7 @@ zero = unsafeRefine 0
one :: (Ord a, Num a) => ZeroOne a
one = unsafeRefine 1
-- | Turns a loss into a reward and vice-versa.
rewardCostBijection :: (Ord a, Num a) => ZeroOne a -> ZeroOne a
rewardCostBijection x = unsafeRefine (1 - unrefine x)
......@@ -45,11 +46,16 @@ newtype ObliviousRep a
= ObliviousRep (Protolude.NonEmpty (ZeroOne Double, a))
deriving (Show, Generic)
-- | A fixed rate schedule.
newtype FixedRate = FixedRate Double
deriving (Show, Generic)
-- | A rate schedule decreasing with \(1/\sqrt{t}\)
newtype InverseSqrtRate = InverseSqrtRate Double
deriving (Show, Generic)
-- | The inverse of the Lagrange-Fenchel function of
-- \(\phi(\Lambda) = \Lambda^2 / 8 \). Together with \(\Alpha=4\),
-- this is the hyperparameter for UCB1.
data AlphaUCBInvLFPhi = AlphaUCBInvLFPhi
deriving (Show, Generic)
......@@ -24,6 +24,7 @@ import Data.List.Extras.Argmax
import Protolude
import Refined
-- | Hyperparameter for \((\alpha,\phi)\)-UCB
data UCBHyper a r
= UCBHyper
{ invLFPhiUCB :: r,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment