Safety Aware Changepoint Detection for Piecewise i i . Bandits
Abstract
In this paper, we consider the setting of piecewise i.i.d.
bandits under a safety constraint.
In this piecewise i.i.d.
setting, there exists a ﬁnite number of changepoints where the mean of some or all arms change simultaneously.
We introduce the safety constraint studied in Wu et al.
[2016] to this setting such that at any round the cumulative reward is above a constant factor of the default action reward.
We propose two actively adaptive algorithms for this setting that satisfy the safety constraint, detect changepoints, and restart without the knowledge of the number of changepoints or their locations.
We provide regret bounds for our algorithms and show that the bounds are comparable to their counterparts from the safe bandit and piecewise i.i.d.
bandit literature.
We also provide the ﬁrst matching lower bounds for this setting.
Empirically, we show that our safety-aware algorithms perform similarly to the state-of-the-art actively adaptive algorithms that do not satisfy the safety constraint.
INTRODUCTION
Consider a startup XYZ that wants to maximize revenue collection from ad placements when users land on their webpage.
Revenue is generated when users click on the ads.
The user preferences change over time but not quickly enough so that XYZ can focus on maximizing the revenue collection for some time before changing its strategy again.
To do this XYZ must detect the user’s new preferences and modify its suggestions.
Due to budget constraints XYZ must make sure that the aggregate revenue collection must not fall below a certain threshold.
The difﬁculty is that
XYZ does not know placing which ads will surely result in revenue above the threshold.
This constrains XYZ from randomly placing different ads on their landing webpage.
On consultation with the industry experts XYZ comes up with a default action that is known historically to be a highly favored by users.
Hence, XYZ comes up with a new safety constraint such that when their algorithm is unsure of which ad to place for some user it can fall back on this default action.
The learning algorithm now has to balance between exploration under safety constraints and exploitation in this slowly changing environment.
The dilemma faced by XYZ can be modeled as a sequential decision making problem in the piecewise i.i.d.
bandit setting under safety constraints.
In the piecewise i.i.d.
bandit setting the learner is provided with a set of arms i ∈ { 0 , 1 , 2 , . . .
, K } where we index the default arm (baseline) as i = 0 , and there exists a ﬁnite number of changepoints where the mean µ i of one or more arms may change simultaneously.
At every round s ∈ { 1 , 2 , . . .
, T } the learner selects an action I s ∈ { 0 , 1 , 2 , . . .
, K } and observes the feedback
X I s ( s ) where E [ X I s ( s )]
=: µ I s ( s ) .
Deﬁne i ∗ as the optimal arm such that µ i ∗ ( s ) >
µ i ( s ) for all i .
The goal of the learner is to maximize reward by quickly ﬁnding the optimal arm i ∗ under the following safety constraint
[Equation]
for all t ∈ { 1 , . . .
, T } , where α ∈ (0 , 1] is the risk parameter, and T is the horizon.
The constraint in eq.
(1) represents how much the learner is allowed to risk in conducting the exploration.
For example, if α → 0 the learner is expected to sample arms that are at least better than the baseline arm 0 .
The baseline arm represents expert’s belief over the current user preferences and may change over time.
Similar to the setting of Wu et al.
[2016] we assume that the mean of the baseline arm is not known to the learner.
Note that Wu et al.
[2016] is not suited for the piecewise i.i.d setting.
By change of belief of the expert we mean that only the value of the baseline arm changes and not the index.
The challenge in our setting is three-fold: 1) Ensure that the safety constraint (1) on cumulative reward is satisﬁed.
Consider the scenario where the risk parameter α = 1 .
In this case satisfying the eq.
(1) is easy as choosing any arm satisﬁes the constraint.
However as α → 0 maintaining the safety constraint becomes difﬁcult as exploration becomes limited or it will violate the safety constraints.
Adapt to the piecewise i.i.d.
nature of the environment.
Observe that as the means of arms change abruptly at changepoints the algorithm must adapt or the safety constraint will be violated.
Further, to detect changepoints the algorithm must conduct additional exploration without violating the eq.
Note that Wu et al.
[2016] do not consider any such piecewise i.i.d.
setting.
3) Finally, minimize the cumulative regret by quickly ﬁnding the optimal arm for each of the time segment between two changepoints.
Our contributions are as follows:
1) We formulate the novel piecewise i.i.d.
bandit setting under safety constraints.
We show that the current state-ofthe-art conservative algorithms [Wu et al., 2016] as well as the changepoint detection algorithms are not equipped to handle the safety constraint in eq.
(1) in this setting.
We propose two actively adaptive algorithms that detect changepoints and restart by erasing past history of interactions.
Simultaneously these algorithms ensure that the safety constraint is satisﬁed.
The current changepoint detection algorithms [Besson and Kaufmann, 2019, Mukherjee and Maillard, 2019, Besson et al., 2020] do not take into account the safety constraint and hence are not suited for our setting.
We provide theoretical guarantees for both of our algorithms and uncover new problem dependent terms that depends on the optimality gaps, changepoint gaps, the gap of the baseline arm, and the risk parameter α .
We also provide the ﬁrst matching lower bounds for this setting.
Empirically we show that our proposed methods perform comparably against safety oblivious changepoint detection algorithms.
RELATED WORKS
Our work lies at the intersection of two interesting areas: 1) Changepoint detection in piecewise i.i.d bandits, and 2)
Safe Sequential Decision Making.
In piecewise i.i.d bandits it is assumed that the change of mean (drift) of an arm are well separated and signiﬁcant enough to be detected.
The previous works in this setting are broadly classiﬁed into two groups, viz.
passively adaptive and actively adaptive algorithms.
Passively adaptive algorithms such as Discounted
UCB (D-UCB ) [Kocsis and Szepesvári, 2006], Sliding Window UCB (SW-UCB )
[Garivier and Moulines, 2011], and
Discounted Thompson Sampling (D-TS )
[Raj and Kalyani, 2017] do not try to detect the changepoints and only focus on minimizing the regret over a short window of the time horizon.
On the contrary, actively adaptive algorithms such as EXP3.R [Allesiardo et al., 2017], CD-UCB
[Liu et al., 2017], CUSUM [Liu et al., 2017], M-UCB
[Cao et al., 2018], GLR-UCB [Besson and Kaufmann, 2019, Besson et al., 2020], Ad-Switch [Auer et al., 2019], and UCB-CPD [Mukherjee and Maillard, 2019] try to detect the changepoints and restart by erasing all the past history of interactions.
Actively adaptive algorithm like GLR-UCB, M-UCB,
UCB-CPD has several advantages over passively adaptive algorithms.
In environments where the changepoint gaps are large and well-separated the passively adaptive algorithms perform poorly (see [Besson and Kaufmann, 2019]).
The EXP3.R (an adaptive version of EXP3.S [Auer et al., 2002b]) is more pessimistic than other actively adaptive algorithms like UCB-CPD, GLR-UCB as it uses the conservative exponential weighting algorithm EXP3 for changepoint detection, and hence, performs poorly in practice.
GLRUCB uses the Bernoulli generalized likelihood ratio test involving Kullback Leibler (KL) based divergence function as changepoint detector.
The KL divergence function of
GLR-UCB better exploits the geometry of (sub-)Bernoulli distributions and so it outperforms M-UCB, Ad-Switch .
Note that none of the above algorithms are safety aware.
The safe sequential decision making setup has recently garnered a lot of attention in machine learning [Amodei et al., 2016, Turchetta et al., 2019].
Closer to our setting are the works that study regret minimization in bandits under safety constraints such as Wu et al.
[2016], Kazerouni et al.
Amani et al.
[2019], Garcelon et al.
These works encode their safety requirements in the form of constraints on the cumulative rewards observed by the learner.
This setup also called conservative bandits as the exploration is constrained by the constraints on the cumulative reward.
Note that while Wu et al.
[2016] studies the unstructured stochastic and adversarial bandit setting, the Kazerouni et al.
[2017], Amani et al.
[2019], Garcelon et al.
[2020] study the linear bandit (structured) setting.
Another line of related work [Moradipari et al., 2020, Pacchiano et al., 2020,
Khezeli and Bitar, 2020] focuses on the idea of stagewise safety constraint where at every stage (round) the reward should be higher than a predetermined safety threshold with high probability.
Note that our setting of safety constraints on cumulative rewards cannot be directly applied to the stagewise setting.
None of the above works deal with the setting of piecewise i.i.d bandits with slow drift (change of means).
Note that while Wu et al.
[2016] studies an adversarial setting, they do not take any assumption on the reward distributions and hence their exploration scheme is highly conservative for piecewise i.i.d.
bandits.
Similarly, conservative bandits studying the contextual (structured) bandit setting [Kazerouni et al., 2017] do not use the known information about slow drift of means.
Finally note that our setting is different than the thresholding bandit problem [Locatelli et al., 2016, Mukherjee et al., 2017] where the goal is to ﬁnd all the arms above a ﬁxed threshold B under the ﬁxed budget setting.
Notations: Denote [ n ] := { 1 , 2 , . . . , n } .
Deﬁne the set of arms as [ K ] indexed from i = 1 , 2 , . .
, K .
The baseline arm is denoted by the index 0 .
Note that the learner knows the index of the baseline arm but it does know the mean of the baseline arm.
This is similar to the setting in Wu et al.
We deﬁne the set
[ K ] + :=
[ K ] ∪ { 0 } to indicate that baseline arm 0 is included as well.
We deﬁne the mean of the arm i at round s as µ i ( s ) , and the empirical mean of the arm till round t as (cid:98) µ i ( t ) .
We denote the optimal arm as i ∗ and the mean of the optimal arm at round s as µ i ∗ ( s ) .
The reward of the arm i sampled at round s is denoted by X i ( s ) .
We assume that the rewards are coming from a bounded distribution supported on [0 , 1] .
We further denote the distribution of the i -th arm with mean µ i ( t ) as ν ( µ i ( t )) .
We denote the horizon (total rounds) as
T .
The safety threshold is denoted by B and the risk parameter is denoted by α ∈ [0 , 1] .
For brevity we denote the sequence of rounds between s to t as s : t .
For clarity of presentation we overload the notation µ i ( · ) to denote either the mean at round s as µ i ( s ) or the mean over the rounds 1 : t as µ i (1 : t ) .
Similarly, N (1 : t ) denotes that number of pulls of i from 1 : t .
Deﬁne the empirical mean (cid:98) [Equation] i
[Equation]
[Equation]
[Equation]
where I s denotes the arm pulled at round s .
3 GLOBAL CHANGEPOINT DETECTION
We now deﬁne the setup for the Global Changepoint Setting (GCS).
Let the total number of changepoints till round T be denoted by G T such that
[Equation]
We deﬁne the global changepoints t c 0 < t c 1 < t c 2 < . . .
< t c GT such that the g -th global changepoint is deﬁned as: t c g :=
inf { s > t c g − 1 : ∀ i ∈
[ K ] + , µ i ( s − 1) (cid:54) =
µ i ( s ) } .
Hence at a global changepoint t c g the mean of all the arms i ∈ [ K ] + change simultaneously.
Let t c 0 = 1 by convention.
Note, that the baseline mean changes at changepoints to signify the new belief of the experts based on updated user preferences.
We deﬁne the changepoint segment between t c g to t c g +1 − 1 as ρ g .
Note that the optimal arm for each changepoint segment ρ g may or may not be same.
We further deﬁne a few notations.
Let the conﬁdence width of arm i for rounds 1 : t be deﬁned as
[Equation]
with the standard condition that if N i (1 : t ) =then β i (1 : t, δ ) = ∞ .
In our case it sufﬁces to take the leading constant of β i (1 : t, δ ) as 2 , though tighter bounds are known and can be used in practice, e.g. Balsubramani [2014], Tanczos et al.
[2017], Howard et al.
These type of anytime bounds constructed with β
i (1 : t, δ ) are known to be tight in the sense that P ( (cid:83) ∞ t =1 {| (cid:98) µ i (1 : t ) − µ i (1 : t ) | ≥ β
i (1 : t, δ ) } ) ≤ δ and that there exists an absolute constant C ∈ (0 , 1) such that P ( {| (cid:98) µ i (1 : t ) − µ i (1 : t )
| ≥ Cβ i (1 : t, δ ) for inﬁnitely many t ∈ N } ) = 1 by the Law of the Iterated Logarithm [Hartman and Wintner, 1941].
Next we deﬁne the upper conﬁdence bound for i as
[Equation]
and the lower conﬁdence bound from 1 : t as
[Equation]
(cid:98)
[Equation]
We deﬁne the UCB arm u t at round t as
[Equation]
which is the arm with the highest uncertainty and needs to be explored more to get a better estimate of its true mean
[Agrawal, 1995, Auer et al., 2002a].
Finally, we deﬁne the empirical safety budget as
[Equation]
which quantiﬁes by how much the safety constraint is being violated.
Also recall that the baseline arm is indexed as 0 , and the learner does not know the mean of the baseline arm.
This is similar to the second setting in Wu et al.
3.1 SAFE GLOBAL RESTART ALGORITHM
In this section we introduce the Safe Global Restart (SGR) algorithm which is a safety aware global changepoint detection algorithm.
SGR is an actively adaptive algorithm and so it restarts by erasing the history of interactions once it detects a changepoint.
We deﬁne the parameter r i for the i -th arm as the last restart round when a changepoint was detected and the arm i history was erased.
We deﬁne the last restart vector
[Equation]
, r K } ∪ { r 0 } .
The safety budget for the GCS is (cid:98) Z
[Equation]
where, ( a ) follows because when a changepoint is detected the history is erased for that arm
i ∈
[ K + ] .
We now state the main aspects of SGR .
SGR is initialized by sampling each arm once.
Then at every round SGR decides to pull the UCB arm u t if (cid:98) Z (1 : t ) ≥ 0 or the baseline arm if (cid:98) Z (1 : t ) < 0 .
Then SGR samples the next arm, observes the reward
X
I t ( t ) and updates the problem parameters.
Finally SGR calls the CPD changepoint detector sub-routine to detect any changepoint.
If a changepoint is detected at round t by CPD then it erases the history of interactions for all arms (including baseline arm) and sets the restarting time for all arms i ∈
[ K ] + as r i = t .
We state the pseudo-code of the policy SGR in Algorithm 1 and the key idea behind
CPD in the following Section 3.2.
1: Input: Risk parameter α ∈ [0 , 1) 2: Set r i =1 , ∀ i ∈
[ K ] + .
Pull each arm once.
3: for t = K +
+ 1 , K + + 2 , . . .
do 4: if (cid:98) Z ( t ) ≥ 0 then 5:
Set I t =
u t from eq.
(6) (cid:46) Pull UCB arm 6: else if (cid:98) Z ( t ) < 0 then 7:
Set I t =(cid:46)
Baseline arm 8:
Pull I t and observe X I t ( t ) .
Update (cid:98) µ I t ( r I t : t ) , N I t ( r I t : t ) , and (cid:98) Z ( r I t : t ) in eq.
Call CPD ( r , t, global ) (cid:46) Call CPD
3.2 CHANGEPOINT DETECTION
The sequential changepoint detection has a long history in the statistical community [Basseville et al., 1993, Wu, 2007].
We explain the sequential changepoint detection through the following example: Consider a single arm i .
Let at some round t we have a collection of i.i.d.
samples
X i (1) ,
X i (2) , . . .
, X i ( t ) from a bounded distribution that is supported on [0 , 1] .
The goal of changepoint detection is to ﬁnd out whether all the t samples have come from the same distribution with mean µ i (1 : t ) or there exist a changepoint τ c g ∈ N such that X i (1) ,
X i (2) , . . .
, X i ( τ c g − 1) have mean µ i (1 : τ c g − 1) while X i ( τ c g ) ,
X i ( τ c g + 1) , . . .
, X i ( t ) have a different mean µ i ( τ c g : t ) (cid:54) =
µ i (1 : τ c g − 1) .
For notational convenience let us denote µ i (1 : τ c g ) as µ (cid:48) and µ i ( τ c g + 1 : t ) as µ (cid:48)(cid:48) respectively.
Hence, a sequential changepoint detector is deﬁned as a stopping time τ chg < ∞ that rejects the null hypothesis H 0 :
( ∃ µ (cid:48) : ∀ i ∈ N , E
[ X i ] = µ (cid:48) ) in favor of the alternate hypothesis
H 1 : ( ∃ µ (cid:48)(cid:48) (cid:54) = µ (cid:48) , τ c g ∈ N : X i (1) , X i (2) , . . .
, X i ( τ c g ) ∼ ν ( µ (cid:48) ) , and X i ( τ c g +1) , X i ( τ c g +2) ,. . .
,X i ( t ) ∼ ν ( µ (cid:48)(cid:48) )) .
Previous works have studied the Generalized Likelihood
Ratio Test (GLRT) to detect the changepoints using this hypothesis testing idea.
Many of the previous works [Wilks, 1938, Siegmund and Venkatraman, 1995, Maillard, 2019,
Besson and Kaufmann, 2019, Besson et al., 2020] that have studied this setting used Generalized Likelihood Ratio Test (GLRT) to detect changepoints.
The GLRT test works as follows:
We ﬁrst calculate the GLRT statistic deﬁned by log
[Equation]
[Table]
where we denote the term L ( X i (1) , . .
, X i ( t ); µ (cid:48) ) and
L ( X i (1) , . . .
, X i ( t ); µ (cid:48) , µ
[Table]
, τ ) as the likelihood of the ﬁrst t observations under hypothesis H 0 and H 1 respectively.
Now if the GLRT statistic crosses a threshold (cid:101) β ( t, δ ) then it indicates that there exists a changepoint and the null hypothesis H 0 is rejected.
A similar type of test, called the
CUSUM test
[Page, 1954, Liu et al., 2017] has also been studied where the distributions ν ( µ 1 ) and ν ( µ 2 ) are completely known.
Note that GLRT works in the case when both distributions are unknown but they come from the same canonical exponential family.
A detailed discussion on this can be found in Maillard [2019].
Conﬁdence-based scan statistic: An alternative to the
GLRT based scan statistics is the conﬁdence-based scan statistic that have been studied in Mukherjee and Maillard [2019].
In the conﬁdence based scan statistic the total number of samples of arm i from 1 : t is divided into slices, and for each slice s a conﬁdence interval is built of the form (cid:98) µ i (1 : s ) ±
β i (1 : s, δ ) and (cid:98) µ i ( s + 1 : t ) ±
β i ( s + 1 : t, δ ) (9) where β i (1 : s, δ ) is from eq.
Now if there exists some s at which the conﬁdence intervals do not overlap such that
[Equation]
then report a changepoint at s .
Besson et al.
[2020] show that GLRT outperforms the conﬁdence-based scan statistic as it better exploits the geometry of the Bernoulli distributions.
In our work we use the conﬁdence-based scan statistic as our goal is not to compete in the vanilla changepoint detection setting but to derive novel bounds for the safety aware piecewise i.i.d.
setup proposed in this work.
Finally, we propose the CPD changepoint detector subroutine which is similar to the UCB-CPD algorithm in
Mukherjee and Maillard [2019].
The CPD takes input the restart vector r , current time t , and the type ∈ { global , local } indicating whether it is a global or a local changepoint setting.
In this section we only discuss the global setting while the local setting is discussed in Section 5.
The CPD divides the total rounds r i : t into ( t − r i ) slices for each arm
i ∈
[ K ] + and then proceeds to conduct the conﬁdence-based scan statistics as discussed in (10).
If there is a disjoint slice s then CPD reports a changepoint at s , then erases the history of interactions (including the baseline arm) and resets the restarting round counter r i ,
∀ i ∈
[ K ] + to the current time t .
We also reset the safe budget (cid:98) Z (1 : t ) to 0 .
Ideally in practice we can still continue the accrued safe budget to the next changepoint section from τ c g +1 +without setting it to 0 , but this makes our theoretical analysis more tedious.
Algorithm 1: for i = 1 , 2 , . . .
, K
+ do 2: for t (cid:48)
=
r i , r i + 1 , . . .
, t do 3: if L i ( r i : t (cid:48) ) <
U i ( t (cid:48) + 1 : t ) or U i ( r i : t (cid:48) ) >
L i ( t (cid:48) + 1 : t ) then 4: if type = global then 5: { (cid:98) µ j ( r i : s ) , N j ( r i : s ) } ts = r j = { 0 , 0 } ts = r j , ∀ j ∈ [ K + ] .
Set r j = t, ∀ j ∈
[ K + ] .
Set (cid:98) Z (1 : t ) = 0 .
6: else 7: { (cid:98) µ i ( r i : s ) , N i ( r i : s ) } ts = r
i
= { 0 , 0 } ts = r
i , r i = t .
Set (cid:98) Z (1 : t ) = 0 .
3.3 REGRET ANALYSIS FOR SGR
We denote the time interval segment ρ g :=
[ t c g , t c g +1 − 1] so that the segment ρ g starts at round t c g and ends at t c g +1 − 1 .
Let µ i,g denote the mean of arm i for the segment ρ g .
Let the changepoint gap between the segments ρ g and ρ g +1 be ∆ chgi,g :=
| µ i,g − µ i,g +1 | .
We redeﬁne the optimality gap for the segment ρ g as ∆ opti,g :=
µ i ∗ ,g − µ i,g .
Let τ c g denote the ﬁrst round when the changepoint t c g is detected and SGR is restarted.
Then we deﬁne the quantity N chg 0 ,g as the number of times the baseline arm is sampled from rounds t c g till the detection of changepoint at τ c g .
Finally, we deﬁne the delay of detection of the g -th changepoint as
[Equation]
such that SGR detects the change at t c g within t c g + 1 till t c g + d g rounds with probability greater than 1 − δ .
We deﬁne the quantity B ( T, δ )
=
16 log(4 log 2 ( T/δ )) .
The quantity
N chg 0 ,g denotes the number of samples of the baseline arms after the changepoint t c g has occurred but not detected and is deﬁned by
[Equation]
Intuitively, N chg 0 ,g is the number of samples required after t c g has occurred and the safe budget (cid:98) Z (1 : t ) falls below 0 .
In N chg 0 ,g if α is very small, we can still explore other arms as long as the baseline arm 0 is close to the optimal arm µ ∗ i,g (so that ∆ opt 0 ,g is small) while the other arms are clearly sub-optimal (i.e. the ∆ opti,g are large).
If this happens then the sub-optimal arms are quickly discarded, while the (cid:98) Z (1 : t ) stays positive and the regret penalty is small.
We now deﬁne a mild assumption on separation of changepoints which is standard in changepoint detection settings (see Besson and Kaufmann [2019], Besson et al.
Without this assumption the changepoints can be too frequent and cannot be detected before the next change happens.
We require this assumption for our theoretical guarantees.
Note that in the experiments we show that even when this assumption does not hold our proposed algorithms performs well.
Assumption 1.
(Separation of changepoints for GCS )
We assume that the for all g ∈ { 0 , 1 , 2 , . . .
, G T } two consecutive changepoints t c g and t c g +1 are separated as t c g +1 − t c g ≥ 2 max { d g , d g +1 } , where d g is stated in (11) .
The Assumption 1 assumes that two consecutive changepoints are separated enough to be detected by the changepoint detector.
Note that our detection delay d g is larger than Besson et al.
[2020] because between t c g : τ c g
the budget (cid:98) Z (1 : t ) may fall below 0 and SGR may need to sample the baseline arm from the next segment ρ g +1 .
We denote an event by ξ and its complement by ξ .
Deﬁne the good event ξ delg that all changepoints g (cid:48) ≤ g have been detected with delay at most d g (cid:48) .
Let the safe budget time set Q (1 : t ) :
= (cid:110) s ∈ [1 : t ] : (cid:98) Z (1 : s ) ≥ 0 (cid:111) be the set of all rounds 1 : t
when (cid:98) Z (1 : s ) ≥ 0 .
We can decompose the expected regret as
[Equation]
(cid:124)
[Equation]
Part
[Equation]
B), Baseline arm pulled, Safe budget
[Equation]
+
[Equation]
(cid:88)
[Equation]
=
[Equation]
(cid:88)
[Equation]
(cid:124)
[Equation]
Part
[Equation] [Equation]
Changepoint
[Equation]
+
[Equation]
(cid:88)
[Equation]
(cid:124)
[Equation]
(cid:125) Part (E), Total Detection Delay Error (cid:21)
[Equation]
(12) which follows by dividing the total rounds till T into G T segments when the changepoint t c g is detected at τ c g . We then further subdivide it into two parts τ c g − 1 : t c g −(rounds before t c g ) and t c g : τ c g − 1 (rounds before detection of t c g .
The four parts (A)-(D) further divides the two time segments τ c g − 1 : t c g − 1 and t c g : τ c g −based on the available safe budget and using the deﬁnition of Q (1 : t ) .
Now using Assumption 1 we can show that two consecutive changepoints are separated enough to correctly control the pulls of the baseline arm, and detect the optimal arm given that ξ del g holds.
The main difference from previous changepoint detection works like Besson and Kaufmann [2019], Mukherjee and Maillard [2019] lies in controlling the detection delay and false alarm under the safety budget constraint.
Using the Assumption 1 and changepoint detection Lemma 3 we can show that the detection delay is bounded by 2 max { d g , d g +1 } with high probability.
We now deﬁne a few problem dependent parameters which is key to analyze the regret of SGR.
We deﬁne the quantity H (1) i,
[Equation]
(cid:27) as the hardness of discarding the sub-optimal arm i and avoiding false detection, the quantity H (2) i,g := max
[Equation]
as the hardness for detecting the changepoint t c g due to i after the changepoint has happened.
Finally, the quantity
H (3) i,g :=
[Equation]
captures the trade-off of selecting the baseline arm 0 once the changepoint t c g occurred.
The regret of SGR is shown below.
Theorem 2.
Let H (1) i,g , H (2) i,g , H (3) i,g is deﬁned above for the segment ρ g .
Then the expected regret of SGR is upper bounded by
[Equation]
[Equation] [Table] In the result of (13) the ﬁrst term is the optimality regret suffered before discarding the arm i when the safety budget (cid:98) Z (1 : t ) ≥ 0 .
The second term denotes the regret suffered for the changepoint detection due to arm i .
The third term is the regret suffered for the section
ρ g − 1 when the safety budget (cid:98) Z (1 : t ) < 0 .
Finally, the fourth term is the regret suffered due to the changepoint t c g and safety budget (cid:98) Z (1 : t ) < 0 .
SGR conducts no forced exploration which results in a fully gap-dependent bound.
This result is different than the gap-dependent bound in Mukherjee and Maillard [2019] which does not contain the third and fourth terms in (13).
The bound in (13) is more informative than Corollary 1 as it correctly captures the dependence with respect to gaps for each segment ρ g .
LOCAL CHANGEPOINT DETECTION
In the Local Changepoint Setting (LCS) at any changepoint at least one arm has a change of mean.
Recall G T from (2).
We then deﬁne the local changepoints t c 0 < t c 1 < . . .
< t c GT such that the g -th local changepoint is deﬁned as t c g :=
inf { s > t c g − 1 : ∃ i ∈
[ K ] , µ i ( s − 1) (cid:54) = µ i ( s ) } .
So at a local changepoint the mean of one or more arms may change simultaneously.
Let G iT :
= # { 1 ≤ s ≤ T | µ i ( s − 1) (cid:54) =
µ i ( s ) } denote the number of changepoints only for the i -th arm.
It follows that G iT ≤ G T but for some arms there could be arbitrary difference between these two quantities.
Note that J T := (cid:80)
Ki =1 G iT ≤
KG T .
Deﬁne t
ic g :=
inf { s > t ic g − 1 : µ i ( s − 1) (cid:54) =
µ i ( s ) } as the g -th changepoint for the i -th arm.
Again t ic 0 =1 for all arms i ∈
[ K ] + by convention.
We denote the segment between rounds t ic g and t ic g +1 − 1 as ρ ig .
Consider the scenario that a learner has ﬁgured out the best arm i in a segment ρ ig
but then at a local changepoint t jc g , an arm j (cid:54)
=
i becomes the new optimal arm (but arm i does not change).
So it will not be able to detect t jc g and will continue sampling arm i .
Hence the leaner need to conduct forced exploration of all arms to have a good estimate of all arms.
This idea is shown in Algorithm 3 where at every round
SLR ﬁrst checks that the safety budget is positive and then either conducts forced exploration of arms with exploration parameters γ (to be deﬁned later) or samples the UCB arm u t .
If the safety budget is negative then SLR samples the baseline arm so that the budget becomes positive and SLR can explore again.
Finally SLR calls the CPD sub-routine with type as "local" to detect local changepoints for an arm.
Once the changepoint is detected it restarts only that arm as this is the local changepoint setting.
The crucial thing to note is that we conduct forced exploration only when safety budget is available (positive).
Algorithm 1: Input: Risk parameter α , exploration factor γ 2: Set r i =1 , ∀
i ∈
[ K + ] .
Pull each arm once.
3: for t = K +
+ 1 , K + + 2 , . . .
do 4: if (cid:98) Z ( t ) ≥ 0 then 5:
if t mod (cid:98) Kγ (cid:99) / ∈
[ K ] then 6:
Set I t =
u t from eq.
(6) (cid:46) Pull UCB arm 7: else if t mod (cid:98) Kγ (cid:99)∈ [ K ] then 8:
Set I t
=
t mod (cid:98) Kγ (cid:99) (cid:46)
Forced Exploration 9: else if (cid:98) Z ( t ) < 0 then 10:
Set I t =(cid:46)
Baseline arm 11:
Pull I t and observe X I t ( t ) .
Update (cid:98) µ I t ( r I t : t ) , N I t ( r I t : t ) ,and (cid:98) Z ( r I t : t ) in eq.
Call CPD ( r , t, local ) (cid:46) Call CPD
4.1 REGRET ANALYSIS FOR SLR
We can extend the analysis of SGR to also bound the regret for SLR.
The key difference between the two analysis is that SLR needs to bound the regret for each segment ρ ig for all arms i ∈ K
+ .
To this effect we ﬁrst redeﬁne changepoint gap for any arm i between the segments ρ ig and ρ ig +1 as ∆ chgi,g :=
| µ i,g − µ i,g +1 | , and the optimality gap as ∆ opt i,g : =
µ i ∗ ,g − µ i,g .
Let τ i c g denote the ﬁrst round when the changepoint t ic g is detected and SLR is restarted for the arm i .
Then we deﬁne detection delay for the changepoint at t ic g as
[Equation]
such that t ic g is detected within t ic g + 1 : t ic g
+ d i,g rounds and γ is the exploration rate of SLR .
Again we denote
B ( T, δ ) = 16 log(4 log 2 ( T/δ )) .
Note that the delay d
i,g scales with the exploration rate γ so that SLR while conducting forced exploration can detect t ic g .
Similar assumption has also been taken in Besson and Kaufmann [2019], Besson et al.
We then deﬁne the following assumption for the separation of changepoints between t ic g and t ic g +1 .
Again note that this assumption is only required for theoretical guarantees.
Empirically we show that SLR performs well even when the Assumption 2 is violated.
Assumption 2.
(Separation of changepoints for LCS )
We assume that the for all g ∈ { 0 , 1 , 2 , . . .
, G iT } two consecutive changepoints t ic g and t ic g +1 are separated as t ic g +1 − t ic g ≥ 2 max { d i,g , d i,g +1 } , where d i,g is deﬁned in (14) .
Next we introduce the quantity H (2) i,g := ∆ opti,g ( ∆ chgi,g ) 2 as the hardness for detecting the g -th changepoint for the arm i .
Note that in the LCS setting the SLR algorithm is restarted only for the arm i and so in the hardness we do not see the max over all arms like the SGR setting.
Finally using the
Assumption 2 and the same analysis as in Theorem 2 but for each segment ρ ig and each arm i ∈
[ K + ] we bound the regret for SLR in Theorem 3.
Theorem 3.
Let H (1) i,g , H (2) i,g , H (3) i,g is deﬁned above for the segment ρ g .
Then the expected regret of SLR is bounded by
[Equation] O
[Equation]
The result in (15) has a similar interpretation to (13) (but with respect to each arm segment ρ ig instead of global segment ρ g ) except the gap-independent term of γT which results from the forced exploration of arms.
We state the following corollary to summarize the result of SGR and
SLR in the "easy" case when all the gaps are same.
Corollary 1.
(Gap independent bound)
Setting ∆ opti,g = ∆ chgi,g = (cid:113) K log T T for all
i ∈
[ K ] + and exploration rate γ
[Equation]
(cid:113) log T T
we obtain the gap independent regret upper bound of SGR and SLR as
[Equation]
where α is the risk parameter.
Comparing the above result with GLR-UCB (see Proposition 4) we see that SGR (or SLR) picks up an additional factor of 1 / ( µ 0 ,min α ) per changepoint which signiﬁes the hardness of ﬁnding the safe set of actions for maintaining the safety constraint (1).
Further note that SGR suffers an extra factor of K in its bound compared to SLR.
This is because in the GCS setting the algorithm restarts by erasing the history of interactions for all arms.
Hence, our result mirrors a similar observation in Besson et al.
Moreover as α → 0 (risky setting) the regret increases proportionally.
This is similar to the gap-independent bound in Wu et al.
[2016] shown in Proposition 2 which holds for the stochastic setting without any changepoints.
The key takeaway from this result is that the piecewise i.i.d.
setting under safety constraints is no harder than the conservative stochastic setting of Wu et al.
[2016] and piecewise i.i.d.
setting given the changepoints are sufﬁciently separated.
Finally we state the lower bound in the safe GCS setting.
Theorem 3.
(Lower Bound)
Let E , E be two bandit environment and there exits a global changepoint at t c
= T/ 2 .
Let α > 0 be the safety parameter and µ 0 , min be the mean of the minimum safety mean over the changepoint segments.
Then the lower bound is given by E E , E [ R T ] ≥
[Equation]
The proof is given in Appendix A.6 and follows from the change of measure argument.
Additionally, we use the lower bound results from safe bandit setting of Wu et al.
[2016] and changepoint detection setting of Gopalan et al.
[2021] to arrive at the ﬁnal result.
Note that both of these works do not take into account the safe GCS setting.
Finally, comparing the results of Theorem 3 and Corollary 1 we see that SGR matches the lower bound when G T = 1 except a factor of O ( K √ log T ) .
Similarly, since GCS is a special case of
LCS , we see that SLR also matches the lower bound except a factor of O ( K √ log T ) .
EXPERIMENTS
In this section we test SGR and SLR against safety oblivious actively adaptive algorithms GLR-UCB , UCB-CPD as well as passive algorithm D-UCB , and safety aware algorithms CUCB , and UMOSS .
A detailed discussion on the algorithms, hyper-parameter tuning, and time complexity of the algorithms is given in Appendix A.7.
One further experiment showing the performance of SGR , SLR under different values of α is shown in Appendix A.7.
All codes are provided in supplementary material.
Global Changepoint:
In this setting all the arms (including baseline) change at every changepoint.
The environment consist of 6 arms (including baseline) and the evolution of means with respect to rounds is shown in Figure 1 (Left).
The three global changepoints are at t = 2000 , 4000 and 6000 .
We set risk parameter α = 0 .
The performance of all the algorithms is shown in Figure 2 (Left).
The adaptive algorithms like UCB-CPD , GLR-UCB perform well as they detecting the changepoints and restart but they do not satisfy the safety constraints.
Note that SGR performs similar to GLR-UCB , UCB-CPD as it also detects the changepoints and restarts as well as satisfy the safety constraint.
It outperforms passive algorithm D-UCB , and safety aware algorithm CUCB .
The safety aware algorithm CUCB is not suited for the safety constraint (1) under piecewise i.i.d.
setting as it always chooses the baseline arm and fail to achieve sub-linear regret.
Local Changepoint:
In this setting at least one arm changes at every changepoint.
We show that the environment in
Figure 1 (Right) and the performance of all the algorithms in Figure 2 (Right).
The three local changepoints are at t = 2000 , 4000 and 6000 .
We set a constant baseline µ 0 = 0 .
35 , and risk parameter α = 0 .
Again we see that the safety aware algorithm CUCB fail to achieve sub-linear regret as it always chooses the baseline arm.
On the other hand adaptive algorithms like UCB-CPDE , GLR-UCB performs well in detecting the changepoints but they do not satisfy the safety constraints.
Note that SGR performs similar to GLR-UCB ,
UCB-CPD as it also detects the changepoints and restarts as well as satisfy the safety budget.
It outperforms passive algorithm D-UCB , and safety aware algorithm CUCB .
Real Setting: We show a real world experiment on the
Movielens Dataset.
In this experiment none of our modeling assumptions hold.
We experiment with the Movielens dataset from February
[Harper and Konstan, 2016], where there are 6k users who give 1M ratings to 4k movies.
We obtain a rank- 4 approximation of the dataset overusers and 128 movies such that all users prefer either movies 7 , 13 , 16 , or 20 ( 4 user groups).
The movies are the arms and we choose 30 movies that have been rated by all the users.
Hence, this testbed consists of 30 arms and is run over
T = 8000 .
The changepoints are at t = 2000 , t = 4000 , and t = 6000 .
Note that at each changepoint the means of some arms may or may not change so this is LCS .
For every changepoint segment, we uniform randomly sample an user from different user groups to simulate the piecewise i.i.d environment such that there is a change in the optimal arm.
In this environment each arm has has a Gaussian distribution associated with it, where its mean evolve as shown in
Figure 4 (Left).
The baseline arm is set as 0 . 35 .
As shown in Figure 4 (Right), in this environment SLR outperforms all the other algorithms including CUCB and Adv-CUCB .
This is because the means of the arms are close to each other and the baseline arm mean is close to them.
CONCLUSION AND FUTURE WORKS
In this paper we studied the safety aware piecewise i.i.d.
bandits under a new safety constraint.
We proposed two actively adaptive algorithms SGR and SLR which satisfy the safety constraints as well as detect changepoints and restart.
We provided regret bounds on our algorithms and showed how the bounds compare with respect to safety aware bandits as well as adaptive algorithms.
We also provided the ﬁrst matching lower bounds for this setting.
Future works include extending our setting to the rested and sleeping bandit setting under safety constraints.
We also intend to explore experimental design approaches to piecewise i.i.d settings as in Pukelsheim [2006], Mason et al.
[2021], Mukherjee et al.
Finally, incorporating variance aware techniques [Audibert et al., 2009, Mukherjee et al., 2018] may further improve the the performance of our proposed algorithms.
A APPENDIX A.1 PROBABILITY TOOLS, PREVIOUS THEORETICAL RESULTS AND GLRT DISCUSSION
Proposition 1.
(Restatement of Theorem 9.2 in Lattimore and Szepesvári [2020]) Let X 1 , X 2 , . . .
, X T be a sequence of independent σ -subgaussian random variables with E [ X 1 ] =
E [ X 2 ]
= . . .
=
E [ X T ] = 0 and M t = t (cid:80) s
=1 X s .
Then for any ε > 0 ,
P ( exists t
[Equation]
T
[Equation]
(cid:18)
[Equation] [Equation]
(cid:19) .
Proposition 2.
(Restatement of Theorem 2 in Wu et al.
In any stochastic environment where the mean of the arms µ i ∈ [0 , 1] with 1-subgaussian noise, then Conservative UCB (CUCB) satisﬁes the following with probability at least 1 − δ
[Equation]
all t
[Equation] [Equation]
T
[Equation]
(Safety Constraint)
[Equation]
Proposition 3.
(Restatement of Theorem 9 in Wu et al.
[2016]) Let µ i ∈
[0 , 1] for all i ∈ [ K ] and µ 0 satisﬁes the following
[Equation]
Then any algorithm satisﬁes the safety constraint E µ T (cid:80)
[Equation]
,I s ≥ (1 − α ) µ 0 T .
Moreover there is some µ ∈ [0 , 1] K such that the expected regret of the algorithm satisﬁes
[Equation]
Proposition 4.
(Restatement of Corollary 6 and Corollary 9 in Besson et al.
The gap-independent bound of
GLR-UCB when the number of changepoints is unknown, exploration parameter γ = (cid:113) log TT , and conﬁdence δ = 1 √ T is given by
[Equation]
Proposition 5.
(Restatement of Theorem 2 in Gopalan et al.
[2021]) Let 0 < δ ≤ 1 10 and m ≥ 1 be a priori ﬁxed time such that the probability of an admissible change detector stopping before time m under the null hypothesis (no change) is at most δ ∈ (0 , 1) .
Let τ be the stopping time for an algorithm.
Let E ∈ R K and E ∈ R K be two bandit environments consisting of K arms.
Deﬁne E
i as the i -th component of E .
Let P E and P E be two probability measures induced by some
T -round interaction of the algorithm with E and E respectively.
Then for any bandit changepoint algorithm satisfying
P [ τ < m ] ≤ δ , we have
[Equation]
A.2 PROOF OF REGRET BOUND FOR SAFETY AWARE GLOBAL RESTART
Theorem 2.
(Restatement) Let H (1) i,g , H (2) i,g , H (3) i,g is deﬁned above for the segment ρ g .
Then the expected regret of SGR is upper bounded by
[Equation]
[Equation]
Proof.
Step 1 (Regret Decomposition) :
First recall that the safe budget time set Q (
[Equation]
:=
[Equation]
is the set of all rounds 1 : t when (cid:98) Z (1 : s ) ≥ 0 .
Also recall that the ﬁrst round the global changepoint t c g is detected is denoted by τ c g deﬁned as follows:
[Equation]
Let ξ delg ( s ) (to be deﬁned later) denote the good event that all changepoints g (cid:48) ≤ g has been successfully detected before the round s .
We then deﬁne the expected regret till round T as follows:
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
where ( a ) follows by introducing the good changepoint detection event ξ delg ( s ) , ( b ) follows by introducing the safe budget time set Q ( τ c g − 1 : t c g − 1)
[Equation]
and ( c ) follows by taking into account the safe budget time after the changepoint t c g has occurred
[Equation]
Step 2 (Bounding UCB pulls of sub-optimal arm i in part A):
In this step we bound the total number of samples of sub-optimal arm pulled by using the maximum UCB index u t .
E  
[Equation]
where, in ( a ) the N opti,g − 1 is the maximum number of samples before a sub-optimal arm i is discarded in favor of the optimal arm and N chg i,g − 1 is maximum number of samples before the changepoint is detected due to arm i (with high probability).
Next the term d g is the maximum delay for detecting the changepoint t c g due to some other arm i .
Note that we have assumed in Assumption 1 that each changepoint g ∈ [ G T ] are separated by 2 max { d g , d g +1 } .
The inequality in ( b ) follows by dropping the event ξ delg ( s ) .
Step 3 (Bounding Baseline pulls in part B):
In this step we bound the pulls of the baseline arm when the safety budget (cid:98) Z (1 : t ) < 0 .
The breakdown of the total pulls follows the same way as in the previous step.
E 
[Equation] [Equation]
t
[Equation]
 
[Equation] [Equation]
 
[Equation]
 
[Equation] [Equation]
[Table]
[Equation] [Table] [Equation] [Table]
[Equation] [Table] [Equation] [Table]
[Equation] [Table] [Equation] [Table]
[Equation] [Table] [Equation] [Table]
[Equation] [Table] [Equation] [Table]
[Equation] [Table] [Equation] [Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation] [Table] [Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
where, in ( a ) we introduce the optimality pulls of the baseline arm, ( b ) follows as when the good event ξ opt 0 ,g − 1 ( s ) holds then the baseline arm cannot be sampled more than max { N opt 0 ,g − 1 , N bse 0 ,g − 1 } , and ( c ) follows by dropping one event from the intersection.
Step 4 (Bounding Part (C)):
Note that under Assumption 1 the changepoints are separated enough such that the detection delay for the g -th changepoint is deﬁned as
[Equation]
where B ( T, δ ) =
16 log(4 log 2 ( T/δ )) and two consecutive global changepoints are separated by t c g +1 − t c g ≥ 2 max { d g , d g +1 } .
Then we can bound the total pulls of a sub-optimal arm i in Part (C) as follows:
[Equation]
s
[Equation]
 
[Equation]
[Equation]
) 1 { I s =
i, N i ( s ) <
N chg i,g , τ chg g ∈ [ t c g + 1 , t c g + d g ] } 
 + E   (cid:88) s ∈Q ( t cg :
τ cg − 1) 1 { I s =
i, N i ( s ) ≥ N chgi,g , τ chgg ∈ [ t c g + 1 , t c g + d g ] } 
 =
E   (cid:88) s
[Equation]
[Equation]
− 1) 1 { I s =
i, N i ( s ) < N chgi,g , τ c g =
τ ic g , τ chgg ∈
[ t c g + 1 , t c g + d g ] } 
 + E   (cid:88) s ∈Q ( t cg :
τ cg − 1) 1 { I s =
i, N i ( s ) < N chgi,g , τ c g > τ ic g , τ chgg ∈ [ t c g + 1 , t c g + d g ] } 
 + E   (cid:88) s ∈Q ( t cg :
τ cg − 1) 1 { I s =
i, N i ( s ) ≥ N chgi,g , τ c g =
τ ic g , τ chgg ∈
[ t c g + 1 , t c g + d g ] } 

[Equation]
where in ( a ) the max j ∈ [ K ] N chgj,g is the maximum number of samples required to detect the g -th changepoint due to some other arm than
i
[Equation]
Step 5 (Bounding Part (D)):
Again, note that under Assumption 1 the changepoints are separated enough such that the detection delay for the g -th changepoint is deﬁned as
[Equation]
where, B ( T, δ ) = 16 log(4 log 2 ( T/δ )) and two consecutive global changepoints are separated by
[Equation]
Then we can bound the total pulls of a sub-optimal arm i in Part (D) as follows:
[Equation]

 + E  
[Equation]

 =
E   (cid:88)
[Equation]

[Equation]
+ E   (cid:88)
[Equation]
 + E    (cid:88)
[Equation]
0 ,g , τ c g = τ 0 c g , τ chg g ∈ [ t c g + 1 , t c g + d g ] } 
  +
K (cid:88) i =
E   (cid:88) s ∈Q ( t cg :
τ cg − 1) 1 { I s = 0 , N 0 ( s ) ≥ N chgi,g , τ c g > τ 0 c g , τ chgg ∈
[ t c g + 1 , t c g + d g ] } 
 ≤ N chg 0 ,g + max j ∈ [ K ] N chgj,g + (cid:88) s ∈Q ( t cg :
τ cg − 1)
P (cid:16) ξ chg 0 ,g ( s ) (cid:17)
+
K (cid:88)
j = (cid:88) s ∈Q ( t cg :
τ cg − 1)
P (cid:16) ξ chgj,g ( s ) (cid:17) + 4 d g + (cid:88) s ∈Q ( t cg :
τ cg − 1)
P ( ξ delg ( s )) ≤ N chg 0 ,g + max j ∈ [ K ] N chgj,g +
T (cid:88) s =
P (cid:16) ξ chg 0 ,g ( s ) (cid:17)
+
K (cid:88)
j =
T (cid:88) s =
P (cid:16) ξ chgj,g ( s ) (cid:17) + 4 d g +
T (cid:88) s =
P ( ξ delg ( s ))
Step 6 (Controlling the total delay, Part E): We ﬁrst deﬁne the total detection delay good event as follows:
[Equation]
such that the learner detects all the changepoint g ≤ G T with a detection delay of at most d g where
[Equation]
We deﬁne a slightly stronger event than ξ del as follows:
[Equation]
which signiﬁes that all changepoints before g has been successfully detected.
It follows that ξ del ⊆ ξ delg and ξ delg is
F τ chgcg − 1 -measurable.
Then we can show that
[Equation]
where, ( a ) follows from the deﬁnition of ξ chgi,g ( τ c g : t c g : s ) in Lemma
[Equation]
and ( b ) follows from Lemma 3 and setting δ = 1 /t
[Equation]
Step 7 (Combining everything): Combining everything and plugging it in (17) we can show that
E [ R T ] ≤
[Equation]
i = (cid:20)
N chgi,g + max j ∈
[ K ] N chgj,g +
d g + τ cg − 1 (cid:88) s
= t cg
P (cid:16) ξ chgi,g ( s ) (cid:17)
+
K (cid:88)
j = τ cg − 1 (cid:88) s
= t cg
P (cid:16) ξ chgj,g ( s ) (cid:17) (cid:21) ∆ opti,g (cid:124) (cid:123)(cid:122) (cid:125)
Part (C) + (cid:20)
N chg 0 ,g + max j ∈ [ K ] N chgj,g + 4 d g + τ cg − 1 (cid:88) s
= t cg
P (cid:16) ξ chg 0 ,g (cid:17)
+
K (cid:88)
j = τ cg − 1 (cid:88) s
= t cg
P (cid:16) ξ chgj,g ( s ) (cid:17) (cid:21) ∆ opt 0 ,g (cid:124) (cid:123)(cid:122) (cid:125) Part (D)
+
K (cid:88) i =   d g ∆ opti,g + τ cg − 1 (cid:88) s
= t cg
P ( ξ delg ( s ))
∆ opti,g  
(cid:124) (cid:123)(cid:122) (cid:125)
Part (E) (cid:21)
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
max
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
where, ( a ) follows from combining all the steps above
[Equation]
( b ) follows by using the deﬁnition of
[Equation]
and substituting the value of d g .
Finally, ( c ) follows by using the deﬁnition of
[Equation]
i
[Equation]
and dropping the low probability event term as it is dominated by other terms.
The claim of the theorem follows
[Equation]
A.3 PROOF OF REGRET BOUND FOR SAFETY AWARE LOCAL RESTART
Theorem 3.
(Restatement) Let H (1) i,g , H (2) i,g , H (3) i,g is deﬁned above for the segment ρ g .
Then the expected regret of SLR is bounded by
[Equation]
Proof.
Step 1 (Regret Decomposition):
Recall that G iT is the total number of changepoints for the arm i .
We deﬁne the expected regret till round T as follows:
[Equation]
[Table]
[Equation]
i =
[Equation]
G
[Equation]
[Table]
Error
[Equation]
Exploration Pulls
[Equation]
Step 2 (Bounding Part (A) - (D)):
Note that under Assumption 2 the changepoints of each arm i are separated enough such that the detection delay for the g -th changepoint is deﬁned as
[Equation]
where B ( T
[Equation]
δ )
= 16 log(4 log 2 ( T/δ )) and γ is the exploration rate of SLR and two consecutive changepoints of i are separated by
[Equation]
So when the changepoint t ic g is detected and the total detection delay is controlled for the arm i (shown in step 4) we can show using the (17) and steps 2 - 4 that
[Equation]
[Table]
[Equation]
[Table]
[Equation]
Step 3 (Controlling the total delay): We want to control the total detection delay of individual arms i .
Again we deﬁne the total detection delay good event for the i -th arm as follows:
[Equation]
such that the learner detects all the changepoint g ≤ G iT with a detection delay of at most d i,g where
[Equation]
where B ( T, δ ) =
16 log(4 log 2 ( T/δ )) .
We deﬁne a slightly stronger event than ξ deli as follows:
[Equation]
which signiﬁes that all changepoints before g has been successfully detected.
It follows that ξ deli ⊆
ξ deli,g and ξ deli,g is
F τ icg − 1 -measurable.
Then we can show that
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
where, ( a ) follows from the deﬁnition of ξ chgi,g ( τ ic g :
t ic g : s ) in Lemma 3, and ( b ) follows from Lemma 3 and setting δ = 1 /t .
Step 4 (Combining everything): Combining everything and plugging it in (19) we can show that
E [ R T ] ≤
K (cid:88)
[Equation]
) + γT (cid:124)(cid:123)(cid:122)(cid:125)
Part (F)
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]

[Equation]
where, ( a ) follows from combining all the steps above, ( b ) follows by using the deﬁnition of
[Equation]
and substituting the value of d i,g .
Finally, ( c ) follows by using the deﬁnition of
[Equation]
The claim of the theorem follows.
A.4 PROOF OF COROLLARY
Corollary 1.
(Gap independent bound, Restatement) Setting ∆ opti,
g = ∆ chgi,g = (cid:113) K log T T for all
i ∈
[ K ] + and exploration rate γ = (cid:113) log TT we obtain the gap independent regret upper bound of SGR and SLR as
[Equation]
where α is the risk parameter.
Proof.
The proof directly follows from the result of Theorem 2 and Theorem 3.
We ﬁrst recall the result of Theorem 2 below
E [ R t ] ≤ O
[Equation]
Then using the fact that ∆ opti,g = ∆ chgi,g = (cid:113) K log T T for all i ∈ [ K ] + we get that
[Equation]
Substituting all of the above back in Equation (22) and setting δ = 1 T we get that
[Equation]
Next we recall the result of Theorem 3 below
E
[Equation]
(cid:18)  
[Equation]
i =
[Equation]
g
[Equation]
(cid:88)
i
[Equation]
G
[Equation]
g
[Equation]
αµ
[Equation]
g
[Equation]
K (cid:88) i =
H (3) i,g −
[Equation]
K (cid:88) i =
G iT (cid:88) g
=  αµ 0 ,g
K (cid:88) i =
H (3) i,g   log (cid:18) log 2 T δ (cid:19) (cid:19)
+ γT.
Again using the fact that ∆ opti,g = ∆ chgi,g = (cid:113) K log T T for all i ∈ [ K ] + it follows that H (2) i,g = (cid:112) T/K log T .
Substituting this back in (23) we get that
[Equation]
The claim of the corollary follows.
A.5 SUPPORT LEMMA A.5.1 Concentration of the Optimality Event
Lemma 1.
Let X i (1) , X i (2) , . . .
, X i ( t ) be t samples observed for arm i .
Deﬁne the optimality good event ξ opti (1 : t ) :
=
{∀ s ∈ [1 : t ] , | (cid:98) µ
i (1 : s ) − µ i (1 : s ) |≤ β i (1 : s, δ ) } where
β i (1 : s, δ ) :
= (cid:114) 2 log(4 log 2 ( t + 1) /δ )
s .
Then the probability of the event ξ opti (1 : t ) is bounded by
[Equation]
Proof.
We will use the peeling argument to get the desired bound.
We ﬁrst restate the bad event of deviation as
[Equation]
Next we bound the one side of the inequality as follows:
[Equation]
where, ( a ) follows by dividing the rounds till t into geometric grid of size [2 u , 2 u +1 ] , s ≤ (cid:100) log t (cid:101) and M s = (cid:80) st (cid:48)
=
1 ( X i ( t (cid:48) )
− E
[ X i ( t (cid:48) )]) =
(cid:80) st (cid:48)
=1 Y t (cid:48) .
Further note that E [ Y t (cid:48) ]
= 0 , so we can apply the maximal inequality.
Then ( b ) follows by upper bounding s by 2 u
+1 , ( c ) follows by applying Proposition 1, ( d ) follows as σ 2 = 1 , ( e ) follows as with s ≤ (cid:100)
log t (cid:101) we can have (log t + 1) such combinations.
Similarly, we can show that,
[Equation]
Combining the equations (25) and (26) we get that,
[Equation]
It follows then P (cid:0) ξ opti (1 : t ) (cid:1) ≥ 1 − δ .
Hence the claim of the lemma follows.
A.5.2 Critical Samples for Optimality Detection
Lemma 2.
Deﬁne the optimality event ξ opti ( s : t ) as in Lemma 1.
Then the expected number of times the sub-optimal arm i is sampled based on the UCB sampling rule from round 1 till t is given by
[Equation]
where, N opti (1 : t ) = 8 log(4 log 2 ( t + 1) /δ )
(∆ opti ).
Proof.
First note that if a sub-optimal arm i is chosen at round t then U i (1 : s ) >
U i ∗ (1 : s ) .
This is possible under the following three events
[Equation]
Now recall from Lemma 1 that at round s ∈ [ t ] , the event ξ opti (1 : t ) holds with 1 − δ probability.
We deﬁne the optimal stopping time τ opti,s (1 : t ) as follows:
[Equation]
It follows immediately that τ opti,s (1 : t ) is F t − 1 measurable.
Also note that that the third event in (27) is not possible for
[Equation]
Then we can bound the expected number of pulls for any sub-optimal arm i as follows:
[Equation]
The claim of the lemma follows.
A.5.3 Concentration of Changepoint Event
Lemma 3.
Let (cid:98) µ i (1 : s ) be the empirical mean of s i.i.d.
observations with mean µ i (1 : s ) , and (cid:98) µ i ( s + 1 : t ) be the empirical mean of ( t − s ) i.i.d.
observations with mean µ i ( s + 1 : t ) .
Let t
ic g be the round such that µ i ( t ic g ) (cid:54)
= µ i ( t ic g + 1) .
Let at round s the policy raises an alarm following the changepoint good event ξ chgi,g (1 : t ) .
Deﬁne the changepoint good event
[Equation]
} where β i (1 : s, δ ) :
= (cid:114) 2 log(4 log 2 ( t + 1) /δ )
s and
β i ( s + 1 : t, δ ) :
= (cid:114) 2 log(4 log 2 ( t + 1) /δ )
t − s .
Then the probability of the event ξ chgi (1 : t ) is bounded by
[Equation]
Proof.
Recall that (cid:98) µ i (1 : s ) is the empirical mean of s i.i.d.
observations with mean µ i (1 : s ) , and (cid:98) µ i ( s + 1 : t ) is the empirical mean of ( t − s ) i.i.d.
observations with mean µ i ( s + 1 : t ) .
We will again use the peeling argument to get the desired bound.
We ﬁrst restate the good event as follows:
[Equation]
We can then redeﬁne the good event ξ chgi,g (1 : t ) as follows:
[Equation]
We can then deﬁne the bad event from eq.
(28) as follows:
[Equation]
Next we bound the ﬁrst event of the inequality in eq.
(29) in the same way as Lemma 1 as follows:
[Equation]
Similarly, we can show that the second event of eq.
(29) the inequality,
[Equation]
Combining the equations (30), (31), (32) and (33) we get that,
[Equation]
It follows then P (cid:16) ξ chgi,g (1 : t ) (cid:17) ≥ 1 − δ .
The claim of the lemma follows.
A.5.4 Critical Number of samples for Changepoint Detection
Lemma 4.
Let (cid:98) µ i (1 : s ) be the empirical mean of s i.i.d.
observations with mean µ i (1 : s )
=:
µ i,g − 1 , and (cid:98) µ i ( s + 1 : t ) be the empirical mean of ( t − s ) i.i.d.
observations with mean µ i ( s + 1 : t ) =: µ i,g .
Let ∆ chg i,g :=
| µ i,g − 1 − µ i,g | and the changepoint at s + 1 round as t ic g .
Deﬁne the changepoint event ξ chgi,g (1 : t ) as in Lemma 3.
Then the expected number of times the sub-optimal arm i is sampled before a changepoint t ic g is detected is given by
[Equation]
where, N chgi,g (1 : t ) = 8 log(4 log 2 ( t + 1) /δ )
(cid:16) ∆ chgi,g
[Equation]
Proof.
Note that the changepoint t ic g lie between the round 1 and t .
Also note that the mean of the arm i for the rounds 1 : s is given by µ (1 : s )
=:
µ i,g − 1 and for the rounds s + 1 : t is given by µ ( s + 1 : t )
=:
µ i,g .
Then for a sub-optimal arm i it is possible to detect the changepoint at some round s ∈ [1 : t ] under the following two events
[Equation]
Again note that the events in eq.
(34) is not possible if the following events holds true:
[Equation]
and,
[Equation]
Now recall from Lemma 1 that at round t , the event (cid:16) ξ chgi (1 : t ) (cid:17) holds with 1 − δ probability.
We deﬁne the changepoint stopping time τ c g as follows:
[Equation]
It follows that τ c g is F t − 1 measurable.
Also note that that the second event in (35) is not possible for | µ i,g − 1 − µ i,g
[Equation]
<
[Equation] [Equation]
Let N chgi,g (1 : t ) be the total number of samples of arm i before the changepoint t ic g is detected.
Then we can bound the expected number of pulls of N chgi,g (1 : t ) as follows:
[Equation]
The claim of the lemma follows.
A.5.5 Total Number of Samples of Baseline Arm
Lemma 5.
Let us consider a single time segment ρ g starting from round 1 till round t .
When the optimality event ξ opt (1 : t ) holds with high probability 1 − δ in ρ g then the total pulls of the baseline arm is bounded by
[Equation]
Proof.
We ﬁrst deﬁne the estimated budget as follows:
[Equation]
Now note that in eq.
(36) if N 0 (1 : t − 1) <
(1 − α ) t, then the last term is negative and U 0 (1 : t ) ≥ µ 0 (1 : t ) .
Conversely, if N 0 (1 : t − 1) ≥ (1 − α ) t then the constraint is satisﬁed as:
[Equation]
Let τ bse 0 (1 : t ) :
= max { t
[Equation]
∈ [1 : t ] : I t (cid:48)
=
, (cid:98) Z (1 : t (cid:48) − 1) < 0 } be the last round the baseline arm is pulled.
Note that at τ bse 0 (1 : t ) − 1 the safety budget (cid:98) Z ( τ bse 0 ,s (1 : t ) − 1) < 0 .
In the following proof we denote τ = τ bse 0 (1 : t ) for notational convenience.
It then follows that:
[Equation]
= ⇒
K (cid:88)
i
[Equation]
=
⇒ αN 0 (1 : τ − 1) [ U 0 (1 : τ )]
[Equation]
where, ( a ) follows by dropping L u t (1 : τ ) > 0 , and ( b ) follows by introducing
[Equation]
N i
[Equation]
1 : τ − 1) +(cid:33) .
Now note that at the event (cid:84)
Ki =1 ξ opti (1 : t ) , µ 0 (1 : τ ) <
U 0 (1 : τ ) .
Hence, we can lower bound Part A as follows:
[Equation] [Equation]
[Equation]
Similarly we can upper bound Part B as follows:
[Equation]
Now note that at (cid:84)
Ki =1 ξ opti (1 : τ ) we have
[Equation]
where, ( a ) follows for N i (1 : τ ) ≥ 8 log(4 log 2 ( τ + 1) /δ )
[Equation]
with probability greater than 1 − 2 δ .
Then for the Part B we can show that
Part B ≤ (cid:88) i ∈
[ K ]
[Equation]
i
[Equation]
[ K ]
[Equation]
i
[Equation] [Equation]
where, in ( a ) we deﬁne c
i = (1 − α )
[Equation]
− µ
[Equation]
(1 : τ ) , and ( b ) follows by setting N i (1 : τ − 1) ≥ 8 log(4 log 2 ( τ + 1) /δ )
(∆ opti (1 : τ )).
Now for c i ≥
we can show that
[Equation]
Again for c i <
we can show that
[Equation]
Combining everything we can show that
[Equation]
where
[Equation]
( a ) follows as
[Equation]
Now considering the g -th changepoint we can show that
[Equation]
The claim of the lemma follows.
A.6 LOWER BOUND IN SAFE GLOBAL CHANGEPOINT SETTING
Theorem 3.
(Restatement)
Let E , E be two bandit environment and there exits a global changepoint at t c
= T/ 2 .
Let α > 0 be the safety parameter and µ 0 , min be the mean of the minimum safety mean over the changepoint segments.
Then the lower bound is given by
[Equation]
Step 1 (Safe Risk): Consider a setting with a single changepoint g .
For the segment ρ 0 from t = 1 to t c 1 − 1 deﬁne the environment E ∈ [0 , 1] K such that µ i (1 : t c 1 − 1) =
µ 0 (1 : t c 1 − 1) − ∆ for all i ∈
[ K ] .
We assume that µ 0 (1 : t c 1 − 1) and ∆ are such that µ i (1 : t c 1 − 1) ≥ 0 .
Deﬁne environment E ( i ) for each i = 1 , . . .
, K by
[Equation]
for j = i
[Equation]
∆
[Equation]
otherwise.
Similarly for the segment ρ 1 from t c 1 to T deﬁne the environment E ∈ [0 , 1] K such that µ i ( t c 1 : T ) =
µ 0 ( t c 1 : T ) − ∆ for all i ∈
[ K ] .
Again, we assume that µ 0 ( t c 1 : T ) and ∆ are such that µ i ( t c 1 : T ) ≥ 0 .
Deﬁne environment E ( i ) for each i = 1 , . . .
, K by
[Equation]
otherwise.
where, ∆ (cid:48) > 0 .
Note that E and E ( i ) differ only in the i -th component: µ i (1 : t c 1 − 1)
= µ 0 (1 : t c 1 − 1) − ∆ whereas µ ( i ) i (1 : t c 1 − 1)
=
µ 0 (1 : t c 1 − 1) + ∆ .
Then the KL divergence between the reward distributions of the i th arms is given by
[Equation]
Using Theorem 9 of [Wu et al., 2016]
(see Proposition 3) we can show that in E the lower bound to the safe regret is given by
[Equation]
otherwise
[Equation]
37) and for E the lower bound is given by
[Equation]
otherwise
[Equation]
Step 2 (Changepoint risk): Now we introduce the changepoint detection framework.
In this framework deﬁne a false alarm rate constraint speciﬁed by a tuple ( m, α ) , where m ∈ Z + denotes an a priori ﬁxed time such that the probability of an admissible change detector stopping before time m is at most δ ∈ (0 , 1) , namely, P [ τ < m ] ≤ δ.
This framework is similar to what deﬁned in [Gopalan et al., 2021].
Then we know from Theorem 2 of [Gopalan et al., 2021]
(see Proposition 5) that for any bandit changepoint algorithm satisfying P [ τ < m ] ≤ δ , we have
[Equation]
where ∆ > 0 is the minimum changepoint gap between any arms in E , E .
Step 3:
Combining the two steps above and using (37), (38), and (39) we can show that the total regret lower bound is
[Equation] [Equation]
when
[Equation]
≥
[Equation]
otherwise =
[Equation]
when
[Equation]
≥
[Equation]
otherwise
[Equation]
otherwise where, ( a ) follow by setting ∆ =
αµ 0 , min , m = T as the last time the changepoint needs to be detected, and δ = 1 T .
Combining everything and setting t c 1 = T/ 2 we can show that
[Equation]
] ≥ (cid:40)
[Equation] [Equation]
log
[Equation]
(cid:41) .
A.7 ADDITIONAL EXPERIMENT DETAILS
Setting for choosing different α : In this experiment we illustrate the tension between the risk parameter α and the cumulative regret for various values of α .
The LCS environment consist of 4 arms (including baseline) and the evolution of means are shown in Figure 4 (Left).
We plot the regret versus various values of α ∈ [0 , 1] in Figure 4 (Right).
We see that
SLR has high regret in high risk ( α → 0 ) setting.
However its performance lies between D-UCB and GLR-UCB which are safety oblivious algorithms.
SLR outperforms both UMOSS and safety aware CUCB algorithm.
We see that CUCB only performs well when risk is low ( α → 1 ).
This is the changepoints occur too fast and when ( α → 0 ) the CUCB is forced to choose the baseline arm always.
Remark 1.
In all the environments we tested against adversarial CUCB as recommended in Wu et al.
[2016] for adversarial setting.
The adversarial CUCB again always samples the baseline arm as it is not suited for the safety constraint (1) and achieves linear regret similar to CUCB .
So we omit it’s plot from the ﬁgures.
Time Complexity Note that Ad-Switch suffers an expensive time complexity of Θ( KT 4 ) for performing the changepoint detection test whereas GLR-UCB , UCB-CPD , M-UCB , SGR , SLR suffers a time complexity of Θ( KT 2 ) .
Algorithmic Implementations: We implement the following algorithms: 1) GLR-UCB [Besson and Kaufmann, 2019]: This algorithm is an actively adaptive changepoint detection algorithm.
It uses the GLRT statistic to detect changepoints and restart.
It is implemented with the Gaussian KL function with known variance to calculate the GLRT statistic.
It works for both GCS and LCS environment and requires the horizon T as input.
2) UCB-CPD [Mukherjee and Maillard, 2019]: This algorithm is also an actively adaptive changepoint detection algorithm.
It uses conﬁdence based scan statistic and we use the β i ( t, δ ) in (3) to implement its changepoint detector as opposed to the time-uniform bound used by Mukherjee and Maillard [2019].
The performance difference is negligible for such a short horizon.
It requires the horizon T as input.
3) UCB-CPDE : This algorithm is also an actively adaptive changepoint detection algorithm.
UCB-CPDE is similar to
UCB-CPD but suited for LCS as it conducts forced exploration of arms.
We again use the same β
i ( t, δ ) in (3) to implement its changepoint detector.
It also requires the horizon T as input.
4) D-UCB [Garivier and Cappé, 2011]: This is a passive algorithm that does not detect the changepoints and restart.
We set the exploration parameter γ = 1 − 14 (cid:113) 1 T as recommended in Garivier and Cappé [2011].
5) CUCB [Wu et al., 2016]: This is the safety aware algorithm for the stochastic bandit setting.
It uses the new safety constraint in (1) instead of the constraint in Wu et al.
(see Proposition 2).
So it calculates the new empirical safety budget (cid:98) Z (1 : t ) (7) and when the safety budget is positive it uses the UCB-index [Auer et al., 2002a] to sample an arm, otherwise it samples the baseline.
6) Adversarial CUCB [Wu et al., 2016]: This is a safety aware algorithm for the adversarial bandit setting.
It uses the new safety constraint in (1) instead of the constraint in Wu et al.
So it calculates the new empirical safety budget (cid:98) Z (1 : t ) (7) and when the safety budget is positive it uses the EXP3 [Auer et al., 2002b] to sample an arm, otherwise it samples the baseline.
7) UMOSS [Lattimore, 2015] : The Unbalanced Moss (UMOSS ) is a conservative exploration bandit.
The UMOSS is tuned with the parameter
[Equation]
The quantity ˜ B
i determines the regret of UMOSS with respect to arm i up to constant factors, and must be chosen to lie inside the Pareto frontier given by [Lattimore, 2015].
UMOSS has no guarantees for the safety constraint (1).
It was found to perform comparably to the highly constrained CUCB in Wu et al.
UMOSS requires ˜ B 0 , . . . , ˜ B K as inputs and so it requires the knowledge of the mean of the baseline.
[Table]