Skip to content

Commit

Permalink
Merge pull request #3 from synnax-ai/change_to_convention_scaler
Browse files Browse the repository at this point in the history
change methods names
  • Loading branch information
DanilZherebtsov authored Aug 30, 2024
2 parents 95e0b84 + 059e60c commit c03db66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "synnax-shared"
version = "1.8.0"
version = "1.9.0"
description = "Synnax shared Python pacakges"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
12 changes: 6 additions & 6 deletions src/synnax_shared/data_processing/scaler/linear_scaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ def __init__(self, offset: float, divisor: float) -> None:
self.offset = offset
self.divisor = divisor

def transform_series(self, series: Series) -> Series:
def _transform_series(self, series: Series) -> Series:
float_series = series.astype(float)
return (float_series + self.offset) / self.divisor

def inverse_transform_series(self, series: Series) -> Series:
def _inverse_transform_series(self, series: Series) -> Series:
float_series = series.astype(float)
return (float_series * self.divisor) - self.offset

def transform_dataframe(self, dataframe: DataFrame) -> DataFrame:
def transform(self, dataframe: DataFrame) -> DataFrame:
dataframe_copy = dataframe.copy()
for column in dataframe_copy.select_dtypes(include=[number]):
dataframe_copy[column] = self.transform_series(dataframe_copy[column])
dataframe_copy[column] = self._transform_series(dataframe_copy[column])
return dataframe_copy

def inverse_transform_dataframe(self, dataframe: DataFrame) -> DataFrame:
def inverse_transform(self, dataframe: DataFrame) -> DataFrame:
dataframe_copy = dataframe.copy()
for column in dataframe_copy.select_dtypes(include=[number]):
dataframe_copy[column] = self.inverse_transform_series(
dataframe_copy[column] = self._inverse_transform_series(
dataframe_copy[column]
)
return dataframe_copy
Expand Down

0 comments on commit c03db66

Please sign in to comment.