Skip to content

Commit fb86900

Browse files
authored
Merge pull request #106 from fullflu/fix/delete-unused-type-check
Delete action/pscore/reward/estimated_rewards_by_model from check_ope…*
2 parents ea4d9b8 + 3722d00 commit fb86900

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

obp/utils.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -301,21 +301,15 @@ def check_ope_inputs(
301301

302302
# estimated_rewards_by_reg_model
303303
if estimated_rewards_by_reg_model is not None:
304-
if not isinstance(estimated_rewards_by_reg_model, np.ndarray):
305-
raise ValueError("estimated_rewards_by_reg_model must be ndarray")
306304
if estimated_rewards_by_reg_model.shape != action_dist.shape:
307305
raise ValueError(
308306
"estimated_rewards_by_reg_model.shape must be the same as action_dist.shape"
309307
)
310308

311309
# action, reward
312310
if action is not None or reward is not None:
313-
if not isinstance(action, np.ndarray):
314-
raise ValueError("action must be ndarray")
315311
if action.ndim != 1:
316312
raise ValueError("action must be 1-dimensional")
317-
if not isinstance(reward, np.ndarray):
318-
raise ValueError("reward must be ndarray")
319313
if reward.ndim != 1:
320314
raise ValueError("reward must be 1-dimensional")
321315
if not (action.shape[0] == reward.shape[0]):
@@ -329,8 +323,6 @@ def check_ope_inputs(
329323

330324
# pscore
331325
if pscore is not None:
332-
if not isinstance(pscore, np.ndarray):
333-
raise ValueError("pscore must be ndarray")
334326
if pscore.ndim != 1:
335327
raise ValueError("pscore must be 1-dimensional")
336328
if not (action.shape[0] == reward.shape[0] == pscore.shape[0]):
@@ -671,21 +663,15 @@ def check_ope_inputs_tensor(
671663

672664
# estimated_rewards_by_reg_model
673665
if estimated_rewards_by_reg_model is not None:
674-
if not isinstance(estimated_rewards_by_reg_model, torch.Tensor):
675-
raise ValueError("estimated_rewards_by_reg_model must be Tensor")
676666
if estimated_rewards_by_reg_model.shape != action_dist.shape:
677667
raise ValueError(
678668
"estimated_rewards_by_reg_model.shape must be the same as action_dist.shape"
679669
)
680670

681671
# action, reward
682672
if action is not None or reward is not None:
683-
if not isinstance(action, torch.Tensor):
684-
raise ValueError("action must be Tensor")
685673
if action.ndim != 1:
686674
raise ValueError("action must be 1-dimensional")
687-
if not isinstance(reward, torch.Tensor):
688-
raise ValueError("reward must be Tensor")
689675
if reward.ndim != 1:
690676
raise ValueError("reward must be 1-dimensional")
691677
if not (action.shape[0] == reward.shape[0]):
@@ -699,8 +685,6 @@ def check_ope_inputs_tensor(
699685

700686
# pscore
701687
if pscore is not None:
702-
if not isinstance(pscore, torch.Tensor):
703-
raise ValueError("pscore must be Tensor")
704688
if pscore.ndim != 1:
705689
raise ValueError("pscore must be 1-dimensional")
706690
if not (action.shape[0] == reward.shape[0] == pscore.shape[0]):

0 commit comments

Comments
 (0)