Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature scaling supports upper and lower for specific columns, not only all columns #5266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions python/federatedml/feature/feature_scale/base_scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def __get_min_max_value_by_normal(self, data):

if self.feat_upper is not None:
if isinstance(self.feat_upper, list):
self.__check_equal(data_shape, len(self.feat_upper))
for i in range(data_shape):
if i in scale_column_idx_set:
if column_max_value[i] > self.feat_upper[i]:
column_max_value[i] = self.feat_upper[i]
if column_min_value[i] > self.feat_upper[i]:
column_min_value[i] = self.feat_upper[i]
self.__check_equal(len(scale_column_idx_set), len(self.feat_upper))
for upper_index, col_index in enumerate(scale_column_idx_set):
if col_index < data_shape:
if column_max_value[col_index] > self.feat_upper[upper_index]:
column_max_value[col_index] = self.feat_upper[upper_index]
if column_min_value[col_index] > self.feat_upper[upper_index]:
column_min_value[col_index] = self.feat_upper[upper_index]
else:
for i in range(data_shape):
if i in scale_column_idx_set:
Expand All @@ -140,13 +140,13 @@ def __get_min_max_value_by_normal(self, data):

if self.feat_lower is not None:
if isinstance(self.feat_lower, list):
self.__check_equal(data_shape, len(self.feat_lower))
for i in range(data_shape):
if i in scale_column_idx_set:
if column_min_value[i] < self.feat_lower[i]:
column_min_value[i] = self.feat_lower[i]
if column_max_value[i] < self.feat_lower[i]:
column_max_value[i] = self.feat_lower[i]
self.__check_equal(len(scale_column_idx_set), len(self.feat_lower))
for lower_index, col_index in enumerate(scale_column_idx_set):
if col_index < data_shape:
if column_min_value[col_index] < self.feat_lower[lower_index]:
column_min_value[col_index] = self.feat_lower[lower_index]
if column_max_value[col_index] < self.feat_lower[lower_index]:
column_max_value[col_index] = self.feat_lower[lower_index]
else:
for i in range(data_shape):
if i in scale_column_idx_set:
Expand Down
Loading