-
Notifications
You must be signed in to change notification settings - Fork 7
Closing issue #33. #51
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
Conversation
…ain_prop + selection_prop + validation_prop against 1.0.
JanBenisek
left a comment
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.
Like I commented, please keep only one test but add more test cases to it.
| selection_prop, | ||
| error_msg) | ||
|
|
||
| def test_train_selection_validation_split_error_correct_prop_no_rounding_error(self): |
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.
Hi, seems like we already have a unit test for that behavior here:
| def test_train_selection_validation_split(self, train_prop: float, |
I'd suggest keep only one of the tests (perhaps the original one), BUT add more possible values to test.
| """ | ||
|
|
||
| if train_prop + selection_prop + validation_prop != 1.0: | ||
| if not math.isclose(train_prop + selection_prop + validation_prop, 1.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 like this solution, good idea!
# Conflicts: # cobra/preprocessing/preprocessor.py
Story Title
train/selection/validation split error
Changes made
This proposes a fix for the floating point rounding error in equality checking of the train_prop + selection_prop + validation_prop against 1.0.
The unit test is a little counter-intuitive since it needs to check if a ValueError is NOT raised, but it does carefully test the condition.
How does the solution address the problem
The fixed is based on math.isclose().
Linked issues
Resolves #33