Skip to content

Commit

Permalink
Merge branch 'main' into feature-branch-timeseries-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
fealho authored Nov 14, 2024
2 parents 3c074bd + 838e81d commit b8df54e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dependency_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
run: |
python -m pip install .[dev]
make check-deps OUTPUT_FILEPATH=latest_requirements.txt
make fix-lint
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v4
Expand Down
2 changes: 1 addition & 1 deletion latest_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pandas==2.2.3
plotly==5.24.1
scikit-learn==1.5.2
scipy==1.13.1
tqdm==4.66.5
tqdm==4.67.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dev = [
'watchdog>=1.0.1,<5',

# style check
'ruff>=0.3.2,<0.7.2',
'ruff>=0.3.2,<1',

# distribute on PyPI
'twine>=1.10.0,<6',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def compute(cls, real_data, synthetic_data):
contingency_synthetic = synthetic.groupby(list(columns), dropna=False).size() / len(
synthetic
)
combined_index = contingency_real.index.union(contingency_synthetic.index)
combined_index = contingency_real.index.union(contingency_synthetic.index, sort=False)
contingency_synthetic = contingency_synthetic.reindex(combined_index, fill_value=0)
contingency_real = contingency_real.reindex(combined_index, fill_value=0)
diff = abs(contingency_real - contingency_synthetic).fillna(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def test_quality_report_with_errors():
None,
],
})
assert score == 0.7249603174603174
assert score == 0.7249603174603175
pd.testing.assert_frame_equal(properties, expected_properties)
pd.testing.assert_frame_equal(details_column_shapes, expected_details)

Expand Down
13 changes: 13 additions & 0 deletions tests/unit/column_pairs/statistical/test_contingency_similarity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import patch

import pandas as pd
import pytest

from sdmetrics.column_pairs.statistical import ContingencySimilarity

Expand Down Expand Up @@ -53,3 +54,15 @@ def test_normalize(self, normalize_mock):
# Assert
normalize_mock.assert_called_once_with(raw_score)
assert result == normalize_mock.return_value

@pytest.mark.filterwarnings('error:.*The values in the array are unorderable.*:RuntimeWarning')
def test_no_runtime_warning_raised(self):
"""Test that no RuntimeWarning warning is raised when the metric is computed."""
# Setup
real_data = pd.DataFrame(data={'A': ['value'] * 4, 'B': ['1', '2', '3', pd.NA]})
synthetic_data = pd.DataFrame(data={'A': ['value'] * 3, 'B': ['1', '2', pd.NA]})

# Run and Assert
ContingencySimilarity.compute(
real_data=real_data[['A', 'B']], synthetic_data=synthetic_data[['A', 'B']]
)

0 comments on commit b8df54e

Please sign in to comment.