Skip to content

Commit

Permalink
StandardScalerTransform optimization (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander76Kuznetsov committed Feb 19, 2024
1 parent 491de74 commit 71b80d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions etna/transforms/math/sklearn.py
Expand Up @@ -3,6 +3,7 @@
from typing import Dict
from typing import List
from typing import Optional
from typing import Sequence
from typing import Union
from typing import cast

Expand Down Expand Up @@ -226,9 +227,8 @@ def _inverse_transform(self, df: pd.DataFrame) -> pd.DataFrame:
return df

def _preprocess_macro(self, df: pd.DataFrame) -> np.ndarray:
segments = sorted(set(df.columns.get_level_values("segment")))
x = df.loc[:, pd.IndexSlice[:, self.in_column]]
x = pd.concat([x[segment] for segment in segments]).values
in_column = cast(Sequence[str], self.in_column)
x = TSDataset.to_flatten(df, features=in_column)[self.in_column].values
return x

def _postprocess_macro(self, df: pd.DataFrame, transformed: np.ndarray) -> np.ndarray:
Expand Down

0 comments on commit 71b80d2

Please sign in to comment.