Skip to content

Commit 9fdf39f

Browse files
committed
corrected test cases
1 parent ddbce91 commit 9fdf39f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: machine_learning/mab.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def select_arm(self):
9595
Example:
9696
>>> strategy = EpsilonGreedy(epsilon=0.1, k=3)
9797
>>> 0 <= strategy.select_arm() < 3
98-
True
98+
np.True_
9999
"""
100100
rng = np.random.default_rng()
101101

@@ -116,7 +116,7 @@ def update(self, arm_index: int, reward: int):
116116
>>> strategy = EpsilonGreedy(epsilon=0.1, k=3)
117117
>>> strategy.update(0, 1)
118118
>>> strategy.counts[0] == 1
119-
True
119+
np.True_
120120
"""
121121
self.counts[arm_index] += 1
122122
n = self.counts[arm_index]
@@ -175,7 +175,7 @@ def update(self, arm_index: int, reward: int):
175175
>>> strategy = UCB(k=3)
176176
>>> strategy.update(0, 1)
177177
>>> strategy.counts[0] == 1
178-
True
178+
np.True_
179179
"""
180180
self.counts[arm_index] += 1
181181
self.total_counts += 1
@@ -215,7 +215,7 @@ def select_arm(self):
215215
Example:
216216
>>> strategy = ThompsonSampling(k=3)
217217
>>> 0 <= strategy.select_arm() < 3
218-
True
218+
np.True_
219219
"""
220220
rng = np.random.default_rng()
221221

@@ -236,7 +236,7 @@ def update(self, arm_index: int, reward: int):
236236
>>> strategy = ThompsonSampling(k=3)
237237
>>> strategy.update(0, 1)
238238
>>> strategy.successes[0] == 1
239-
True
239+
np.True_
240240
"""
241241
if reward == 1:
242242
self.successes[arm_index] += 1
@@ -270,7 +270,7 @@ def select_arm(self):
270270
Example:
271271
>>> strategy = RandomStrategy(k=3)
272272
>>> 0 <= strategy.select_arm() < 3
273-
True
273+
np.True_
274274
"""
275275
rng = np.random.default_rng()
276276
return rng.integers(self.k)
@@ -319,7 +319,7 @@ def select_arm(self):
319319
Example:
320320
>>> strategy = GreedyStrategy(k=3)
321321
>>> 0 <= strategy.select_arm() < 3
322-
True
322+
np.True_
323323
"""
324324
return np.argmax(self.values)
325325

@@ -335,7 +335,7 @@ def update(self, arm_index: int, reward: int):
335335
>>> strategy = GreedyStrategy(k=3)
336336
>>> strategy.update(0, 1)
337337
>>> strategy.counts[0] == 1
338-
True
338+
np.True_
339339
"""
340340
self.counts[arm_index] += 1
341341
n = self.counts[arm_index]

0 commit comments

Comments
 (0)