-
Notifications
You must be signed in to change notification settings - Fork 88
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
add check-scalar #122
Conversation
There was a problem hiding this 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?
obp/policy/logistic.py
Outdated
f"lambda_ should be a positive float, but {self.lambda_} is given" | ||
) | ||
check_scalar(self.lambda_, "lambda_", float) | ||
if self.alpha_ <= 0.0: |
There was a problem hiding this comment.
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:
?
There was a problem hiding this comment.
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...!
obp/policy/linear.py
Outdated
) | ||
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") |
There was a problem hiding this comment.
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" ?
obp/policy/linear.py
Outdated
) | ||
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") |
There was a problem hiding this comment.
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" ?
Overview
check_scalar
function to validate scalar (int or float) variablesskearn.utils.check_scalar
Change point
Remark
a >= 0
easily by thecheck_scalar
function, the condition ofa > 0
cannot be checked easily by the function. Thus, we manually check the condition.