sdmetrics 0.27.2.dev0__tar.gz → 0.27.3.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sdmetrics-0.27.2.dev0/sdmetrics.egg-info → sdmetrics-0.27.3.dev0}/PKG-INFO +3 -10
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/README.md +2 -9
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/pyproject.toml +1 -1
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/__init__.py +1 -1
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/cardinality_boundary_adherence.py +10 -10
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/contingency_similarity.py +3 -1
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/referential_integrity.py +39 -10
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/README.md +1 -1
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/inter_table_trends.py +20 -16
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/base_multi_table_report.py +27 -12
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/data_validity.py +8 -2
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/key_uniqueness.py +18 -10
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/README.md +5 -3
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/README.md +2 -2
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/utils.py +20 -7
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0/sdmetrics.egg-info}/PKG-INFO +3 -10
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/LICENSE +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/_utils_metadata.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/correlation_similarity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/inter_row_msas.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/kl_divergence.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/statistic_msas.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/metadata.json +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/sessions_real.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/sessions_synthetic.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/transactions_real.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/transactions_synthetic.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/users_real.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/users_synthetic.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/single_table/metadata.json +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/single_table/real.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/single_table/synthetic.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/timeseries/metadata.json +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/timeseries/real.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/timeseries/synthetic.csv +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/errors.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/goal.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/detection/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/detection/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/detection/parent_child.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/multi_single_table.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/statistical/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/statistical/cardinality_shape_similarity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/statistical/cardinality_statistic_similarity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/base_report.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/boundary.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/cardinality.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/column_pair_trends.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/column_shapes.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/coverage.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/data_validity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/relationship_validity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/structure.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/synthesis.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/diagnostic_report.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/quality_report.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/boundary.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/column_pair_trends.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/column_shapes.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/coverage.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/structure.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/synthesis.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/diagnostic_report.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/plot_utils.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/quality_report.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/utils.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/README.md +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/boundary_adherence.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/category_adherence.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/category_coverage.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/cstest.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/kscomplement.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/missing_value_similarity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/range_coverage.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/sequence_length_similarity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/statistic_similarity.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/tv_complement.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/bayesian_network.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/binary_classifier_precision_efficacy.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/binary_classifier_recall_efficacy.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/utils.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/detection/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/detection/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/detection/sklearn.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/binary.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/mlefficacy.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/multiclass.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/regression.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/equalized_odds.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/gaussian_mixture.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/multi_column_pairs.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/multi_single_column.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/new_row_synthesis.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/cap.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/categorical_sklearn.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/dcr_baseline_protection.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/dcr_overfitting_protection.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/dcr_utils.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/disclosure_protection.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/ensemble.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/loss.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/numerical_sklearn.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/radius_nearest_neighbor.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/util.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/table_structure.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/utils.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/detection.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/efficacy/__init__.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/efficacy/base.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/efficacy/classification.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/ml_scorers.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/visualization.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/warnings.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics.egg-info/SOURCES.txt +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics.egg-info/dependency_links.txt +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics.egg-info/entry_points.txt +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics.egg-info/requires.txt +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics.egg-info/top_level.txt +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/setup.cfg +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/tests/test_scripts.py +0 -0
- {sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/tests/test_tasks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdmetrics
|
|
3
|
-
Version: 0.27.
|
|
3
|
+
Version: 0.27.3.dev0
|
|
4
4
|
Summary: Metrics for Synthetic Data Generation Projects
|
|
5
5
|
Author-email: MIT Data To AI Lab <dailabmit@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -176,10 +176,7 @@ my_report = QualityReport.load(filepath='demo_data_quality_report.pkl')
|
|
|
176
176
|
# set by the real data
|
|
177
177
|
from sdmetrics.single_column import BoundaryAdherence
|
|
178
178
|
|
|
179
|
-
BoundaryAdherence.compute(
|
|
180
|
-
real_data['start_date'],
|
|
181
|
-
synthetic_data['start_date']
|
|
182
|
-
)
|
|
179
|
+
BoundaryAdherence.compute(real_data['start_date'], synthetic_data['start_date'])
|
|
183
180
|
```
|
|
184
181
|
```
|
|
185
182
|
0.8503937007874016
|
|
@@ -189,11 +186,7 @@ BoundaryAdherence.compute(
|
|
|
189
186
|
# calculate whether the synthetic data is new or whether it's an exact copy of the real data
|
|
190
187
|
from sdmetrics.single_table import NewRowSynthesis
|
|
191
188
|
|
|
192
|
-
NewRowSynthesis.compute(
|
|
193
|
-
real_data,
|
|
194
|
-
synthetic_data,
|
|
195
|
-
metadata
|
|
196
|
-
)
|
|
189
|
+
NewRowSynthesis.compute(real_data, synthetic_data, metadata)
|
|
197
190
|
```
|
|
198
191
|
```
|
|
199
192
|
1.0
|
|
@@ -91,10 +91,7 @@ my_report = QualityReport.load(filepath='demo_data_quality_report.pkl')
|
|
|
91
91
|
# set by the real data
|
|
92
92
|
from sdmetrics.single_column import BoundaryAdherence
|
|
93
93
|
|
|
94
|
-
BoundaryAdherence.compute(
|
|
95
|
-
real_data['start_date'],
|
|
96
|
-
synthetic_data['start_date']
|
|
97
|
-
)
|
|
94
|
+
BoundaryAdherence.compute(real_data['start_date'], synthetic_data['start_date'])
|
|
98
95
|
```
|
|
99
96
|
```
|
|
100
97
|
0.8503937007874016
|
|
@@ -104,11 +101,7 @@ BoundaryAdherence.compute(
|
|
|
104
101
|
# calculate whether the synthetic data is new or whether it's an exact copy of the real data
|
|
105
102
|
from sdmetrics.single_table import NewRowSynthesis
|
|
106
103
|
|
|
107
|
-
NewRowSynthesis.compute(
|
|
108
|
-
real_data,
|
|
109
|
-
synthetic_data,
|
|
110
|
-
metadata
|
|
111
|
-
)
|
|
104
|
+
NewRowSynthesis.compute(real_data, synthetic_data, metadata)
|
|
112
105
|
```
|
|
113
106
|
```
|
|
114
107
|
1.0
|
|
@@ -148,7 +148,7 @@ convention = 'google'
|
|
|
148
148
|
add-ignore = ['D107', 'D407', 'D417']
|
|
149
149
|
|
|
150
150
|
[tool.bumpversion]
|
|
151
|
-
current_version = "0.27.
|
|
151
|
+
current_version = "0.27.3.dev0"
|
|
152
152
|
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?'
|
|
153
153
|
serialize = [
|
|
154
154
|
'{major}.{minor}.{patch}.{release}{candidate}',
|
|
@@ -33,10 +33,10 @@ class CardinalityBoundaryAdherence(ColumnPairsMetric):
|
|
|
33
33
|
"""Calculate the percentage of synthetic parents with cardinality in the correct range.
|
|
34
34
|
|
|
35
35
|
Args:
|
|
36
|
-
real_data (tuple(pd.Series, pd.Series)):
|
|
37
|
-
A tuple with the real primary key
|
|
38
|
-
foreign keys
|
|
39
|
-
synthetic_data (tuple(pd.Series, pd.Series)):
|
|
36
|
+
real_data (tuple(pd.DataFrame, pd.DataFrame) or tuple(pd.Series, pd.Series)):
|
|
37
|
+
A tuple with the real primary key DataFrame as the first element and real
|
|
38
|
+
foreign keys DataFrame as the second element.
|
|
39
|
+
synthetic_data (tuple(pd.DataFrame, pd.DataFrame) or tuple(pd.Series, pd.Series)):
|
|
40
40
|
A tuple with the synthetic primary key as the first element and synthetic
|
|
41
41
|
foreign keys as the second element.
|
|
42
42
|
|
|
@@ -45,10 +45,10 @@ class CardinalityBoundaryAdherence(ColumnPairsMetric):
|
|
|
45
45
|
Metric output.
|
|
46
46
|
"""
|
|
47
47
|
real_cardinality = pd.DataFrame(index=real_data[0].copy())
|
|
48
|
-
real_cardinality['cardinality'] = real_data[1].value_counts()
|
|
48
|
+
real_cardinality['cardinality'] = real_data[1].value_counts(dropna=False)
|
|
49
49
|
real_cardinality = real_cardinality.fillna(0)
|
|
50
50
|
synthetic_cardinality = pd.DataFrame(index=synthetic_data[0].copy())
|
|
51
|
-
synthetic_cardinality['cardinality'] = synthetic_data[1].value_counts()
|
|
51
|
+
synthetic_cardinality['cardinality'] = synthetic_data[1].value_counts(dropna=False)
|
|
52
52
|
synthetic_cardinality = synthetic_cardinality.fillna(0)
|
|
53
53
|
|
|
54
54
|
min_cardinality = real_cardinality['cardinality'].min()
|
|
@@ -66,10 +66,10 @@ class CardinalityBoundaryAdherence(ColumnPairsMetric):
|
|
|
66
66
|
"""Calculate the percentage of synthetic parents with cardinality in the correct range.
|
|
67
67
|
|
|
68
68
|
Args:
|
|
69
|
-
real_data (tuple(pd.Series, pd.Series)):
|
|
70
|
-
A tuple with the real primary key
|
|
71
|
-
foreign keys
|
|
72
|
-
synthetic_data (tuple(pd.Series, pd.Series)):
|
|
69
|
+
real_data (tuple(pd.DataFrame, pd.DataFrame) or tuple(pd.Series, pd.Series)):
|
|
70
|
+
A tuple with the real primary key DataFrame as the first element and real
|
|
71
|
+
foreign keys DataFrame as the second element.
|
|
72
|
+
synthetic_data (tuple(pd.DataFrame, pd.DataFrame) or tuple(pd.Series, pd.Series)):
|
|
73
73
|
A tuple with the synthetic primary key as the first element and synthetic
|
|
74
74
|
foreign keys as the second element.
|
|
75
75
|
|
|
@@ -117,7 +117,9 @@ class ContingencySimilarity(ColumnPairsMetric):
|
|
|
117
117
|
contingency_synthetic = synthetic.groupby(list(columns), dropna=False).size() / len(
|
|
118
118
|
synthetic
|
|
119
119
|
)
|
|
120
|
-
combined_index = contingency_real.index.union(
|
|
120
|
+
combined_index = contingency_real.index.union(
|
|
121
|
+
contingency_synthetic.index, sort=False
|
|
122
|
+
).drop_duplicates()
|
|
121
123
|
contingency_synthetic = contingency_synthetic.reindex(combined_index, fill_value=0)
|
|
122
124
|
contingency_real = contingency_real.reindex(combined_index, fill_value=0)
|
|
123
125
|
diff = abs(contingency_real - contingency_synthetic).fillna(0)
|
|
@@ -31,31 +31,60 @@ class ReferentialIntegrity(ColumnPairsMetric):
|
|
|
31
31
|
goal = Goal.MAXIMIZE
|
|
32
32
|
min_value = 0.0
|
|
33
33
|
max_value = 1.0
|
|
34
|
+
INDICATOR_NAME = '__ri_indicator__'
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def _create_unique_name(name, list_names):
|
|
38
|
+
"""Modify the ``name`` parameter if it already exists in the list of names."""
|
|
39
|
+
result = name
|
|
40
|
+
while result in list_names:
|
|
41
|
+
result += '_'
|
|
42
|
+
|
|
43
|
+
return result
|
|
34
44
|
|
|
35
45
|
@classmethod
|
|
36
46
|
def compute_breakdown(cls, real_data, synthetic_data):
|
|
37
47
|
"""Compute the score breakdown of the referential integrity metric.
|
|
38
48
|
|
|
39
49
|
Args:
|
|
40
|
-
real_data (tuple of 2 pandas.
|
|
50
|
+
real_data (tuple of 2 pandas.DataFrame):
|
|
41
51
|
(primary_key, foreign_key) columns from the real data.
|
|
42
|
-
synthetic_data (tuple of 2 pandas.
|
|
52
|
+
synthetic_data (tuple of 2 pandas.DataFrame):
|
|
43
53
|
(primary_key, foreign_key) columns from the synthetic data.
|
|
44
54
|
|
|
45
55
|
Returns:
|
|
46
56
|
dict:
|
|
47
57
|
The score breakdown of the key uniqueness metric.
|
|
48
58
|
"""
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
real_pk_df, real_fk_df = real_data
|
|
60
|
+
synth_pk_df, synth_fk_df = synthetic_data
|
|
61
|
+
pk_columns = list(real_pk_df.columns)
|
|
62
|
+
fk_columns = list(real_fk_df.columns)
|
|
63
|
+
indicator_name = cls._create_unique_name(cls.INDICATOR_NAME, pk_columns + fk_columns)
|
|
64
|
+
|
|
65
|
+
real_merged = real_fk_df.merge(
|
|
66
|
+
real_pk_df.drop_duplicates(),
|
|
67
|
+
how='left',
|
|
68
|
+
left_on=fk_columns,
|
|
69
|
+
right_on=pk_columns,
|
|
70
|
+
indicator=indicator_name,
|
|
71
|
+
)
|
|
72
|
+
missing_parents = (real_merged[indicator_name] == 'left_only').any()
|
|
54
73
|
if missing_parents:
|
|
55
74
|
LOGGER.info("The real data has foreign keys that don't reference any primary key.")
|
|
56
75
|
|
|
57
|
-
|
|
76
|
+
if len(fk_columns) == 1 and pd.isna(real_fk_df[fk_columns[0]]).any():
|
|
77
|
+
synth_fk_df = synth_fk_df.dropna()
|
|
78
|
+
|
|
79
|
+
synth_merged = synth_fk_df.merge(
|
|
80
|
+
synth_pk_df.drop_duplicates(),
|
|
81
|
+
how='left',
|
|
82
|
+
left_on=fk_columns,
|
|
83
|
+
right_on=pk_columns,
|
|
84
|
+
indicator=indicator_name,
|
|
85
|
+
)
|
|
58
86
|
|
|
87
|
+
score = (synth_merged[indicator_name] == 'both').mean()
|
|
59
88
|
return {'score': score}
|
|
60
89
|
|
|
61
90
|
@classmethod
|
|
@@ -63,9 +92,9 @@ class ReferentialIntegrity(ColumnPairsMetric):
|
|
|
63
92
|
"""Compute the referential integrity of two columns.
|
|
64
93
|
|
|
65
94
|
Args:
|
|
66
|
-
real_data (tuple of 2 pandas.
|
|
95
|
+
real_data (tuple of 2 pandas.DataFrame):
|
|
67
96
|
(primary_key, foreign_key) columns from the real data.
|
|
68
|
-
synthetic_data (tuple of 2 pandas.
|
|
97
|
+
synthetic_data (tuple of 2 pandas.DataFrame):
|
|
69
98
|
(primary_key, foreign_key) columns from the synthetic data.
|
|
70
99
|
|
|
71
100
|
Returns:
|
|
@@ -91,6 +91,6 @@ For example, we could execute the same metric as before by passing the `metadata
|
|
|
91
91
|
of having to specify the individual `foreign_keys`:
|
|
92
92
|
|
|
93
93
|
```python
|
|
94
|
-
In
|
|
94
|
+
In[10]: LogisticParentChildDetection.compute(real_data, synthetic_data, metadata)
|
|
95
95
|
Out[10]: 0.7569444444444444
|
|
96
96
|
```
|
|
@@ -11,6 +11,7 @@ from sdmetrics.reports.single_table._properties import (
|
|
|
11
11
|
ColumnPairTrends as SingleTableColumnPairTrends,
|
|
12
12
|
)
|
|
13
13
|
from sdmetrics.reports.utils import PlotConfig
|
|
14
|
+
from sdmetrics.utils import _cast_to_iterable
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class InterTableTrends(BaseMultiTableProperty):
|
|
@@ -50,16 +51,16 @@ class InterTableTrends(BaseMultiTableProperty):
|
|
|
50
51
|
"""
|
|
51
52
|
parent = relationship['parent_table_name']
|
|
52
53
|
child = relationship['child_table_name']
|
|
53
|
-
foreign_key = relationship['child_foreign_key']
|
|
54
|
-
primary_key = relationship['parent_primary_key']
|
|
54
|
+
foreign_key = _cast_to_iterable(relationship['child_foreign_key'])
|
|
55
|
+
primary_key = _cast_to_iterable(relationship['parent_primary_key'])
|
|
55
56
|
|
|
56
57
|
real_parent = real_data[parent].add_prefix(f'{parent}.')
|
|
57
58
|
real_child = real_data[child].add_prefix(f'{child}.')
|
|
58
59
|
synthetic_parent = synthetic_data[parent].add_prefix(f'{parent}.')
|
|
59
60
|
synthetic_child = synthetic_data[child].add_prefix(f'{child}.')
|
|
60
61
|
|
|
61
|
-
child_index = f'{child}.{
|
|
62
|
-
parent_index = f'{parent}.{
|
|
62
|
+
child_index = [f'{child}.{key_col}' for key_col in foreign_key]
|
|
63
|
+
parent_index = [f'{parent}.{key_col}' for key_col in primary_key]
|
|
63
64
|
|
|
64
65
|
denormalized_real = real_child.merge(
|
|
65
66
|
real_parent, left_on=child_index, right_on=parent_index
|
|
@@ -101,7 +102,12 @@ class InterTableTrends(BaseMultiTableProperty):
|
|
|
101
102
|
merged_metadata['columns'] = {**child_cols, **parent_cols}
|
|
102
103
|
if 'primary_key' in merged_metadata:
|
|
103
104
|
primary_key = merged_metadata['primary_key']
|
|
104
|
-
|
|
105
|
+
if isinstance(primary_key, list):
|
|
106
|
+
merged_metadata['primary_key'] = [
|
|
107
|
+
f'{child_table}.{pk_col}' for pk_col in primary_key
|
|
108
|
+
]
|
|
109
|
+
else:
|
|
110
|
+
merged_metadata['primary_key'] = f'{child_table}.{primary_key}'
|
|
105
111
|
|
|
106
112
|
return merged_metadata, list(parent_cols.keys()), list(child_cols.keys())
|
|
107
113
|
|
|
@@ -123,6 +129,7 @@ class InterTableTrends(BaseMultiTableProperty):
|
|
|
123
129
|
parent = relationship['parent_table_name']
|
|
124
130
|
child = relationship['child_table_name']
|
|
125
131
|
foreign_key = relationship['child_foreign_key']
|
|
132
|
+
fk_tuple = tuple(foreign_key) if isinstance(foreign_key, list) else foreign_key
|
|
126
133
|
|
|
127
134
|
denormalized_real, denormalized_synthetic = self._denormalize_tables(
|
|
128
135
|
real_data, synthetic_data, relationship
|
|
@@ -132,14 +139,14 @@ class InterTableTrends(BaseMultiTableProperty):
|
|
|
132
139
|
|
|
133
140
|
parent_child_pairs = itertools.product(parent_cols, child_cols)
|
|
134
141
|
|
|
135
|
-
self._properties[(parent, child,
|
|
142
|
+
self._properties[(parent, child, fk_tuple)] = SingleTableColumnPairTrends()
|
|
136
143
|
self._properties[
|
|
137
|
-
(parent, child,
|
|
144
|
+
(parent, child, fk_tuple)
|
|
138
145
|
].real_correlation_threshold = self.real_correlation_threshold
|
|
139
146
|
self._properties[
|
|
140
|
-
(parent, child,
|
|
147
|
+
(parent, child, fk_tuple)
|
|
141
148
|
].real_association_threshold = self.real_association_threshold
|
|
142
|
-
details = self._properties[(parent, child,
|
|
149
|
+
details = self._properties[(parent, child, fk_tuple)]._generate_details(
|
|
143
150
|
denormalized_real,
|
|
144
151
|
denormalized_synthetic,
|
|
145
152
|
merged_metadata,
|
|
@@ -149,7 +156,7 @@ class InterTableTrends(BaseMultiTableProperty):
|
|
|
149
156
|
|
|
150
157
|
details['Parent Table'] = parent
|
|
151
158
|
details['Child Table'] = child
|
|
152
|
-
details['Foreign Key'] = foreign_key
|
|
159
|
+
details['Foreign Key'] = str(foreign_key)
|
|
153
160
|
if not details.empty:
|
|
154
161
|
details['Column 1'] = details['Column 1'].str.replace(
|
|
155
162
|
f'{parent}.', '', n=1, regex=False
|
|
@@ -233,18 +240,15 @@ class InterTableTrends(BaseMultiTableProperty):
|
|
|
233
240
|
def get_visualization(self, table_name=None):
|
|
234
241
|
"""Create a plot to show the inter table trends data.
|
|
235
242
|
|
|
236
|
-
Returns:
|
|
237
|
-
plotly.graph_objects._figure.Figure
|
|
238
|
-
|
|
239
243
|
Args:
|
|
240
244
|
table_name (str, optional):
|
|
241
245
|
Table to plot. Defaults to None.
|
|
242
246
|
|
|
243
|
-
Raises:
|
|
244
|
-
- ``ValueError`` if property has not been computed.
|
|
245
|
-
|
|
246
247
|
Returns:
|
|
247
248
|
plotly.graph_objects._figure.Figure
|
|
249
|
+
|
|
250
|
+
Raises:
|
|
251
|
+
- ``ValueError`` if property has not been computed.
|
|
248
252
|
"""
|
|
249
253
|
if not self.is_computed:
|
|
250
254
|
raise ValueError(
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import pandas as pd
|
|
4
4
|
|
|
5
5
|
from sdmetrics.reports.base_report import BaseReport
|
|
6
|
+
from sdmetrics.utils import _cast_to_iterable
|
|
6
7
|
from sdmetrics.visualization import set_plotly_config
|
|
7
8
|
|
|
8
9
|
|
|
@@ -43,22 +44,36 @@ class BaseMultiTableReport(BaseReport):
|
|
|
43
44
|
def _validate_relationships(self, real_data, synthetic_data, metadata):
|
|
44
45
|
"""Validate that the relationships are valid."""
|
|
45
46
|
for rel in metadata.get('relationships', []):
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
parent = rel['parent_table_name']
|
|
48
|
+
parent_key = rel['parent_primary_key']
|
|
49
|
+
child = rel['child_table_name']
|
|
50
|
+
child_key = rel['child_foreign_key']
|
|
51
|
+
parent_key_str = f"'{parent_key}'" if isinstance(parent_key, str) else str(parent_key)
|
|
52
|
+
child_key_str = f"'{child_key}'" if isinstance(child_key, str) else str(child_key)
|
|
53
|
+
parent_primary_key = _cast_to_iterable(parent_key)
|
|
54
|
+
child_foreign_key = _cast_to_iterable(child_key)
|
|
55
|
+
|
|
56
|
+
if len(parent_primary_key) != len(child_foreign_key):
|
|
55
57
|
error_msg = (
|
|
56
58
|
f"The '{parent}' table and '{child}' table cannot be merged "
|
|
57
|
-
'for computing the cardinality. Please make sure the
|
|
58
|
-
f
|
|
59
|
-
f
|
|
59
|
+
'for computing the cardinality. Please make sure the number of columns '
|
|
60
|
+
f'in the primary key ({parent_key_str}) matches the number of '
|
|
61
|
+
f'columns in the foreign key ({child_key_str}).'
|
|
60
62
|
)
|
|
61
63
|
raise ValueError(error_msg)
|
|
64
|
+
parent_dtypes = real_data[rel['parent_table_name']][parent_primary_key].dtypes
|
|
65
|
+
child_dtypes = real_data[rel['child_table_name']][child_foreign_key].dtypes
|
|
66
|
+
for parent_dtype, child_dtype in zip(parent_dtypes, child_dtypes):
|
|
67
|
+
if (parent_dtype == 'object' and child_dtype != 'object') or (
|
|
68
|
+
parent_dtype != 'object' and child_dtype == 'object'
|
|
69
|
+
):
|
|
70
|
+
error_msg = (
|
|
71
|
+
f"The '{parent}' table and '{child}' table cannot be merged "
|
|
72
|
+
'for computing the cardinality. Please make sure the primary key'
|
|
73
|
+
f" in '{parent}' ({parent_key_str}) and the foreign key in '{child}'"
|
|
74
|
+
f' ({child_key_str}) have the same data types.'
|
|
75
|
+
)
|
|
76
|
+
raise ValueError(error_msg)
|
|
62
77
|
|
|
63
78
|
def _validate_metadata_matches_data(self, real_data, synthetic_data, metadata):
|
|
64
79
|
"""Validate that the metadata matches the data."""
|
|
@@ -39,13 +39,19 @@ class DataValidity(BaseSingleTableProperty):
|
|
|
39
39
|
The progress bar to use. Defaults to None.
|
|
40
40
|
"""
|
|
41
41
|
column_names, metric_names, scores = [], [], []
|
|
42
|
+
column_sdtypes = [(col, metadata['columns'][col]['sdtype']) for col in metadata['columns']]
|
|
42
43
|
error_messages = []
|
|
43
44
|
primary_key = metadata.get('primary_key')
|
|
45
|
+
if isinstance(primary_key, list):
|
|
46
|
+
if len(primary_key) > 1:
|
|
47
|
+
column_sdtypes = [(primary_key, None)] + column_sdtypes
|
|
48
|
+
else:
|
|
49
|
+
primary_key = primary_key[0]
|
|
50
|
+
|
|
44
51
|
alternate_keys = metadata.get('alternate_keys', [])
|
|
45
52
|
sequence_index = metadata.get('sequence_index')
|
|
46
53
|
|
|
47
|
-
for column_name in
|
|
48
|
-
sdtype = metadata['columns'][column_name]['sdtype']
|
|
54
|
+
for column_name, sdtype in column_sdtypes:
|
|
49
55
|
primary_key_match = column_name == primary_key
|
|
50
56
|
alternate_key_match = column_name in alternate_keys
|
|
51
57
|
is_unique = primary_key_match or alternate_key_match
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
5
7
|
from sdmetrics.goal import Goal
|
|
6
8
|
from sdmetrics.single_column.base import SingleColumnMetric
|
|
7
9
|
|
|
@@ -34,21 +36,27 @@ class KeyUniqueness(SingleColumnMetric):
|
|
|
34
36
|
"""Compute the score breakdown of the key uniqueness metric.
|
|
35
37
|
|
|
36
38
|
Args:
|
|
37
|
-
real_data (pandas.Series):
|
|
38
|
-
The real data.
|
|
39
|
-
synthetic_data (pandas.Series):
|
|
40
|
-
The synthetic data.
|
|
39
|
+
real_data (pandas.DataFrame or pd.Series):
|
|
40
|
+
The real data key.
|
|
41
|
+
synthetic_data (pandas.DataFrame or pd.Series):
|
|
42
|
+
The synthetic data key.
|
|
41
43
|
|
|
42
44
|
Returns:
|
|
43
45
|
dict:
|
|
44
46
|
The score breakdown of the key uniqueness metric.
|
|
45
47
|
"""
|
|
48
|
+
if isinstance(real_data, pd.Series):
|
|
49
|
+
real_data = real_data.to_frame()
|
|
50
|
+
if isinstance(synthetic_data, pd.Series):
|
|
51
|
+
synthetic_data = synthetic_data.to_frame()
|
|
52
|
+
|
|
46
53
|
has_duplicates = real_data.duplicated().any()
|
|
47
|
-
has_nans = real_data.isna().any()
|
|
54
|
+
has_nans = real_data.isna().all(axis=1).any()
|
|
48
55
|
if has_duplicates or has_nans:
|
|
49
56
|
LOGGER.info('The real data contains NA or duplicate values.')
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
is_nan_synthetic = synthetic_data.isna().all(axis=1)
|
|
59
|
+
nans_or_duplicates_synthetic = synthetic_data.duplicated() | is_nan_synthetic
|
|
52
60
|
score = 1 - nans_or_duplicates_synthetic.sum() / len(synthetic_data)
|
|
53
61
|
|
|
54
62
|
return {'score': score}
|
|
@@ -58,10 +66,10 @@ class KeyUniqueness(SingleColumnMetric):
|
|
|
58
66
|
"""Compute the key uniqueness metric.
|
|
59
67
|
|
|
60
68
|
Args:
|
|
61
|
-
real_data (
|
|
62
|
-
The real data.
|
|
63
|
-
synthetic_data (
|
|
64
|
-
The synthetic data.
|
|
69
|
+
real_data (pd.DataFrame or pd.Series):
|
|
70
|
+
The real data key.
|
|
71
|
+
synthetic_data (pd.DataFrame or pd.Series):
|
|
72
|
+
The synthetic data key.
|
|
65
73
|
|
|
66
74
|
Returns:
|
|
67
75
|
float:
|
|
@@ -172,10 +172,12 @@ For example, we could execute the same metric as before by adding the `target` e
|
|
|
172
172
|
metadata dict:
|
|
173
173
|
|
|
174
174
|
```python
|
|
175
|
-
In
|
|
175
|
+
In[11]: users_metadata = metadata['tables']['users'].copy()
|
|
176
176
|
|
|
177
|
-
In
|
|
177
|
+
In[12]: users_metadata['target'] = 'country'
|
|
178
178
|
|
|
179
|
-
In
|
|
179
|
+
In[13]: MulticlassDecisionTreeClassifier.compute(
|
|
180
|
+
real_table, synthetic_table, metadata=users_metadata
|
|
181
|
+
)
|
|
180
182
|
Out[13]: (0.05555555555555555,)
|
|
181
183
|
```
|
|
@@ -68,8 +68,8 @@ For example, we could execute the same metric as before by adding the `target` e
|
|
|
68
68
|
metadata dict:
|
|
69
69
|
|
|
70
70
|
```python
|
|
71
|
-
In
|
|
71
|
+
In[7]: metadata['sequence_key'] = 'store_id'
|
|
72
72
|
|
|
73
|
-
In
|
|
73
|
+
In[8]: LSTMDetection.compute(real_data, synthetic_data, metadata=metadata)
|
|
74
74
|
Out[8]: 0.5
|
|
75
75
|
```
|
|
@@ -90,17 +90,22 @@ def get_cardinality_distribution(parent_column, child_column):
|
|
|
90
90
|
"""Compute the cardinality distribution of the (parent, child) pairing.
|
|
91
91
|
|
|
92
92
|
Args:
|
|
93
|
-
parent_column (
|
|
94
|
-
The parent column.
|
|
95
|
-
child_column (
|
|
96
|
-
The child column.
|
|
93
|
+
parent_column (pd.Series or pd.DataFrame):
|
|
94
|
+
The parent column(s).
|
|
95
|
+
child_column (pd.Series or pd.DataFrame):
|
|
96
|
+
The child column(s).
|
|
97
97
|
|
|
98
98
|
Returns:
|
|
99
|
-
|
|
99
|
+
pd.Series:
|
|
100
100
|
The cardinality distribution.
|
|
101
101
|
"""
|
|
102
|
-
child_df = pd.DataFrame({'child_counts': child_column.value_counts()})
|
|
103
|
-
|
|
102
|
+
child_df = pd.DataFrame({'child_counts': child_column.value_counts(dropna=False)})
|
|
103
|
+
parent_df = (
|
|
104
|
+
pd.DataFrame({'parent': parent_column})
|
|
105
|
+
if isinstance(parent_column, pd.Series)
|
|
106
|
+
else parent_column
|
|
107
|
+
)
|
|
108
|
+
cardinality_df = parent_df.join(child_df, on=list(parent_df.columns)).fillna(0)
|
|
104
109
|
|
|
105
110
|
return cardinality_df['child_counts']
|
|
106
111
|
|
|
@@ -316,3 +321,11 @@ def strip_characters(list_character, a_string):
|
|
|
316
321
|
result = result.replace(character, '')
|
|
317
322
|
|
|
318
323
|
return result
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def _cast_to_iterable(value):
|
|
327
|
+
"""Return a ``list`` if the input object is not a ``list`` or ``tuple``."""
|
|
328
|
+
if isinstance(value, (list, tuple)):
|
|
329
|
+
return value
|
|
330
|
+
|
|
331
|
+
return [value]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdmetrics
|
|
3
|
-
Version: 0.27.
|
|
3
|
+
Version: 0.27.3.dev0
|
|
4
4
|
Summary: Metrics for Synthetic Data Generation Projects
|
|
5
5
|
Author-email: MIT Data To AI Lab <dailabmit@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -176,10 +176,7 @@ my_report = QualityReport.load(filepath='demo_data_quality_report.pkl')
|
|
|
176
176
|
# set by the real data
|
|
177
177
|
from sdmetrics.single_column import BoundaryAdherence
|
|
178
178
|
|
|
179
|
-
BoundaryAdherence.compute(
|
|
180
|
-
real_data['start_date'],
|
|
181
|
-
synthetic_data['start_date']
|
|
182
|
-
)
|
|
179
|
+
BoundaryAdherence.compute(real_data['start_date'], synthetic_data['start_date'])
|
|
183
180
|
```
|
|
184
181
|
```
|
|
185
182
|
0.8503937007874016
|
|
@@ -189,11 +186,7 @@ BoundaryAdherence.compute(
|
|
|
189
186
|
# calculate whether the synthetic data is new or whether it's an exact copy of the real data
|
|
190
187
|
from sdmetrics.single_table import NewRowSynthesis
|
|
191
188
|
|
|
192
|
-
NewRowSynthesis.compute(
|
|
193
|
-
real_data,
|
|
194
|
-
synthetic_data,
|
|
195
|
-
metadata
|
|
196
|
-
)
|
|
189
|
+
NewRowSynthesis.compute(real_data, synthetic_data, metadata)
|
|
197
190
|
```
|
|
198
191
|
```
|
|
199
192
|
1.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/inter_row_msas.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/kl_divergence.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/column_pairs/statistical/statistic_msas.py
RENAMED
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/sessions_real.csv
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/sessions_synthetic.csv
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/transactions_real.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/demos/multi_table/users_synthetic.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/detection/parent_child.py
RENAMED
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/multi_table/statistical/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/_properties/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/diagnostic_report.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/multi_table/quality_report.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/_properties/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/diagnostic_report.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/plot_utils.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/reports/single_table/quality_report.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/cstest.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/kscomplement.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_column/statistical/tv_complement.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/__init__.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/data_augmentation/utils.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/detection/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/mlefficacy.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/multiclass.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/efficacy/regression.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/multi_column_pairs.py
RENAMED
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/multi_single_column.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/single_table/privacy/numerical_sklearn.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sdmetrics-0.27.2.dev0 → sdmetrics-0.27.3.dev0}/sdmetrics/timeseries/efficacy/classification.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|