-
Notifications
You must be signed in to change notification settings - Fork 4
batch error logs #484
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
hussain-jafari
merged 16 commits into
epic/full_scale_testing
from
hjafari/MIC-5503_batch_error_logs
Jan 24, 2025
Merged
batch error logs #484
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b89c5dc
batch assert statements
hussain-jafari 4930a25
show all failures
hussain-jafari ab4f072
linting
4f51104
no stubs for check
hussain-jafari 19d3846
Merge branch 'hjafari/MIC-5503_batch_error_logs' of https://github.co…
hussain-jafari 1cfab6d
use proper ignore
hussain-jafari 12e4249
isort test_release
hussain-jafari e4be3b5
add pytest check to install
hussain-jafari 7266440
separate with checks for each assert
hussain-jafari 8a71f53
try not ignoring import
hussain-jafari 643a7bd
have mypy ignore pytest_check globally
hussain-jafari 305ac06
add sphinx config file to readthedocs
hussain-jafari 49e8e6b
remove unecessary check
hussain-jafari d76d577
Trigger Build
hussain-jafari 40b1c3b
update dependency path script path in build
hussain-jafari 990510f
use correct conf path
hussain-jafari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,5 +23,6 @@ exclude = [ | |
| [[tool.mypy.overrides]] | ||
| module = [ | ||
| "scipy.*", | ||
| "pytest_check", | ||
| ] | ||
| ignore_missing_imports = true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| import numpy as np | ||
| import numpy.typing as npt | ||
| import pandas as pd | ||
| from pytest_check import check | ||
| from vivarium_testing_utils import FuzzyChecker | ||
|
|
||
| from pseudopeople.configuration import Keys, get_configuration | ||
|
|
@@ -34,7 +35,8 @@ def run_column_noising_tests( | |
|
|
||
| # Check that originally missing data remained missing | ||
| originally_missing_idx = check_original.index[check_original[col.name].isna()] | ||
| assert check_noised.loc[originally_missing_idx, col.name].isna().all() | ||
| with check: | ||
| assert check_noised.loc[originally_missing_idx, col.name].isna().all() | ||
|
|
||
| # Check for noising where applicable | ||
| to_compare_idx = shared_idx.difference(originally_missing_idx) | ||
|
|
@@ -43,7 +45,8 @@ def run_column_noising_tests( | |
| check_original.loc[to_compare_idx, col.name].values | ||
| != check_noised.loc[to_compare_idx, col.name].values | ||
| ) | ||
| assert different_check.any() | ||
| with check: | ||
| assert different_check.any() | ||
|
|
||
| noise_level = different_check.sum() | ||
|
|
||
|
|
@@ -64,7 +67,8 @@ def run_column_noising_tests( | |
| == check_noised.loc[to_compare_idx, col.name].values | ||
| ) | ||
|
|
||
| assert same_check.all() | ||
| with check: | ||
| assert same_check.all() | ||
|
|
||
|
|
||
| def run_omit_row_or_do_not_respond_tests( | ||
|
|
@@ -87,15 +91,20 @@ def run_omit_row_or_do_not_respond_tests( | |
| ]: | ||
| # Census and household surveys have do_not_respond and omit_row. | ||
| # For all other datasets they are mutually exclusive | ||
| assert len(noise_types) == 2 | ||
| with check: | ||
| assert len(noise_types) == 2 | ||
| else: | ||
| assert len(noise_types) < 2 | ||
| with check: | ||
| assert len(noise_types) < 2 | ||
| if not noise_types: # Check that there are no missing indexes | ||
| assert noised_data.index.symmetric_difference(original_data.index).empty | ||
| with check: | ||
| assert noised_data.index.symmetric_difference(original_data.index).empty | ||
| else: # Check that there are some omissions | ||
| # TODO: assert levels are as expected | ||
| assert noised_data.index.difference(original_data.index).empty | ||
| assert not original_data.index.difference(noised_data.index).empty | ||
| with check: | ||
| assert noised_data.index.difference(original_data.index).empty | ||
| with check: | ||
| assert not original_data.index.difference(noised_data.index).empty | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these be in two separate checks?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is confusing to me |
||
|
|
||
|
|
||
| def validate_column_noise_level( | ||
|
|
@@ -158,7 +167,8 @@ def validate_column_noise_level( | |
| [1 - p for p in token_probability] | ||
| ) | ||
| else: | ||
| assert isinstance(tokens_per_string, pd.Series) | ||
| with check: | ||
| assert isinstance(tokens_per_string, pd.Series) | ||
| avg_probability_any_token_noised = ( | ||
| 1 - (1 - token_probability) ** tokens_per_string | ||
| ).mean() | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what is this doing?
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.
This flag controls how many failures are shown at once and, oddly enough, defaults to 1.