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.
Files changed (88) hide show
  1. {sdv-1.37.4.dev0/sdv.egg-info → sdv-1.37.5.dev0}/PKG-INFO +1 -1
  2. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/pyproject.toml +1 -1
  3. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/__init__.py +1 -1
  4. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/_utils.py +11 -0
  5. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/multi_table.py +1 -2
  6. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/single_table.py +7 -6
  7. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/multi_table.py +20 -0
  8. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/hma.py +14 -36
  9. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0/sdv.egg-info}/PKG-INFO +1 -1
  10. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/LICENSE +0 -0
  11. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/README.md +0 -0
  12. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/__init__.py +0 -0
  13. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/_errors.py +0 -0
  14. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/_utils.py +0 -0
  15. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/base.py +0 -0
  16. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/fixed_combinations.py +0 -0
  17. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/fixed_increments.py +0 -0
  18. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/inequality.py +0 -0
  19. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/one_hot_encoding.py +0 -0
  20. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/programmable_constraint.py +0 -0
  21. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/cag/range.py +0 -0
  22. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/__init__.py +0 -0
  23. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/base.py +0 -0
  24. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/errors.py +0 -0
  25. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/tabular.py +0 -0
  26. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/constraints/utils.py +0 -0
  27. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/__init__.py +0 -0
  28. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/data_processor.py +0 -0
  29. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/datetime_formatter.py +0 -0
  30. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/errors.py +0 -0
  31. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/numerical_formatter.py +0 -0
  32. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/data_processing/utils.py +0 -0
  33. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/datasets/__init__.py +0 -0
  34. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/datasets/demo.py +0 -0
  35. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/datasets/local.py +0 -0
  36. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/errors.py +0 -0
  37. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/__init__.py +0 -0
  38. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/_utils.py +0 -0
  39. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/evaluation/evaluation.py +0 -0
  40. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/io/__init__.py +0 -0
  41. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/io/local/__init__.py +0 -0
  42. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/io/local/local.py +0 -0
  43. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/lite/__init__.py +0 -0
  44. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/lite/single_table.py +0 -0
  45. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/__init__.py +0 -0
  46. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/logger.py +0 -0
  47. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/sdv_logger_config.yml +0 -0
  48. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/logging/utils.py +0 -0
  49. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/__init__.py +0 -0
  50. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/errors.py +0 -0
  51. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/metadata.py +0 -0
  52. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/metadata_upgrader.py +0 -0
  53. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/single_table.py +0 -0
  54. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/utils.py +0 -0
  55. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metadata/visualization.py +0 -0
  56. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/__init__.py +0 -0
  57. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/demos.py +0 -0
  58. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/relational.py +0 -0
  59. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/tabular.py +0 -0
  60. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/metrics/timeseries.py +0 -0
  61. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/__init__.py +0 -0
  62. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/base.py +0 -0
  63. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/dayz.py +0 -0
  64. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/multi_table/utils.py +0 -0
  65. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/__init__.py +0 -0
  66. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/hierarchical_sampler.py +0 -0
  67. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/independent_sampler.py +0 -0
  68. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sampling/tabular.py +0 -0
  69. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sequential/__init__.py +0 -0
  70. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/sequential/par.py +0 -0
  71. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/__init__.py +0 -0
  72. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/base.py +0 -0
  73. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/copulagan.py +0 -0
  74. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/copulas.py +0 -0
  75. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/ctgan.py +0 -0
  76. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/dayz.py +0 -0
  77. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/single_table/utils.py +0 -0
  78. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/__init__.py +0 -0
  79. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/mixins.py +0 -0
  80. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/poc.py +0 -0
  81. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/utils/utils.py +0 -0
  82. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv/version/__init__.py +0 -0
  83. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/SOURCES.txt +0 -0
  84. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/dependency_links.txt +0 -0
  85. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/entry_points.txt +0 -0
  86. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/requires.txt +0 -0
  87. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/sdv.egg-info/top_level.txt +0 -0
  88. {sdv-1.37.4.dev0 → sdv-1.37.5.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdv
3
- Version: 1.37.4.dev0
3
+ Version: 1.37.5.dev0
4
4
  Summary: Generate synthetic data for single table, multi table and sequential data
5
5
  Author-email: "DataCebo, Inc." <info@sdv.dev>
6
6
  License-Expression: BUSL-1.1
@@ -149,7 +149,7 @@ namespaces = false
149
149
  version = {attr = 'sdv.__version__'}
150
150
 
151
151
  [tool.bumpversion]
152
- current_version = "1.37.4.dev0"
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}',
@@ -6,7 +6,7 @@
6
6
 
7
7
  __author__ = 'DataCebo, Inc.'
8
8
  __email__ = 'info@sdv.dev'
9
- __version__ = '1.37.4.dev0'
9
+ __version__ = '1.37.5.dev0'
10
10
 
11
11
 
12
12
  import sys
@@ -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.diagnostic_report import DiagnosticReport
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.single_table.diagnostic_report import DiagnosticReport
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
- if isinstance(metadata, Metadata):
33
- metadata = metadata._convert_to_single_table()
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
- if isinstance(metadata, Metadata):
60
- metadata = metadata._convert_to_single_table()
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._print_estimate_warning()
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 _print_estimate_warning(self):
264
- total_est_cols = 0
265
- metadata_columns = self._get_num_data_columns(self.metadata)
266
- print_table = []
267
- distributions = self._get_distributions()
268
- estimated_columns = self._estimate_num_columns(self.metadata, distributions)
269
- for table, est_cols in estimated_columns.items():
270
- entry = []
271
- entry.append(table)
272
- entry.append(sum(metadata_columns[table]))
273
- total_est_cols += est_cols
274
- entry.append(min(est_cols, PERFORMANCE_ALERT_DISPLAY_CAP))
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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdv
3
- Version: 1.37.4.dev0
3
+ Version: 1.37.5.dev0
4
4
  Summary: Generate synthetic data for single table, multi table and sequential data
5
5
  Author-email: "DataCebo, Inc." <info@sdv.dev>
6
6
  License-Expression: BUSL-1.1
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