Skip to content

Delete action/pscore/reward/estimated_rewards_by_model from check_ope…* #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions obp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,21 +301,15 @@ def check_ope_inputs(

# estimated_rewards_by_reg_model
if estimated_rewards_by_reg_model is not None:
if not isinstance(estimated_rewards_by_reg_model, np.ndarray):
raise ValueError("estimated_rewards_by_reg_model must be ndarray")
if estimated_rewards_by_reg_model.shape != action_dist.shape:
raise ValueError(
"estimated_rewards_by_reg_model.shape must be the same as action_dist.shape"
)

# action, reward
if action is not None or reward is not None:
if not isinstance(action, np.ndarray):
raise ValueError("action must be ndarray")
if action.ndim != 1:
raise ValueError("action must be 1-dimensional")
if not isinstance(reward, np.ndarray):
raise ValueError("reward must be ndarray")
if reward.ndim != 1:
raise ValueError("reward must be 1-dimensional")
if not (action.shape[0] == reward.shape[0]):
Expand All @@ -329,8 +323,6 @@ def check_ope_inputs(

# pscore
if pscore is not None:
if not isinstance(pscore, np.ndarray):
raise ValueError("pscore must be ndarray")
if pscore.ndim != 1:
raise ValueError("pscore must be 1-dimensional")
if not (action.shape[0] == reward.shape[0] == pscore.shape[0]):
Expand Down Expand Up @@ -671,21 +663,15 @@ def check_ope_inputs_tensor(

# estimated_rewards_by_reg_model
if estimated_rewards_by_reg_model is not None:
if not isinstance(estimated_rewards_by_reg_model, torch.Tensor):
raise ValueError("estimated_rewards_by_reg_model must be Tensor")
if estimated_rewards_by_reg_model.shape != action_dist.shape:
raise ValueError(
"estimated_rewards_by_reg_model.shape must be the same as action_dist.shape"
)

# action, reward
if action is not None or reward is not None:
if not isinstance(action, torch.Tensor):
raise ValueError("action must be Tensor")
if action.ndim != 1:
raise ValueError("action must be 1-dimensional")
if not isinstance(reward, torch.Tensor):
raise ValueError("reward must be Tensor")
if reward.ndim != 1:
raise ValueError("reward must be 1-dimensional")
if not (action.shape[0] == reward.shape[0]):
Expand All @@ -699,8 +685,6 @@ def check_ope_inputs_tensor(

# pscore
if pscore is not None:
if not isinstance(pscore, torch.Tensor):
raise ValueError("pscore must be Tensor")
if pscore.ndim != 1:
raise ValueError("pscore must be 1-dimensional")
if not (action.shape[0] == reward.shape[0] == pscore.shape[0]):
Expand Down