rdt 1.13.2.dev0__tar.gz → 1.14.0__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 (43) hide show
  1. {rdt-1.13.2.dev0/rdt.egg-info → rdt-1.14.0}/PKG-INFO +13 -8
  2. {rdt-1.13.2.dev0 → rdt-1.14.0}/pyproject.toml +12 -7
  3. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/__init__.py +1 -1
  4. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/__init__.py +3 -0
  5. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/numerical.py +224 -2
  6. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/utils.py +56 -0
  7. {rdt-1.13.2.dev0 → rdt-1.14.0/rdt.egg-info}/PKG-INFO +13 -8
  8. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt.egg-info/requires.txt +8 -2
  9. {rdt-1.13.2.dev0 → rdt-1.14.0}/LICENSE +0 -0
  10. {rdt-1.13.2.dev0 → rdt-1.14.0}/README.md +0 -0
  11. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/errors.py +0 -0
  12. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/hyper_transformer.py +0 -0
  13. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/__init__.py +0 -0
  14. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/__init__.py +0 -0
  15. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/base.py +0 -0
  16. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/boolean.py +0 -0
  17. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/categorical.py +0 -0
  18. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/datetime.py +0 -0
  19. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/id.py +0 -0
  20. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/numerical.py +0 -0
  21. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/pii.py +0 -0
  22. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/text.py +0 -0
  23. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/datasets/utils.py +0 -0
  24. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/performance.py +0 -0
  25. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/performance/profiling.py +0 -0
  26. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/_validators.py +0 -0
  27. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/base.py +0 -0
  28. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/boolean.py +0 -0
  29. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/categorical.py +0 -0
  30. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/datetime.py +0 -0
  31. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/id.py +0 -0
  32. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/null.py +0 -0
  33. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/pii/__init__.py +0 -0
  34. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/pii/anonymization.py +0 -0
  35. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/pii/anonymizer.py +0 -0
  36. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/pii/utils.py +0 -0
  37. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt/transformers/text.py +0 -0
  38. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt.egg-info/SOURCES.txt +0 -0
  39. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt.egg-info/dependency_links.txt +0 -0
  40. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt.egg-info/entry_points.txt +0 -0
  41. {rdt-1.13.2.dev0 → rdt-1.14.0}/rdt.egg-info/top_level.txt +0 -0
  42. {rdt-1.13.2.dev0 → rdt-1.14.0}/setup.cfg +0 -0
  43. {rdt-1.13.2.dev0 → rdt-1.14.0}/tests/test_tasks.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: rdt
3
- Version: 1.13.2.dev0
3
+ Version: 1.14.0
4
4
  Summary: Reversible Data Transforms
5
5
  Author-email: "DataCebo, Inc." <info@sdv.dev>
6
6
  License: BSL-1.1
@@ -20,26 +20,31 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
- Requires-Python: <3.13,>=3.8
25
+ Requires-Python: <3.14,>=3.8
25
26
  Description-Content-Type: text/markdown
26
27
  License-File: LICENSE
27
28
  Requires-Dist: numpy>=1.21.0; python_version < "3.10"
28
29
  Requires-Dist: numpy>=1.23.3; python_version >= "3.10" and python_version < "3.12"
29
- Requires-Dist: numpy>=1.26.0; python_version >= "3.12"
30
+ Requires-Dist: numpy>=1.26.0; python_version >= "3.12" and python_version < "3.13"
31
+ Requires-Dist: numpy>=2.1.0; python_version >= "3.13"
30
32
  Requires-Dist: pandas>=1.4.0; python_version < "3.11"
31
33
  Requires-Dist: pandas>=1.5.0; python_version >= "3.11" and python_version < "3.12"
32
- Requires-Dist: pandas>=2.1.1; python_version >= "3.12"
34
+ Requires-Dist: pandas>=2.1.1; python_version >= "3.12" and python_version < "3.13"
35
+ Requires-Dist: pandas>=2.2.3; python_version >= "3.13"
33
36
  Requires-Dist: scipy>=1.7.3; python_version < "3.10"
34
37
  Requires-Dist: scipy>=1.9.2; python_version >= "3.10" and python_version < "3.12"
35
- Requires-Dist: scipy>=1.12.0; python_version >= "3.12"
38
+ Requires-Dist: scipy>=1.12.0; python_version >= "3.12" and python_version < "3.13"
39
+ Requires-Dist: scipy>=1.14.1; python_version >= "3.13"
36
40
  Requires-Dist: scikit-learn>=1.0.2; python_version < "3.10"
37
41
  Requires-Dist: scikit-learn>=1.1.0; python_version >= "3.10" and python_version < "3.11"
38
42
  Requires-Dist: scikit-learn>=1.1.3; python_version >= "3.11" and python_version < "3.12"
39
- Requires-Dist: scikit-learn>=1.3.1; python_version >= "3.12"
43
+ Requires-Dist: scikit-learn>=1.3.1; python_version >= "3.12" and python_version < "3.13"
44
+ Requires-Dist: scikit-learn>=1.5.2; python_version >= "3.13"
40
45
  Requires-Dist: Faker>=17
41
46
  Provides-Extra: copulas
42
- Requires-Dist: copulas>=0.12.0; extra == "copulas"
47
+ Requires-Dist: copulas>=0.12.1; extra == "copulas"
43
48
  Provides-Extra: pyarrow
44
49
  Requires-Dist: pyarrow>=17.0.0; extra == "pyarrow"
45
50
  Provides-Extra: test
@@ -13,27 +13,32 @@ classifiers = [
13
13
  'Programming Language :: Python :: 3.10',
14
14
  'Programming Language :: Python :: 3.11',
15
15
  'Programming Language :: Python :: 3.12',
16
+ 'Programming Language :: Python :: 3.13',
16
17
  'Topic :: Scientific/Engineering :: Artificial Intelligence',
17
18
  ]
18
19
  keywords = ['machine learning', 'synthetic data generation', 'benchmark', 'generative models']
19
20
  dynamic = ['version']
20
21
  license = { text = 'BSL-1.1' }
21
- requires-python = '>=3.8,<3.13'
22
+ requires-python = '>=3.8,<3.14'
22
23
  readme = 'README.md'
23
24
  dependencies = [
24
25
  "numpy>=1.21.0;python_version<'3.10'",
25
26
  "numpy>=1.23.3;python_version>='3.10' and python_version<'3.12'",
26
- "numpy>=1.26.0;python_version>='3.12'",
27
+ "numpy>=1.26.0;python_version>='3.12' and python_version<'3.13'",
28
+ "numpy>=2.1.0;python_version>='3.13'",
27
29
  "pandas>=1.4.0;python_version<'3.11'",
28
30
  "pandas>=1.5.0;python_version>='3.11' and python_version<'3.12'",
29
- "pandas>=2.1.1;python_version>='3.12'",
31
+ "pandas>=2.1.1;python_version>='3.12' and python_version<'3.13'",
32
+ "pandas>=2.2.3;python_version>='3.13'",
30
33
  "scipy>=1.7.3;python_version<'3.10'",
31
34
  "scipy>=1.9.2;python_version>='3.10' and python_version<'3.12'",
32
- "scipy>=1.12.0;python_version>='3.12'",
35
+ "scipy>=1.12.0;python_version>='3.12' and python_version<'3.13'",
36
+ "scipy>=1.14.1;python_version>='3.13'",
33
37
  "scikit-learn>=1.0.2;python_version<'3.10'",
34
38
  "scikit-learn>=1.1.0;python_version>='3.10' and python_version<'3.11'",
35
39
  "scikit-learn>=1.1.3;python_version>='3.11' and python_version<'3.12'",
36
- "scikit-learn>=1.3.1;python_version>='3.12'",
40
+ "scikit-learn>=1.3.1;python_version>='3.12' and python_version<'3.13'",
41
+ "scikit-learn>=1.5.2;python_version>='3.13'",
37
42
  'Faker>=17',
38
43
  ]
39
44
 
@@ -48,7 +53,7 @@ dependencies = [
48
53
  rdt = { main = 'rdt.cli.__main__:main' }
49
54
 
50
55
  [project.optional-dependencies]
51
- copulas = ['copulas>=0.12.0',]
56
+ copulas = ['copulas>=0.12.1',]
52
57
  pyarrow = ['pyarrow>=17.0.0']
53
58
  test = [
54
59
  'rdt[pyarrow]',
@@ -139,7 +144,7 @@ collect_ignore = ['pyproject.toml']
139
144
  exclude_lines = ['NotImplementedError()']
140
145
 
141
146
  [tool.bumpversion]
142
- current_version = "1.13.2.dev0"
147
+ current_version = "1.14.0"
143
148
  parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?'
144
149
  serialize = [
145
150
  '{major}.{minor}.{patch}.{release}{candidate}',
@@ -4,7 +4,7 @@
4
4
 
5
5
  __author__ = 'DataCebo, Inc.'
6
6
  __email__ = 'info@sdv.dev'
7
- __version__ = '1.13.2.dev0'
7
+ __version__ = '1.14.0'
8
8
 
9
9
 
10
10
  import sys
@@ -28,6 +28,8 @@ from rdt.transformers.numerical import (
28
28
  ClusterBasedNormalizer,
29
29
  FloatFormatter,
30
30
  GaussianNormalizer,
31
+ LogScaler,
32
+ LogitScaler,
31
33
  )
32
34
  from rdt.transformers.pii.anonymizer import (
33
35
  AnonymizedFaker,
@@ -46,6 +48,7 @@ __all__ = [
46
48
  'FrequencyEncoder',
47
49
  'GaussianNormalizer',
48
50
  'LabelEncoder',
51
+ 'LogScaler',
49
52
  'NullTransformer',
50
53
  'OneHotEncoder',
51
54
  'OptimizedTimestampEncoder',
@@ -8,10 +8,10 @@ import numpy as np
8
8
  import pandas as pd
9
9
  import scipy
10
10
 
11
- from rdt.errors import TransformerInputError
11
+ from rdt.errors import InvalidDataError, TransformerInputError
12
12
  from rdt.transformers.base import BaseTransformer
13
13
  from rdt.transformers.null import NullTransformer
14
- from rdt.transformers.utils import learn_rounding_digits
14
+ from rdt.transformers.utils import learn_rounding_digits, logit, sigmoid
15
15
 
16
16
  EPSILON = np.finfo(np.float32).eps
17
17
  INTEGER_BOUNDS = {
@@ -626,3 +626,225 @@ class ClusterBasedNormalizer(FloatFormatter):
626
626
  recovered_data = np.stack([recovered_data, data[:, -1]], axis=1) # noqa: PD013
627
627
 
628
628
  return super()._reverse_transform(recovered_data)
629
+
630
+
631
+ class LogitScaler(FloatFormatter):
632
+ """Transformer for numerical data by applying a logit function.
633
+
634
+ This transformer works by replacing the values with a scaled
635
+ version and then applying a logit function. The reverse transform
636
+ applies a sigmoid to the data and then scales it back to the original space.
637
+
638
+ Null values are replaced using a ``NullTransformer``.
639
+
640
+ Args:
641
+ missing_value_replacement (object):
642
+ Indicate what to replace the null values with. If an integer or float is given,
643
+ replace them with the given value. If the strings ``'mean'`` or ``'mode'``
644
+ are given, replace them with the corresponding aggregation and if ``'random'``
645
+ replace each null value with a random value in the data range. Defaults to ``mean``.
646
+ missing_value_generation (str or None):
647
+ The way missing values are being handled. There are three strategies:
648
+
649
+ * ``random``: Randomly generates missing values based on the percentage of
650
+ missing values.
651
+ * ``from_column``: Creates a binary column that describes whether the original
652
+ value was missing. Then use it to recreate missing values.
653
+ * ``None``: Do nothing with the missing values on the reverse transform. Simply
654
+ pass whatever data we get through.
655
+ min_value (float):
656
+ The min value for the logit function. Defaults to 0.
657
+ max_value (float):
658
+ max_value (float): The max value for the logit function. Defaults to 1.0.
659
+ learn_rounding_scheme (bool):
660
+ Whether or not to learn what place to round to based on the data seen during ``fit``.
661
+ If ``True``, the data returned by ``reverse_transform`` will be rounded to that place.
662
+ Defaults to ``False``.
663
+ """
664
+
665
+ def __init__(
666
+ self,
667
+ missing_value_replacement='mean',
668
+ missing_value_generation='random',
669
+ min_value=0.0,
670
+ max_value=1.0,
671
+ learn_rounding_scheme=False,
672
+ ):
673
+ if not (isinstance(min_value, int) or isinstance(min_value, float)) or not (
674
+ isinstance(max_value, int) or isinstance(max_value, float)
675
+ ):
676
+ error_msg = 'The min_value and max_value must be of type int or float.'
677
+ raise TransformerInputError(error_msg)
678
+ if min_value == max_value:
679
+ error_msg = 'The min_value and max_value for the logit function cannot be equal.'
680
+ raise TransformerInputError(error_msg)
681
+
682
+ super().__init__(
683
+ missing_value_replacement=missing_value_replacement,
684
+ missing_value_generation=missing_value_generation,
685
+ learn_rounding_scheme=learn_rounding_scheme,
686
+ )
687
+ self.min_value = min_value
688
+ self.max_value = max_value
689
+
690
+ def _validate_logit_inputs(self, data):
691
+ out_of_range_vals = data[(data < self.min_value) | (data > self.max_value)]
692
+ if len(out_of_range_vals) > 0:
693
+ num_vals_to_print = 5
694
+ out_of_range_vals = [str(x) for x in sorted(out_of_range_vals, key=lambda x: str(x))]
695
+ if len(out_of_range_vals) > 5:
696
+ extra_missing_vals = f'+ {len(out_of_range_vals) - num_vals_to_print} more'
697
+ out_of_range_vals = (
698
+ f'[{", ".join(out_of_range_vals[:num_vals_to_print])} {extra_missing_vals}]'
699
+ )
700
+ else:
701
+ out_of_range_vals = f'[{", ".join(out_of_range_vals)}]'
702
+
703
+ raise InvalidDataError(
704
+ f"Unable to apply logit function to column '{self.columns[0]}' due to out of "
705
+ f'range values ({out_of_range_vals}).'
706
+ )
707
+
708
+ def _fit(self, data):
709
+ self._validate_logit_inputs(data)
710
+ return super()._fit(data)
711
+
712
+ def _transform(self, data):
713
+ transformed = super()._transform(data)
714
+ transformed_vals = transformed if transformed.ndim == 1 else transformed[:, 0]
715
+ self._validate_logit_inputs(transformed_vals)
716
+ logit_vals = logit(transformed_vals, self.min_value, self.max_value)
717
+ if transformed.ndim == 1:
718
+ return logit_vals
719
+
720
+ transformed[:, 0] = logit_vals
721
+ return transformed
722
+
723
+ def _reverse_transform(self, data):
724
+ if not isinstance(data, np.ndarray):
725
+ data = data.to_numpy()
726
+
727
+ sampled_vals = data if data.ndim == 1 else data[:, 0]
728
+ reversed_values = sigmoid(sampled_vals, self.min_value, self.max_value)
729
+ if data.ndim == 1:
730
+ return super()._reverse_transform(reversed_values)
731
+
732
+ data[:, 0] = reversed_values
733
+ return super()._reverse_transform(data)
734
+
735
+
736
+ class LogScaler(FloatFormatter):
737
+ """Transformer for numerical data using log.
738
+
739
+ This transformer scales numerical values using log and an optional constant.
740
+ Null values are replaced using a ``NullTransformer``.
741
+
742
+ Args:
743
+ missing_value_replacement (object):
744
+ Indicate what to replace the null values with. If an integer or float is given,
745
+ replace them with the given value. If the strings ``'mean'`` or ``'mode'``
746
+ are given, replace them with the corresponding aggregation and if ``'random'``
747
+ replace each null value with a random value in the data range. Defaults to ``mean``.
748
+ missing_value_generation (str or None):
749
+ The way missing values are being handled. There are three strategies:
750
+ * ``random``: Randomly generates missing values based on the percentage of
751
+ missing values.
752
+ * ``from_column``: Creates a binary column that describes whether the original
753
+ value was missing. Then use it to recreate missing values.
754
+ * ``None``: Do nothing with the missing values on the reverse transform. Simply
755
+ pass whatever data we get through.
756
+ constant (float):
757
+ The constant to set as the 0-value for the log-based transform. Defaults to 0
758
+ (do not modify the 0-value of the data).
759
+ invert (bool):
760
+ Whether to invert the data with respect to the constant value. If False, do not
761
+ invert the data (all values will be greater than the constant value). If True,
762
+ invert the data (all the values will be less than the constant value).
763
+ Defaults to False.
764
+ learn_rounding_scheme (bool):
765
+ Whether or not to learn what place to round to based on the data seen during ``fit``.
766
+ If ``True``, the data returned by ``reverse_transform`` will be rounded to that place.
767
+ Defaults to ``False``.
768
+ """
769
+
770
+ def __init__(
771
+ self,
772
+ missing_value_replacement='mean',
773
+ missing_value_generation='random',
774
+ constant: float = 0.0,
775
+ invert: bool = False,
776
+ learn_rounding_scheme: bool = False,
777
+ ):
778
+ if isinstance(constant, (int, float)):
779
+ self.constant = constant
780
+ else:
781
+ raise ValueError('The constant parameter must be a float or int.')
782
+ if isinstance(invert, bool):
783
+ self.invert = invert
784
+ else:
785
+ raise ValueError('The invert parameter must be a bool.')
786
+
787
+ super().__init__(
788
+ missing_value_replacement=missing_value_replacement,
789
+ missing_value_generation=missing_value_generation,
790
+ learn_rounding_scheme=learn_rounding_scheme,
791
+ )
792
+
793
+ def _validate_data(self, data: pd.Series):
794
+ column_name = self.get_input_column()
795
+ if self.invert:
796
+ if not all(data < self.constant):
797
+ raise InvalidDataError(
798
+ f"Unable to apply a log transform to column '{column_name}' due to constant"
799
+ ' being too small.'
800
+ )
801
+ else:
802
+ if not all(data > self.constant):
803
+ raise InvalidDataError(
804
+ f"Unable to apply a log transform to column '{column_name}' due to constant"
805
+ ' being too large.'
806
+ )
807
+
808
+ def _fit(self, data):
809
+ super()._fit(data)
810
+ data = super()._transform(data)
811
+
812
+ if data.ndim > 1:
813
+ self._validate_data(data[:, 0])
814
+ else:
815
+ self._validate_data(data)
816
+
817
+ def _log_transform(self, data):
818
+ self._validate_data(data)
819
+
820
+ if self.invert:
821
+ return np.log(self.constant - data)
822
+ else:
823
+ return np.log(data - self.constant)
824
+
825
+ def _transform(self, data):
826
+ data = super()._transform(data)
827
+
828
+ if data.ndim > 1:
829
+ data[:, 0] = self._log_transform(data[:, 0])
830
+ else:
831
+ data = self._log_transform(data)
832
+
833
+ return data
834
+
835
+ def _reverse_log(self, data):
836
+ if self.invert:
837
+ return self.constant - np.exp(data)
838
+ else:
839
+ return np.exp(data) + self.constant
840
+
841
+ def _reverse_transform(self, data):
842
+ if not isinstance(data, np.ndarray):
843
+ data = data.to_numpy()
844
+
845
+ if data.ndim > 1:
846
+ data[:, 0] = self._reverse_log(data[:, 0])
847
+ else:
848
+ data = self._reverse_log(data)
849
+
850
+ return super()._reverse_transform(data)
@@ -6,6 +6,7 @@ import string
6
6
  import sys
7
7
  import warnings
8
8
  from collections import defaultdict
9
+ from decimal import Decimal
9
10
 
10
11
  import numpy as np
11
12
  import pandas as pd
@@ -126,6 +127,17 @@ def _from_generators(generators, max_repeat):
126
127
  yield ''.join(reversed(generated))
127
128
 
128
129
 
130
+ def _cast_to_type(data, dtype):
131
+ if isinstance(data, pd.Series):
132
+ data = data.apply(dtype)
133
+ elif isinstance(data, (np.ndarray, list)):
134
+ data = np.array([dtype(value) for value in data])
135
+ else:
136
+ data = dtype(data)
137
+
138
+ return data
139
+
140
+
129
141
  def strings_from_regex(regex, max_repeat=16):
130
142
  """Generate strings that match the given regular expression.
131
143
 
@@ -280,6 +292,50 @@ def learn_rounding_digits(data):
280
292
  return None
281
293
 
282
294
 
295
+ def logit(data, low, high):
296
+ """Apply a logit function to the data using ``low`` and ``high``.
297
+
298
+ Args:
299
+ data (pd.Series, pd.DataFrame, np.array, int, or float):
300
+ Data to apply the logit function to.
301
+ low (pd.Series, np.array, int, or float):
302
+ Low value/s to use when scaling.
303
+ high (pd.Series, np.array, int, or float):
304
+ High value/s to use when scaling.
305
+
306
+ Returns:
307
+ Logit scaled version of the input data.
308
+ """
309
+ data = (data - low) / (high - low)
310
+ data = _cast_to_type(data, Decimal)
311
+ data = data * Decimal(0.95) + Decimal(0.025)
312
+ data = _cast_to_type(data, float)
313
+ return np.log(data / (1.0 - data))
314
+
315
+
316
+ def sigmoid(data, low, high):
317
+ """Apply a sigmoid function to the data using ``low`` and ``high``.
318
+
319
+ Args:
320
+ data (pd.Series, pd.DataFrame, np.array, int, float or datetime):
321
+ Data to apply the logit function to.
322
+ low (pd.Series, np.array, int, float or datetime):
323
+ Low value/s to use when scaling.
324
+ high (pd.Series, np.array, int, float or datetime):
325
+ High value/s to use when scaling.
326
+
327
+ Returns:
328
+ Sigmoid transform of the input data.
329
+ """
330
+ data = 1 / (1 + np.exp(-data))
331
+ data = _cast_to_type(data, Decimal)
332
+ data = (data - Decimal(0.025)) / Decimal(0.95)
333
+ data = _cast_to_type(data, float)
334
+ data = data * (high - low) + low
335
+
336
+ return data
337
+
338
+
283
339
  class WarnDict(dict):
284
340
  """Custom dictionary to raise a deprecation warning."""
285
341
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: rdt
3
- Version: 1.13.2.dev0
3
+ Version: 1.14.0
4
4
  Summary: Reversible Data Transforms
5
5
  Author-email: "DataCebo, Inc." <info@sdv.dev>
6
6
  License: BSL-1.1
@@ -20,26 +20,31 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
- Requires-Python: <3.13,>=3.8
25
+ Requires-Python: <3.14,>=3.8
25
26
  Description-Content-Type: text/markdown
26
27
  License-File: LICENSE
27
28
  Requires-Dist: numpy>=1.21.0; python_version < "3.10"
28
29
  Requires-Dist: numpy>=1.23.3; python_version >= "3.10" and python_version < "3.12"
29
- Requires-Dist: numpy>=1.26.0; python_version >= "3.12"
30
+ Requires-Dist: numpy>=1.26.0; python_version >= "3.12" and python_version < "3.13"
31
+ Requires-Dist: numpy>=2.1.0; python_version >= "3.13"
30
32
  Requires-Dist: pandas>=1.4.0; python_version < "3.11"
31
33
  Requires-Dist: pandas>=1.5.0; python_version >= "3.11" and python_version < "3.12"
32
- Requires-Dist: pandas>=2.1.1; python_version >= "3.12"
34
+ Requires-Dist: pandas>=2.1.1; python_version >= "3.12" and python_version < "3.13"
35
+ Requires-Dist: pandas>=2.2.3; python_version >= "3.13"
33
36
  Requires-Dist: scipy>=1.7.3; python_version < "3.10"
34
37
  Requires-Dist: scipy>=1.9.2; python_version >= "3.10" and python_version < "3.12"
35
- Requires-Dist: scipy>=1.12.0; python_version >= "3.12"
38
+ Requires-Dist: scipy>=1.12.0; python_version >= "3.12" and python_version < "3.13"
39
+ Requires-Dist: scipy>=1.14.1; python_version >= "3.13"
36
40
  Requires-Dist: scikit-learn>=1.0.2; python_version < "3.10"
37
41
  Requires-Dist: scikit-learn>=1.1.0; python_version >= "3.10" and python_version < "3.11"
38
42
  Requires-Dist: scikit-learn>=1.1.3; python_version >= "3.11" and python_version < "3.12"
39
- Requires-Dist: scikit-learn>=1.3.1; python_version >= "3.12"
43
+ Requires-Dist: scikit-learn>=1.3.1; python_version >= "3.12" and python_version < "3.13"
44
+ Requires-Dist: scikit-learn>=1.5.2; python_version >= "3.13"
40
45
  Requires-Dist: Faker>=17
41
46
  Provides-Extra: copulas
42
- Requires-Dist: copulas>=0.12.0; extra == "copulas"
47
+ Requires-Dist: copulas>=0.12.1; extra == "copulas"
43
48
  Provides-Extra: pyarrow
44
49
  Requires-Dist: pyarrow>=17.0.0; extra == "pyarrow"
45
50
  Provides-Extra: test
@@ -19,14 +19,20 @@ scipy>=1.9.2
19
19
  pandas>=1.5.0
20
20
  scikit-learn>=1.1.3
21
21
 
22
- [:python_version >= "3.12"]
22
+ [:python_version >= "3.12" and python_version < "3.13"]
23
23
  numpy>=1.26.0
24
24
  pandas>=2.1.1
25
25
  scipy>=1.12.0
26
26
  scikit-learn>=1.3.1
27
27
 
28
+ [:python_version >= "3.13"]
29
+ numpy>=2.1.0
30
+ pandas>=2.2.3
31
+ scipy>=1.14.1
32
+ scikit-learn>=1.5.2
33
+
28
34
  [copulas]
29
- copulas>=0.12.0
35
+ copulas>=0.12.1
30
36
 
31
37
  [dev]
32
38
  rdt[test]
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