sdv 1.37.4.dev0__tar.gz → 1.37.5.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.
- {sdv-1.37.4.dev0/sdv.egg-info → sdv-1.37.5.dev0}/PKG-INFO +1 -1
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/pyproject.toml +1 -1
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/__init__.py +1 -1
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/_utils.py +11 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/multi_table.py +1 -2
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/single_table.py +7 -6
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/multi_table.py +20 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/hma.py +14 -36
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0/sdv.egg-info}/PKG-INFO +1 -1
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/LICENSE +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/README.md +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/_errors.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/_utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/base.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/fixed_combinations.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/fixed_increments.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/inequality.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/one_hot_encoding.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/programmable_constraint.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/range.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/base.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/errors.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/tabular.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/data_processor.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/datetime_formatter.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/errors.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/numerical_formatter.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/datasets/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/datasets/demo.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/datasets/local.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/errors.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/_utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/evaluation.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/io/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/io/local/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/io/local/local.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/lite/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/lite/single_table.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/logger.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/sdv_logger_config.yml +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/errors.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/metadata.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/metadata_upgrader.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/single_table.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/visualization.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/demos.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/relational.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/tabular.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/timeseries.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/base.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/dayz.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/hierarchical_sampler.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/independent_sampler.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/tabular.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sequential/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sequential/par.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/base.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/copulagan.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/copulas.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/ctgan.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/dayz.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/mixins.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/poc.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/utils.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/version/__init__.py +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/SOURCES.txt +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/dependency_links.txt +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/entry_points.txt +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/requires.txt +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/top_level.txt +0 -0
- {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/setup.cfg +0 -0
|
@@ -149,7 +149,7 @@ namespaces = false
|
|
|
149
149
|
version = {attr = 'sdv.__version__'}
|
|
150
150
|
|
|
151
151
|
[tool.bumpversion]
|
|
152
|
-
current_version = "1.37.
|
|
152
|
+
current_version = "1.37.5.dev0"
|
|
153
153
|
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?'
|
|
154
154
|
serialize = [
|
|
155
155
|
'{major}.{minor}.{patch}.{release}{candidate}',
|
|
@@ -417,6 +417,17 @@ def _get_root_tables(relationships):
|
|
|
417
417
|
return parent_tables - child_tables
|
|
418
418
|
|
|
419
419
|
|
|
420
|
+
def _get_max_child_depth(child_map, table):
|
|
421
|
+
"""Return the max child depth for the given table."""
|
|
422
|
+
max_depth = 1
|
|
423
|
+
for child in child_map[table]:
|
|
424
|
+
child_depth = 1 + _get_max_child_depth(child_map, child)
|
|
425
|
+
if child_depth > max_depth:
|
|
426
|
+
max_depth = child_depth
|
|
427
|
+
|
|
428
|
+
return max_depth
|
|
429
|
+
|
|
430
|
+
|
|
420
431
|
def generate_synthesizer_id(synthesizer):
|
|
421
432
|
"""Generate a unique identifier for the synthesizer instance.
|
|
422
433
|
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
import warnings
|
|
4
4
|
|
|
5
5
|
from sdmetrics import visualization
|
|
6
|
-
from sdmetrics.reports.multi_table
|
|
7
|
-
from sdmetrics.reports.multi_table.quality_report import QualityReport
|
|
6
|
+
from sdmetrics.reports.multi_table import DiagnosticReport, QualityReport
|
|
8
7
|
|
|
9
8
|
import sdv.evaluation.single_table as single_table_visualization
|
|
10
9
|
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
import warnings
|
|
4
4
|
|
|
5
5
|
from sdmetrics import visualization
|
|
6
|
-
from sdmetrics.reports
|
|
7
|
-
from sdmetrics.reports.single_table.quality_report import QualityReport
|
|
6
|
+
from sdmetrics.reports import DiagnosticReport, QualityReport
|
|
8
7
|
|
|
9
8
|
from sdv.errors import VisualizationUnavailableError
|
|
10
9
|
from sdv.evaluation._utils import _prepare_data_visualization
|
|
@@ -29,8 +28,9 @@ def _evaluate_quality(real_data, synthetic_data, metadata, verbose=True):
|
|
|
29
28
|
QualityReport:
|
|
30
29
|
Single table quality report object.
|
|
31
30
|
"""
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
table_name = metadata._get_single_table_name()
|
|
32
|
+
real_data = {table_name: real_data}
|
|
33
|
+
synthetic_data = {table_name: synthetic_data}
|
|
34
34
|
|
|
35
35
|
quality_report = QualityReport()
|
|
36
36
|
quality_report.generate(real_data, synthetic_data, metadata.to_dict(), verbose)
|
|
@@ -56,8 +56,9 @@ def _run_diagnostic(real_data, synthetic_data, metadata, verbose=True):
|
|
|
56
56
|
Single table diagnostic report object.
|
|
57
57
|
"""
|
|
58
58
|
diagnostic_report = DiagnosticReport()
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
table_name = metadata._get_single_table_name()
|
|
60
|
+
real_data = {table_name: real_data}
|
|
61
|
+
synthetic_data = {table_name: synthetic_data}
|
|
61
62
|
|
|
62
63
|
diagnostic_report.generate(real_data, synthetic_data, metadata.to_dict(), verbose)
|
|
63
64
|
return diagnostic_report
|
|
@@ -14,6 +14,8 @@ import pandas as pd
|
|
|
14
14
|
from sdv._utils import (
|
|
15
15
|
_cast_to_iterable,
|
|
16
16
|
_format_invalid_values_string,
|
|
17
|
+
_get_max_child_depth,
|
|
18
|
+
_get_root_tables,
|
|
17
19
|
_get_unreferenced_keys,
|
|
18
20
|
_load_data_from_csv,
|
|
19
21
|
)
|
|
@@ -289,6 +291,24 @@ class MultiTableMetadata:
|
|
|
289
291
|
foreign_keys = self._get_all_foreign_keys(table_name)
|
|
290
292
|
return set(foreign_keys).union(self.tables[table_name]._get_primary_and_alternate_keys())
|
|
291
293
|
|
|
294
|
+
def _get_max_schema_depth(self):
|
|
295
|
+
"""Calculate the maximum depth of this schema.
|
|
296
|
+
|
|
297
|
+
This method traverses all relationships and returns the length of the longest relationship
|
|
298
|
+
chain between tables.
|
|
299
|
+
|
|
300
|
+
Returns:
|
|
301
|
+
int:
|
|
302
|
+
The maximum depth of the schema.
|
|
303
|
+
"""
|
|
304
|
+
max_depth = 1
|
|
305
|
+
child_map = self._get_child_map()
|
|
306
|
+
for root_table in _get_root_tables(self.relationships):
|
|
307
|
+
root_depth = _get_max_child_depth(child_map, root_table)
|
|
308
|
+
max_depth = root_depth if root_depth > max_depth else max_depth
|
|
309
|
+
|
|
310
|
+
return max_depth
|
|
311
|
+
|
|
292
312
|
def add_relationship(
|
|
293
313
|
self, parent_table_name, child_table_name, parent_primary_key, child_foreign_key
|
|
294
314
|
):
|
|
@@ -203,7 +203,7 @@ class HMASynthesizer(BaseHierarchicalSampler, BaseMultiTableSynthesizer):
|
|
|
203
203
|
child_tables.add(relationship['child_table_name'])
|
|
204
204
|
for child_table_name in child_tables:
|
|
205
205
|
self.set_table_parameters(child_table_name, {'default_distribution': 'norm'})
|
|
206
|
-
self.
|
|
206
|
+
self._validate_schema_complexity()
|
|
207
207
|
|
|
208
208
|
def set_table_parameters(self, table_name, table_parameters):
|
|
209
209
|
"""Update the table's synthesizer instantiation parameters.
|
|
@@ -260,42 +260,20 @@ class HMASynthesizer(BaseHierarchicalSampler, BaseMultiTableSynthesizer):
|
|
|
260
260
|
|
|
261
261
|
return distributions
|
|
262
262
|
|
|
263
|
-
def
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
print_table.append(entry)
|
|
276
|
-
|
|
277
|
-
if total_est_cols > MAX_NUMBER_OF_COLUMNS:
|
|
278
|
-
display_total = (
|
|
279
|
-
f'{PERFORMANCE_ALERT_DISPLAY_CAP}+'
|
|
280
|
-
if total_est_cols > PERFORMANCE_ALERT_DISPLAY_CAP
|
|
281
|
-
else f'{total_est_cols}'
|
|
282
|
-
)
|
|
283
|
-
self._print(
|
|
284
|
-
'PerformanceAlert: Using the HMASynthesizer on this metadata '
|
|
285
|
-
'schema is not recommended. To model this data, HMA will '
|
|
286
|
-
f'generate a large number of columns. ({display_total} columns)\n\n'
|
|
287
|
-
)
|
|
288
|
-
self._print(
|
|
289
|
-
pd.DataFrame(
|
|
290
|
-
print_table, columns=['Table Name', '# Columns in Metadata', 'Est # Columns']
|
|
291
|
-
).to_string(index=False)
|
|
292
|
-
+ '\n'
|
|
293
|
-
)
|
|
294
|
-
self._print(
|
|
295
|
-
'We recommend simplifying your metadata schema using '
|
|
296
|
-
"'sdv.utils.poc.simplify_schema'.\nIf this is not possible, please visit "
|
|
297
|
-
'datacebo.com and reach out to us for enterprise solutions.\n'
|
|
263
|
+
def _validate_schema_complexity(self):
|
|
264
|
+
num_tables = len(self.metadata.tables)
|
|
265
|
+
schema_depth = self.metadata._get_max_schema_depth()
|
|
266
|
+
|
|
267
|
+
if num_tables > 5 or schema_depth > 2:
|
|
268
|
+
error_msg = (
|
|
269
|
+
'HMASynthesizer is not designed to handle a schema with more than 5 tables or '
|
|
270
|
+
'relationship depth greater than 2.\n'
|
|
271
|
+
'Please use SDV Enterprise to model this schema.\n\n'
|
|
272
|
+
'SDV Enterprise provides access to synthesizers that can easily scale with the '
|
|
273
|
+
'amount of data and complexity of your schema.\n\n'
|
|
274
|
+
'For more information, visit datacebo.com'
|
|
298
275
|
)
|
|
276
|
+
raise SynthesizerInputError(error_msg)
|
|
299
277
|
|
|
300
278
|
def preprocess(self, data):
|
|
301
279
|
"""Transform the raw data to numerical space.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|