Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions sdmetrics/column_pairs/statistical/inter_row_msas.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ def diff_func(group):
if len(group) <= n_rows_diff:
return np.nan
group = group.to_numpy()
with warnings.catch_warnings():
warnings.filterwarnings('ignore', message='Mean of empty slice')
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check the warning does not show in the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After removing np.mean function, there shouldn't be a way to trigger "Mean of empty slice" warning.

return np.nanmean(group[n_rows_diff:] - group[:-n_rows_diff])
return (group[n_rows_diff:] - group[:-n_rows_diff]).flatten()

with warnings.catch_warnings():
warnings.filterwarnings('ignore', message='invalid value encountered in.*')
return grouped.apply(diff_func)
return grouped.apply(diff_func).explode().astype(float)

@classmethod
def compute(cls, real_data, synthetic_data, n_rows_diff=1, apply_log=False):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/column_pairs/statistical/test_inter_row_msas.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_compute_breakdown(self):
)

# Assert
assert result == {'score': 0.5}
assert result == {'score': 0.25}

def test_compute(self):
"""Test it runs."""
Expand All @@ -40,7 +40,7 @@ def test_compute(self):
)

# Assert
assert score == 0.5
assert score == 0.25

def test_compute_nans(self):
"""Test it runs with nans."""
Expand Down