sdv 1.37.1.dev0__tar.gz → 1.37.2.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.1.dev0/sdv.egg-info → sdv-1.37.2.dev0}/PKG-INFO +1 -1
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/pyproject.toml +1 -1
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/__init__.py +1 -1
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/__init__.py +2 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/programmable_constraint.py +55 -4
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0/sdv.egg-info}/PKG-INFO +1 -1
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/LICENSE +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/README.md +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/_utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/_errors.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/_utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/base.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/fixed_combinations.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/fixed_increments.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/inequality.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/one_hot_encoding.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/cag/range.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/constraints/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/constraints/base.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/constraints/errors.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/constraints/tabular.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/constraints/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/data_processing/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/data_processing/data_processor.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/data_processing/datetime_formatter.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/data_processing/errors.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/data_processing/numerical_formatter.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/data_processing/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/datasets/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/datasets/demo.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/datasets/local.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/errors.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/evaluation/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/evaluation/_utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/evaluation/multi_table.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/evaluation/single_table.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/io/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/io/local/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/io/local/local.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/lite/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/lite/single_table.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/logging/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/logging/logger.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/logging/sdv_logger_config.yml +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/logging/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/errors.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/metadata.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/metadata_upgrader.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/multi_table.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/single_table.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metadata/visualization.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metrics/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metrics/demos.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metrics/relational.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metrics/tabular.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/metrics/timeseries.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/multi_table/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/multi_table/base.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/multi_table/dayz.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/multi_table/hma.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/multi_table/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/sampling/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/sampling/hierarchical_sampler.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/sampling/independent_sampler.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/sampling/tabular.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/sequential/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/sequential/par.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/base.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/copulagan.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/copulas.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/ctgan.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/dayz.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/single_table/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/utils/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/utils/mixins.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/utils/poc.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/utils/utils.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv/version/__init__.py +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv.egg-info/SOURCES.txt +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv.egg-info/dependency_links.txt +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv.egg-info/entry_points.txt +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv.egg-info/requires.txt +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.dev0}/sdv.egg-info/top_level.txt +0 -0
- {sdv-1.37.1.dev0 → sdv-1.37.2.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.2.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}',
|
|
@@ -7,6 +7,7 @@ from sdv.cag.range import Range
|
|
|
7
7
|
from sdv.cag.one_hot_encoding import OneHotEncoding
|
|
8
8
|
from sdv.cag.programmable_constraint import (
|
|
9
9
|
ProgrammableConstraint,
|
|
10
|
+
SingleTableProgrammableConstraint,
|
|
10
11
|
)
|
|
11
12
|
|
|
12
13
|
__all__ = (
|
|
@@ -16,4 +17,5 @@ __all__ = (
|
|
|
16
17
|
'Range',
|
|
17
18
|
'OneHotEncoding',
|
|
18
19
|
'ProgrammableConstraint',
|
|
20
|
+
'SingleTableProgrammableConstraint',
|
|
19
21
|
)
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import inspect
|
|
4
4
|
from copy import deepcopy
|
|
5
5
|
|
|
6
|
+
from sdv.cag._errors import ConstraintNotMetError
|
|
6
7
|
from sdv.cag.base import BaseConstraint
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class ProgrammableConstraint:
|
|
10
11
|
"""Base class to create programmable constraints."""
|
|
11
12
|
|
|
12
|
-
_is_single_table =
|
|
13
|
+
_is_single_table = False
|
|
13
14
|
|
|
14
15
|
@classmethod
|
|
15
16
|
def load_constraint_from_dict(cls, parameters):
|
|
@@ -130,6 +131,12 @@ class ProgrammableConstraint:
|
|
|
130
131
|
return synthetic_data
|
|
131
132
|
|
|
132
133
|
|
|
134
|
+
class SingleTableProgrammableConstraint(ProgrammableConstraint):
|
|
135
|
+
"""Single table variant of the base programmable constraint class."""
|
|
136
|
+
|
|
137
|
+
_is_single_table = True
|
|
138
|
+
|
|
139
|
+
|
|
133
140
|
class ProgrammableConstraintHarness(BaseConstraint):
|
|
134
141
|
"""Constraint interface class for programmable constraints."""
|
|
135
142
|
|
|
@@ -139,6 +146,10 @@ class ProgrammableConstraintHarness(BaseConstraint):
|
|
|
139
146
|
self.table_name = getattr(self.programmable_constraint, 'table_name', None)
|
|
140
147
|
self._is_single_table = self.programmable_constraint._is_single_table
|
|
141
148
|
|
|
149
|
+
@property
|
|
150
|
+
def _is_programmable_single_table_constraint(self):
|
|
151
|
+
return isinstance(self.programmable_constraint, SingleTableProgrammableConstraint)
|
|
152
|
+
|
|
142
153
|
def get_constraint_dict(self):
|
|
143
154
|
"""Return the constraint as a serialiazable dict.
|
|
144
155
|
|
|
@@ -170,9 +181,21 @@ class ProgrammableConstraintHarness(BaseConstraint):
|
|
|
170
181
|
}
|
|
171
182
|
|
|
172
183
|
def _validate_constraint_with_metadata(self, metadata):
|
|
184
|
+
if self._is_programmable_single_table_constraint and len(metadata.tables) != 1:
|
|
185
|
+
if getattr(self.programmable_constraint, 'table_name', None) is None:
|
|
186
|
+
raise ConstraintNotMetError(
|
|
187
|
+
'SingleTableProgrammableConstraint cannot be used with multi-table metadata '
|
|
188
|
+
'if the `table_name` attribute has not been set. Please set the table name '
|
|
189
|
+
'attribute to the target table, or use the ProgrammableContraint '
|
|
190
|
+
'base class instead.'
|
|
191
|
+
)
|
|
192
|
+
|
|
173
193
|
self.programmable_constraint.validate(metadata)
|
|
174
194
|
|
|
175
195
|
def _validate_constraint_with_data(self, data, metadata):
|
|
196
|
+
if self._is_programmable_single_table_constraint:
|
|
197
|
+
data = data[self._get_single_table_name(metadata)]
|
|
198
|
+
|
|
176
199
|
self.programmable_constraint.validate_input_data(data)
|
|
177
200
|
|
|
178
201
|
def _get_updated_metadata(self, metadata):
|
|
@@ -180,13 +203,41 @@ class ProgrammableConstraintHarness(BaseConstraint):
|
|
|
180
203
|
return self.programmable_constraint.get_updated_metadata(metadata)
|
|
181
204
|
|
|
182
205
|
def _fit(self, data, metadata):
|
|
206
|
+
if self._is_programmable_single_table_constraint:
|
|
207
|
+
data = data[self._table_name]
|
|
208
|
+
|
|
183
209
|
self.programmable_constraint.fit(data, metadata)
|
|
184
210
|
|
|
185
211
|
def _transform(self, data):
|
|
186
|
-
|
|
212
|
+
if self._is_programmable_single_table_constraint:
|
|
213
|
+
data = data[self._table_name]
|
|
214
|
+
|
|
215
|
+
transformed = self.programmable_constraint.transform(data)
|
|
216
|
+
|
|
217
|
+
if self._is_programmable_single_table_constraint:
|
|
218
|
+
return {self._table_name: transformed}
|
|
219
|
+
|
|
220
|
+
return transformed
|
|
187
221
|
|
|
188
222
|
def _reverse_transform(self, data):
|
|
189
|
-
|
|
223
|
+
if self._is_programmable_single_table_constraint:
|
|
224
|
+
data = data[self._table_name]
|
|
225
|
+
|
|
226
|
+
reverse_transformed = self.programmable_constraint.reverse_transform(data)
|
|
227
|
+
|
|
228
|
+
if self._is_programmable_single_table_constraint:
|
|
229
|
+
return {self._table_name: reverse_transformed}
|
|
230
|
+
|
|
231
|
+
return reverse_transformed
|
|
190
232
|
|
|
191
233
|
def _is_valid(self, data, metadata):
|
|
192
|
-
|
|
234
|
+
if self._is_programmable_single_table_constraint:
|
|
235
|
+
table_name = self._get_single_table_name(metadata)
|
|
236
|
+
data = data[table_name]
|
|
237
|
+
|
|
238
|
+
is_valid = self.programmable_constraint.is_valid(data)
|
|
239
|
+
|
|
240
|
+
if self._is_programmable_single_table_constraint:
|
|
241
|
+
return {table_name: is_valid}
|
|
242
|
+
|
|
243
|
+
return is_valid
|
|
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
|
|
File without changes
|
|
File without changes
|