Remove loop of normalization from metadata

This commit is contained in:
Emre 2022-10-29 21:11:29 +03:00 committed by Robert Caulk
parent 5c14aeddc6
commit f98c7a2423

View File

@ -354,13 +354,18 @@ class FreqaiDataKitchen:
:param df: Dataframe to be standardized :param df: Dataframe to be standardized
""" """
train_max = []
train_min = []
for item in df.keys(): for item in df.keys():
df[item] = ( train_max.append(self.data[item + "_max"])
2 train_min.append(self.data[item + "_min"])
* (df[item] - self.data[f"{item}_min"])
/ (self.data[f"{item}_max"] - self.data[f"{item}_min"]) train_max_series = pd.Series(train_max, index=df.keys())
- 1 train_min_series = pd.Series(train_min, index=df.keys())
)
df = (
2 * (df - train_min_series) / (train_max_series - train_min_series) - 1
)
return df return df