Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argo
hbandit
Commits
5533471e
Commit
5533471e
authored
Aug 25, 2020
by
Valentin Reis
Browse files
[style] Formatting code, removing useless CI rule.
parent
0502207c
Pipeline
#11192
failed with stages
in 7 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
5533471e
...
...
@@ -27,13 +27,6 @@ make:shellcheck:
-
nix
script
:
nix-shell -p gnumake --run "make shellcheck"
make:dhall-format:
stage
:
source
tags
:
-
kvm
-
nix
script
:
nix-shell -p gnumake --run "make dhall-format"
nix:package:
stage
:
build
tags
:
...
...
src/Bandit/Class.hs
View file @
5533471e
...
...
@@ -51,6 +51,7 @@ import System.Random
-- * @l@ is a superset of admissible losses \(\mathbb{L}\) (statically
-- known).
class
Bandit
b
hyper
a
l
|
b
->
l
,
b
->
hyper
,
b
->
a
where
-- | Init hyper returns the initial state of the algorithm and the
-- first action.
init
::
(
RandomGen
g
)
=>
g
->
hyper
->
(
b
,
a
,
g
)
...
...
@@ -63,6 +64,7 @@ class Bandit b hyper a l | b -> l, b -> hyper, b -> a where
--
-- * @er@ is an expert representation (see 'ExpertRepresentation')
class
(
ExpertRepresentation
er
s
a
)
=>
ContextualBandit
b
hyper
s
a
l
er
|
b
->
l
,
b
->
hyper
,
b
->
s
,
b
->
a
,
b
->
er
where
-- | Init hyper returns the initial state of the algorithm
initCtx
::
hyper
->
b
...
...
src/Bandit/EpsGreedy.hs
View file @
5533471e
...
...
@@ -87,17 +87,17 @@ data EpsGreedyHyper a r
-- | The variable rate \(\epsilon\)-Greedy MAB algorithm.
-- Offers no interesting guarantees, works well in practice.
instance
(
Rate
r
,
Eq
a
)
=>
Bandit
(
EpsGreedy
a
r
)
(
EpsGreedyHyper
a
r
)
a
Double
where
init
g
(
EpsGreedyHyper
r
(
Arms
(
a
:|
as
)))
=
(
EpsGreedy
{
t
=
1
,
rate
=
r
,
lastAction
=
a
,
params
=
InitialScreening
$
Screening
{
screened
=
[]
,
screenQueue
=
as
}
params
=
InitialScreening
$
Screening
{
screened
=
[]
,
screenQueue
=
as
}
},
a
,
g
...
...
src/Bandit/Exp3.hs
View file @
5533471e
...
...
@@ -63,6 +63,7 @@ instance
(
Eq
a
)
=>
Bandit
(
Exp3
a
)
(
Arms
a
)
a
(
ZeroOne
Double
)
where
init
g
(
Arms
as
)
=
(
Exp3
{
t
=
1
,
...
...
src/Bandit/Exp4R.hs
View file @
5533471e
...
...
@@ -93,6 +93,7 @@ instance
(
Eq
a
,
ExpertRepresentation
er
s
a
)
=>
ContextualBandit
(
Exp4R
s
a
er
)
(
Exp4RCfg
s
a
er
)
s
a
(
Maybe
Feedback
)
er
where
initCtx
Exp4RCfg
{
..
}
=
Exp4R
{
t
=
1
,
...
...
src/Bandit/UCB.hs
View file @
5533471e
...
...
@@ -58,18 +58,18 @@ toW (loss, action) = Weight loss 1 action
-- | The variable rate \(\epsilon\)-Greedy MAB algorithm.
-- Offers no interesting guarantees, works well in practice.
instance
(
InvLFPhi
p
,
Eq
a
)
=>
Bandit
(
UCB
a
p
)
(
UCBHyper
a
p
)
a
(
ZeroOne
Double
)
where
init
g
(
UCBHyper
invLFPhiUCB
alphaUCB
(
Arms
(
a
:|
as
)))
=
(
UCB
{
t
=
1
,
alpha
=
alphaUCB
,
invLFPhi
=
invLFPhiUCB
,
lastAction
=
a
,
params
=
InitialScreening
$
Screening
{
screened
=
[]
,
screenQueue
=
as
}
params
=
InitialScreening
$
Screening
{
screened
=
[]
,
screenQueue
=
as
}
},
a
,
g
...
...
tests/Bandit/TypesTest.hs
View file @
5533471e
{-#language TypeSynonymInstances#-}
{-# LANGUAGE TypeSynonymInstances #-}
module
Bandit.TypesTest
where
import
Bandit.Types
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment