Skip to content

Commit

Permalink
Index is added to the transform function in scaler class.
Browse files Browse the repository at this point in the history
  • Loading branch information
smkia committed Nov 8, 2023
1 parent 563139d commit 933b553
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pcntoolkit/util/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,15 +1141,19 @@ def fit(self, X):
self.max[i] = np.median(np.sort(X[:,i])[-int(np.round(X.shape[0] * self.tail)):])


def transform(self, X):
def transform(self, X, index=None):

if self.scaler_type == 'standardize':

X = (X - self.m) / self.s
if index is None:
X = (X - self.m) / self.s
else:
X = (X - self.m[index]) / self.s[index]

elif self.scaler_type in ['minmax', 'robminmax']:

X = (X - self.min) / (self.max - self.min)
if index is None:
X = (X - self.min) / (self.max - self.min)
else:
X = (X - self.min[index]) / (self.max[index] - self.min[index])

if self.adjust_outliers:

Expand Down

0 comments on commit 933b553

Please sign in to comment.