Skip to content

Commit f525514

Browse files
authored
Compare distribution of differences in InterRowMSAS instead of average (#805)
1 parent 1cc83b4 commit f525514

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

sdmetrics/column_pairs/statistical/inter_row_msas.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,11 @@ def diff_func(group):
8585
if len(group) <= n_rows_diff:
8686
return np.nan
8787
group = group.to_numpy()
88-
with warnings.catch_warnings():
89-
warnings.filterwarnings('ignore', message='Mean of empty slice')
90-
return np.nanmean(group[n_rows_diff:] - group[:-n_rows_diff])
88+
return (group[n_rows_diff:] - group[:-n_rows_diff]).flatten()
9189

9290
with warnings.catch_warnings():
9391
warnings.filterwarnings('ignore', message='invalid value encountered in.*')
94-
return grouped.apply(diff_func)
92+
return grouped.apply(diff_func).explode().astype(float)
9593

9694
@classmethod
9795
def compute(cls, real_data, synthetic_data, n_rows_diff=1, apply_log=False):

tests/unit/column_pairs/statistical/test_inter_row_msas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_compute_breakdown(self):
2424
)
2525

2626
# Assert
27-
assert result == {'score': 0.5}
27+
assert result == {'score': 0.25}
2828

2929
def test_compute(self):
3030
"""Test it runs."""
@@ -40,7 +40,7 @@ def test_compute(self):
4040
)
4141

4242
# Assert
43-
assert score == 0.5
43+
assert score == 0.25
4444

4545
def test_compute_nans(self):
4646
"""Test it runs with nans."""

0 commit comments

Comments
 (0)