Skip to content

Commit 55b56a8

Browse files
authored
[FSTORE-1412][Append] Add std_dev alias for transformation functions (#1011)
1 parent 08a4a66 commit 55b56a8

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

python/hsfs/core/feature_descriptive_statistics.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def __init__(
8686
self._max = max
8787
self._sum = sum
8888
self._mean = mean
89-
self._std_dev = std_dev
89+
# Accept the legacy lowercase ``stddev`` key (e.g. from backend payloads
90+
# or older callers) so the rename to ``std_dev`` stays backward compatible.
91+
self._std_dev = std_dev if std_dev is not None else kwargs.get("stddev")
9092
self._percentiles = percentiles
9193
self._distinctness = distinctness
9294
self._entropy = entropy

python/hsfs/transformation_statistics.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from typing import TYPE_CHECKING, Any
2222

2323
import humps
24-
from hopsworks_apigen import public
24+
from hopsworks_apigen import deprecated, public
2525

2626

2727
if TYPE_CHECKING:
@@ -65,7 +65,9 @@ def __init__(
6565
self._max = max
6666
self._sum = sum
6767
self._mean = mean
68-
self._std_dev = std_dev
68+
# Accept the legacy lowercase ``stddev`` key (e.g. from backend payloads
69+
# or older callers) so the rename to ``std_dev`` stays backward compatible.
70+
self._std_dev = std_dev if std_dev is not None else kwargs.get("stddev")
6971
self._percentiles = percentiles
7072
self._distinctness = distinctness
7173
self._entropy = entropy
@@ -157,6 +159,18 @@ def std_dev(self) -> float | None:
157159
"""Standard deviation of the feature values."""
158160
return self._std_dev
159161

162+
@public
163+
@property
164+
@deprecated(
165+
"hsfs.transformation_statistics.FeatureTransformationStatistics.std_dev"
166+
)
167+
def stddev(self) -> float | None:
168+
"""Standard deviation of the feature values.
169+
170+
Deprecated alias for [`std_dev`][hsfs.transformation_statistics.FeatureTransformationStatistics.std_dev].
171+
"""
172+
return self._std_dev
173+
160174
@public
161175
@property
162176
def percentiles(self) -> Mapping[str, float] | None:

0 commit comments

Comments
 (0)