rdt 1.17.1.dev1__tar.gz → 1.17.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.
- {rdt-1.17.1.dev1/rdt.egg-info → rdt-1.17.2.dev0}/PKG-INFO +1 -1
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/pyproject.toml +1 -1
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/__init__.py +1 -1
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/numerical.py +40 -1
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0/rdt.egg-info}/PKG-INFO +1 -1
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/LICENSE +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/README.md +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/_utils.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/errors.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/hyper_transformer.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/__init__.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/__init__.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/base.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/boolean.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/categorical.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/datetime.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/id.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/numerical.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/pii.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/text.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/datasets/utils.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/performance.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/performance/profiling.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/__init__.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/_validators.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/base.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/boolean.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/categorical.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/datetime.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/id.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/null.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/pii/__init__.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/pii/anonymization.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/pii/anonymizer.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/pii/utils.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/text.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt/transformers/utils.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt.egg-info/SOURCES.txt +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt.egg-info/dependency_links.txt +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt.egg-info/entry_points.txt +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt.egg-info/requires.txt +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/rdt.egg-info/top_level.txt +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/setup.cfg +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/tests/test_scripts.py +0 -0
- {rdt-1.17.1.dev1 → rdt-1.17.2.dev0}/tests/test_tasks.py +0 -0
|
@@ -144,7 +144,7 @@ collect_ignore = ['pyproject.toml']
|
|
|
144
144
|
exclude_lines = ['NotImplementedError()']
|
|
145
145
|
|
|
146
146
|
[tool.bumpversion]
|
|
147
|
-
current_version = "1.17.
|
|
147
|
+
current_version = "1.17.2.dev0"
|
|
148
148
|
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?'
|
|
149
149
|
serialize = [
|
|
150
150
|
'{major}.{minor}.{patch}.{release}{candidate}',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Transformers for numerical data."""
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
|
+
import logging
|
|
4
5
|
import warnings
|
|
5
6
|
from importlib import import_module
|
|
6
7
|
|
|
@@ -13,6 +14,8 @@ from rdt.transformers.base import BaseTransformer
|
|
|
13
14
|
from rdt.transformers.null import NullTransformer
|
|
14
15
|
from rdt.transformers.utils import learn_rounding_digits, logit, sigmoid
|
|
15
16
|
|
|
17
|
+
LOGGER = logging.getLogger(__name__)
|
|
18
|
+
|
|
16
19
|
EPSILON = np.finfo(np.float32).eps
|
|
17
20
|
INTEGER_BOUNDS = {
|
|
18
21
|
'Int8': (-(2**7), 2**7 - 1),
|
|
@@ -300,6 +303,8 @@ class GaussianNormalizer(FloatFormatter):
|
|
|
300
303
|
"""
|
|
301
304
|
|
|
302
305
|
_univariate = None
|
|
306
|
+
_fallback_distribution = 'norm'
|
|
307
|
+
_learned_distribution_name = None
|
|
303
308
|
_DEPRECATED_DISTRIBUTIONS_MAPPING = {
|
|
304
309
|
'gaussian': 'norm',
|
|
305
310
|
'student_t': 't',
|
|
@@ -359,8 +364,15 @@ class GaussianNormalizer(FloatFormatter):
|
|
|
359
364
|
)
|
|
360
365
|
distribution = self._DEPRECATED_DISTRIBUTIONS_MAPPING[distribution]
|
|
361
366
|
|
|
367
|
+
self._learned_distribution_name = distribution
|
|
362
368
|
distribution = self._distributions[distribution]
|
|
363
369
|
|
|
370
|
+
else:
|
|
371
|
+
distribution_name_map = {v: k for k, v in self._distributions.items()}
|
|
372
|
+
self._learned_distribution_name = distribution_name_map.get(
|
|
373
|
+
distribution if isinstance(distribution, type) else type(distribution), 'unknown'
|
|
374
|
+
)
|
|
375
|
+
|
|
364
376
|
self._distribution = distribution
|
|
365
377
|
|
|
366
378
|
def _get_univariate(self):
|
|
@@ -390,7 +402,16 @@ class GaussianNormalizer(FloatFormatter):
|
|
|
390
402
|
|
|
391
403
|
with warnings.catch_warnings():
|
|
392
404
|
warnings.simplefilter('ignore')
|
|
393
|
-
|
|
405
|
+
try:
|
|
406
|
+
self._univariate.fit(data)
|
|
407
|
+
except Exception:
|
|
408
|
+
LOGGER.info(
|
|
409
|
+
f"Unable to fit the distribution '{self._learned_distribution_name}'. "
|
|
410
|
+
f"Falling back to '{self._fallback_distribution}'."
|
|
411
|
+
)
|
|
412
|
+
self._learned_distribution_name = self._fallback_distribution
|
|
413
|
+
self._univariate = self._distributions[self._fallback_distribution]()
|
|
414
|
+
self._univariate.fit(data)
|
|
394
415
|
|
|
395
416
|
def _copula_transform(self, data):
|
|
396
417
|
cdf = self._univariate.cdf(data)
|
|
@@ -434,6 +455,24 @@ class GaussianNormalizer(FloatFormatter):
|
|
|
434
455
|
|
|
435
456
|
return super()._reverse_transform(data)
|
|
436
457
|
|
|
458
|
+
@property
|
|
459
|
+
def learned_distribution(self):
|
|
460
|
+
"""Get the learned distribution name and parameters.
|
|
461
|
+
|
|
462
|
+
Returns:
|
|
463
|
+
dict:
|
|
464
|
+
A dictionary containing the distribution name and parameters.
|
|
465
|
+
"""
|
|
466
|
+
if self._univariate is None:
|
|
467
|
+
raise ValueError('The transformer has not been fitted yet.')
|
|
468
|
+
|
|
469
|
+
parameters = {}
|
|
470
|
+
if hasattr(self._univariate, 'to_dict') and self._univariate.to_dict is not None:
|
|
471
|
+
parameters = self._univariate.to_dict()
|
|
472
|
+
parameters.pop('type')
|
|
473
|
+
|
|
474
|
+
return {'distribution': self._learned_distribution_name, 'parameters': parameters}
|
|
475
|
+
|
|
437
476
|
|
|
438
477
|
class ClusterBasedNormalizer(FloatFormatter):
|
|
439
478
|
"""Transformer for numerical data using a Bayesian Gaussian Mixture Model.
|
|
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
|