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

format imputer cols_transform_value #5373

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
11 changes: 10 additions & 1 deletion python/federatedml/feature/imputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,16 @@ def __get_cols_transform_value(self, data, replace_method, replace_value=None):
LOGGER.debug(f"replace value for feature {feature} is: {transform_value}")
else:
raise ValueError("Unknown replace method:{}".format(replace_method))
cols_transform_value[feature] = transform_value
if (data.schema.get("meta",{}).get("exclusive_data_type",{}).get(feature) is not None):
data_type = data.schema["meta"]["exclusive_data_type"][feature]
if ("str" == data_type):
cols_transform_value[feature] = str(transform_value)
elif ("int" == data_type):
cols_transform_value[feature] = int(transform_value)
else:
cols_transform_value[feature] = float(transform_value)
else:
cols_transform_value[feature] = transform_value

LOGGER.debug(f"cols_transform value is: {cols_transform_value}")
cols_transform_value = [cols_transform_value[key] for key in header]
Expand Down