[go: up one dir, main page]

Skip to content
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

add check-scalar #122

Merged
merged 11 commits into from
Sep 5, 2021
Merged

add check-scalar #122

merged 11 commits into from
Sep 5, 2021

Conversation

fullflu
Copy link
Contributor
@fullflu fullflu commented Aug 28, 2021

Overview

  • We use the check_scalar function to validate scalar (int or float) variables
  • Fix the format of error messages as that of skearn.utils.check_scalar

Change point

  • OPE modules
  • Dateset modules
  • Policy modules
  • OPE test
  • Dataset test
  • Polucy test
  • utils

Remark

  • Although we can check the condition of a >= 0 easily by the check_scalar function, the condition of a > 0 cannot be checked easily by the function. Thus, we manually check the condition.

@fullflu fullflu changed the title [WIP] add check-scalar add check-scalar Aug 28, 2021
Copy link
Contributor
@usaito usaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fullflu Thanks! Can you fix some tiny points?

f"lambda_ should be a positive float, but {self.lambda_} is given"
)
check_scalar(self.lambda_, "lambda_", float)
if self.alpha_ <= 0.0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self.lambda_ <= 0.0: ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add several tests about those arguments...!

)
check_array(array=context, name="context", expected_dim=2)
if context.shape[0] != 1:
raise ValueError("Expected `context.shape[1] == 1`, but found it False")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Expected context.shape[0] == 1, but found it False" ?

)
check_array(array=context, name="context", expected_dim=2)
if context.shape[0] != 1:
raise ValueError("Expected `context.shape[1] == 1`, but found it False")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Expected context.shape[0] == 1, but found it False" ?

@usaito usaito merged commit 5befe0b into st-tech:master Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants