Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishPvjs committed Aug 6, 2024
1 parent ccb9a59 commit a341d20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mabwiser/mab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ def _validate_mab_args(arms, learning_policy, neighborhood_policy, seed, n_jobs,
check_true(isinstance(arms, list), TypeError("The arms should be provided in a list."))
check_false(None in arms, ValueError("The arm list cannot contain None."))
check_false(np.nan in arms, ValueError("The arm list cannot contain NaN."))
check_false(np.Inf in arms, ValueError("The arm list cannot contain Infinity."))
check_false(np.inf in arms, ValueError("The arm list cannot contain Infinity."))
check_true(len(arms) == len(set(arms)), ValueError("The list of arms cannot contain duplicate values."))

# Learning Policy type
Expand Down Expand Up @@ -1405,7 +1405,7 @@ def _validate_arm(arm):
"""
check_false(arm is None, ValueError("The arm cannot be None."))
check_false(np.nan in [arm], ValueError("The arm cannot be NaN."))
check_false(np.Inf in [arm], ValueError("The arm cannot be Infinity."))
check_false(np.inf in [arm], ValueError("The arm cannot be Infinity."))

@staticmethod
def _convert_array(array_like) -> np.ndarray:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_invalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,14 @@ def test_rewards_null_df(self):

def test_rewards_inf_array(self):
decisions = np.asarray([1, 1, 1, 2, 2, 2, 3, 3, 3])
rewards = np.asarray([0, 0, 0, 0, 0, 0, 1, 1, np.Inf])
rewards = np.asarray([0, 0, 0, 0, 0, 0, 1, 1, np.inf])
mab = MAB([1, 2, 3], LearningPolicy.EpsilonGreedy(epsilon=0))
with self.assertRaises(TypeError):
mab.fit(decisions, rewards)

def test_rewards_inf_df(self):
history = pd.DataFrame({'decision': [1, 1, 1, 2, 2, 2, 3, 3, 3],
'reward': [0, 0, 0, 0, 0, 0, 1, 1, np.Inf]})
'reward': [0, 0, 0, 0, 0, 0, 1, 1, np.inf]})
mab = MAB([1, 2, 3], LearningPolicy.EpsilonGreedy(epsilon=0))
with self.assertRaises(TypeError):
mab.fit(history['decision'], history['reward'])
Expand Down Expand Up @@ -562,7 +562,7 @@ def test_invalid_add_arm(self):
with self.assertRaises(ValueError):
mab.add_arm(np.nan)
with self.assertRaises(ValueError):
mab.add_arm(np.Inf)
mab.add_arm(np.inf)
with self.assertRaises(ValueError):
mab.add_arm(3)

Expand Down

0 comments on commit a341d20

Please sign in to comment.